From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3EE3C433E1 for ; Tue, 19 May 2020 21:59:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A0C8E205CB for ; Tue, 19 May 2020 21:59:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=landley-net.20150623.gappssmtp.com header.i=@landley-net.20150623.gappssmtp.com header.b="ftiUb59L" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727831AbgESV7H (ORCPT ); Tue, 19 May 2020 17:59:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726194AbgESV7G (ORCPT ); Tue, 19 May 2020 17:59:06 -0400 Received: from mail-ot1-x342.google.com (mail-ot1-x342.google.com [IPv6:2607:f8b0:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8068C08C5C1 for ; Tue, 19 May 2020 14:59:06 -0700 (PDT) Received: by mail-ot1-x342.google.com with SMTP id a68so835689otb.10 for ; Tue, 19 May 2020 14:59:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=landley-net.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=aJ30tY44Y1IVnHTs0oYR9AupzvvK3j296liG3N8OpVo=; b=ftiUb59LkFILedozGY9XVYdMy2l42E9hAhepGXbGxUyVa+wAu6aqRNDMJALil6/O8J booNhbKuCLrJsvfeGYjMVBbrzm+mRolULhd3N/LGe1R7ZdYQZzgHYrtpJe1Rq05peuT4 SQk27e6lcCUHwKixSX6yhM/JFqcggLFmwNd5gg8N9HHaBZCEayCGGf3J4Ks/Kpuj9Pej A3YhDP9GJDMu627RGDh+4viwdlrocpgf05zpzxRYjp5SXVWViTZ+1x5ji3fdzeawktay 3oKrus4lO58304pOZVtJGawndLbdhjykoMteObMV2UkVXKcxGi2g6rBzwPJLXHgcEHzI m1/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=aJ30tY44Y1IVnHTs0oYR9AupzvvK3j296liG3N8OpVo=; b=k+ao/hBSIIYeS9mdN/QyWI1XDqYaxm6gT4n4qJx8no2H5q0/glYbS8pLHRzcw0BibR ubAchzwkAVwlraRXJvS+kgUu/3sklWkhaUhlRNUdK3zPw8hBKqz8/nVEL5edcy5LtYVW w2wgcwo2oQFBjX7bBYh3pzhd7ZKpbyYgGyNBGgL6lz8Xaq5Mx6R3bZAwYu6mfB5DqYbz 3sBx9dT2u5JSZgvOnO+FTwhS+vD09gIq+H4dp/Ca3WDvPTVa45chURWTiswilfdD8qc/ i6bK/LXXyA23hEib/qMO5wg6PqaCbl4Muf9G9xmN+0Bm2UWzG0mTjgMOHXchgHAdxGkr hTyw== X-Gm-Message-State: AOAM532MlV9kc3RrhF5dVe2jWCpf1IjQ7/M1LH9rDsaB2hZDijWtVD7O 3FfI0NmMkPk1XPI9A6tLXACNrA== X-Google-Smtp-Source: ABdhPJz5fkUdyC6I3ITtCnUF9yioNlVJohurqkOOttvOIHzsFSgiV696yiAtufwGdVlHGXJPR6FFyw== X-Received: by 2002:a9d:7657:: with SMTP id o23mr694391otl.255.1589925546087; Tue, 19 May 2020 14:59:06 -0700 (PDT) Received: from [192.168.86.21] ([136.62.4.88]) by smtp.gmail.com with ESMTPSA id k7sm235221otp.46.2020.05.19.14.59.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 19 May 2020 14:59:05 -0700 (PDT) Subject: Re: [PATCH v2 7/8] exec: Generic execfd support To: "Eric W. Biederman" , linux-kernel@vger.kernel.org Cc: Linus Torvalds , Oleg Nesterov , Jann Horn , Kees Cook , Greg Ungerer , Bernd Edlinger , linux-fsdevel@vger.kernel.org, Al Viro , Alexey Dobriyan , Andrew Morton , Casey Schaufler , linux-security-module@vger.kernel.org, James Morris , "Serge E. Hallyn" , Andy Lutomirski References: <87h7wujhmz.fsf@x220.int.ebiederm.org> <87sgga6ze4.fsf@x220.int.ebiederm.org> <87v9l4zyla.fsf_-_@x220.int.ebiederm.org> <877dx822er.fsf_-_@x220.int.ebiederm.org> <87y2poyd91.fsf_-_@x220.int.ebiederm.org> From: Rob Landley Message-ID: Date: Tue, 19 May 2020 16:59:06 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <87y2poyd91.fsf_-_@x220.int.ebiederm.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/18/20 7:33 PM, Eric W. Biederman wrote: > > Most of the support for passing the file descriptor of an executable > to an interpreter already lives in the generic code and in binfmt_elf. > Rework the fields in binfmt_elf that deal with executable file > descriptor passing to make executable file descriptor passing a first > class concept. I was reading this to try to figure out how to do execve(NULL, argv[], envp) to re-exec self after a vfork() in a chroot with no /proc, and hit the most trivial quibble ever: > --- a/fs/exec.c > +++ b/fs/exec.c > @@ -1323,7 +1323,10 @@ int begin_new_exec(struct linux_binprm * bprm) > */ > set_mm_exe_file(bprm->mm, bprm->file); > > + /* If the binary is not readable than enforce mm->dumpable=0 */ then Rob