Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp780132ybk; Wed, 13 May 2020 12:55:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwTWTcG1gDEz+YSSAsz3ZcjMR3sjM4rgYy3p2SzWEJjcq/ltMiWiokXlOqfDQz9VWn9iBks X-Received: by 2002:a17:906:7ac8:: with SMTP id k8mr621539ejo.235.1589399710444; Wed, 13 May 2020 12:55:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589399710; cv=none; d=google.com; s=arc-20160816; b=IFDwP6C1ph6p1qjJsF1lrbr19Gw5Cg/gWtDGRaJxLzieZblJUZN7i4UvVofT7fFvWD ZohC2b+yuemRpdfnhPF/HdTY17eEHSDkDSpimUnjcHagfSGiMgRvTNDtUAurZe5mXhqm yXoIzOFMdeDMwbhodA4jzimOgH8gYvsjB08giJxwsv9qu8DgS3cewJhVSCKR9hd2TaqK 4VqqhcDYqtvM+Q2CyU0rQH5Ho1vIokypu+K4i8kfI5tnHPnGVsyOHFi3Dq+DdPU4av+T T/1amJFFzuJRzyNQXhP7QVY2LmsUjluOJEuPYpnvpOH6yzJ95Gb/m5gk/GVoBPTE/31e xa9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=imHJ5IQrcOcblMTfzv1B9XBBsSAMPE3kPxQA9myjXSo=; b=wo+QAb0t2mMRvyPBbqwzNH16QWzVvX/SSy3/dpTpN1WemeHbDJDP0BY/bWATZSKEfC kDLz+xK4YF0FvvnOgmXcDwIAVYbTM410pJ3sgINUjGI8vsnmCSDFl2NAmBiT3wKHLg+U sLDl1CXyjPw8qkCEwx3nIlAkOuA9jyBfuo/6OY1Mtnvvgh1Ud196CkR3rlG/+/zT8gQX 6jSJTo9UNyi1F4xGJewJIR9o7QMJp5HfLNCJ0JouCJh9JSKImbLBk/jP7cRLEtR7pA9t YBZw+X/LmAXKyPHWbECh77S+zrs6Dl+zhews9umFxyI4ZijC/vG6aWlA8UGs9bXoHDx4 Og7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=WQAwRDY0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q27si482995eja.131.2020.05.13.12.54.47; Wed, 13 May 2020 12:55:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=WQAwRDY0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403782AbgEMTwW (ORCPT + 99 others); Wed, 13 May 2020 15:52:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S2390158AbgEMTwW (ORCPT ); Wed, 13 May 2020 15:52:22 -0400 Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EBCBC061A0E for ; Wed, 13 May 2020 12:52:20 -0700 (PDT) Received: by mail-lj1-x241.google.com with SMTP id u6so942040ljl.6 for ; Wed, 13 May 2020 12:52:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=imHJ5IQrcOcblMTfzv1B9XBBsSAMPE3kPxQA9myjXSo=; b=WQAwRDY0UxVZ0mZJR9kVnssScJrq1sN4tD98t4V9W35y8XGCwm/KxMQqToQil5ltO9 GFUoMNp/kFEbFvuKrggepy5FbHzhYuRUmjv8amxmBrzK6q3yS0RJcPigPs+hBK67907L GVp+95DOu4oDEqAYtYvxlr8n8Tbt3B0dOxjF4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=imHJ5IQrcOcblMTfzv1B9XBBsSAMPE3kPxQA9myjXSo=; b=m+qctEpjk6pJKwbdsfcWwbHJxy2sq4+3Pil23bf1IXfFnimJyWdkTmLg5sFE2xUJgP 8dLOa/eKivM76dCmXSkL4Qol3AFgcf6lQboASGpA6FUK+5ArMQSY30M+1nwfMt1b6bFf FFxbVUM1I6SZnAQOVsSABhWrdA/eHA/zoTdtgkOUVz7W/9ZSJVMfFkmGaMh8VtJkzCf9 0phL+t3WFqYwIth9bdDJ6ylNXA1DaEWpQEpqIoTNuJgNo9qUT3QFWrtSMYq6qGjumqK7 VdIIVpNw7WJqRAL3z/fayFRvG7ugT+n3uq3lR0G5FCoTC2x2WVc/eC9uiSz2qbR07A0s Uifg== X-Gm-Message-State: AOAM530vqgCcaTRNUtPrBuaJ8rZqr20dOfarCe41+VYWU5djzVH2kD/c dYIuikMnA8KZdR1j6hR0PDf9sBlFshY= X-Received: by 2002:a2e:9f43:: with SMTP id v3mr386019ljk.285.1589399537533; Wed, 13 May 2020 12:52:17 -0700 (PDT) Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com. [209.85.167.48]) by smtp.gmail.com with ESMTPSA id q27sm326628lfn.58.2020.05.13.12.52.15 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 13 May 2020 12:52:16 -0700 (PDT) Received: by mail-lf1-f48.google.com with SMTP id z22so606911lfd.0 for ; Wed, 13 May 2020 12:52:15 -0700 (PDT) X-Received: by 2002:a19:6e4e:: with SMTP id q14mr699711lfk.192.1589399535404; Wed, 13 May 2020 12:52:15 -0700 (PDT) MIME-Version: 1.0 References: <87h7wujhmz.fsf@x220.int.ebiederm.org> <87sgga6ze4.fsf@x220.int.ebiederm.org> <87v9l4zyla.fsf_-_@x220.int.ebiederm.org> <87eerszyim.fsf_-_@x220.int.ebiederm.org> <87sgg6v8we.fsf@x220.int.ebiederm.org> <202005111428.B094E3B76A@keescook> <874kslq9jm.fsf@x220.int.ebiederm.org> <6f282d0a-b448-14e9-cd4f-92cce99cc36f@landley.net> In-Reply-To: <6f282d0a-b448-14e9-cd4f-92cce99cc36f@landley.net> From: Linus Torvalds Date: Wed, 13 May 2020 12:51:59 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 3/5] exec: Remove recursion from search_binary_handler To: Rob Landley Cc: "Eric W. Biederman" , Kees Cook , Tetsuo Handa , Linux Kernel Mailing List , Oleg Nesterov , Jann Horn , Greg Ungerer , Bernd Edlinger , linux-fsdevel , Al Viro , Alexey Dobriyan , Andrew Morton , Casey Schaufler , LSM List , James Morris , "Serge E. Hallyn" , Andy Lutomirski Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 12, 2020 at 7:32 PM Rob Landley wrote: > > On 5/12/20 7:20 PM, Linus Torvalds wrote: > > Ack. I think the AT_EXECFD thing is a sign that this isn't internal to > > binfmt_misc, but it also shouldn't be gating this issue. In reality, > > ELF is the only real binary format that matters - the script/misc > > binfmts are just indirection entries - and it supports AT_EXECFD, so > > let's just ignore the theoretical case of "maybe nobody exposes it". > > Would this potentially make the re-exec-yourself case easier to do at some > point? (Which nommu needs to do, and /proc/self/exe isn't always available.) AT_EXECFD may be an ELF thing, but normal ELF binaries don't do that "we have a fd". So it only triggers for binfmt_misc (and only when the flag is set for "I want the fd"). So no, this wouldn't help re-exec-yourself in general. Although I guess we could add an ELF section note that does that whole "executable fd" thing for other things too. Everything is possible in theory.. Linus