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=-1.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 C1E0CC433E1 for ; Wed, 13 May 2020 19:52:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 67F4D205ED for ; Wed, 13 May 2020 19:52:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589399542; bh=yChfl6bW7pHHSbBVahran9Uag3HId9/L3hOJcUfAW9o=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-ID:From; b=SyFuC5LPJxK+oAS9kj8+0t4NR/GwHiTlF5gWvccqENsylwjimB/1BGLOnHP2UN6nm dt/hACJFTze4m2MJbAR/ckJL6BrmWRiy0ZskfdN+Sp934cnVcCT+anqR6AqzLKEais SmXkJV6vy6QvU9dHI5s/540kmNVlBjIqBuNbqlJc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390750AbgEMTwV (ORCPT ); Wed, 13 May 2020 15:52:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S2390158AbgEMTwU (ORCPT ); Wed, 13 May 2020 15:52:20 -0400 Received: from mail-lf1-x141.google.com (mail-lf1-x141.google.com [IPv6:2a00:1450:4864:20::141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3F42C061A0C for ; Wed, 13 May 2020 12:52:19 -0700 (PDT) Received: by mail-lf1-x141.google.com with SMTP id d22so543062lfm.11 for ; Wed, 13 May 2020 12:52:19 -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=fB+3Zi58ROKu9hpDlaARKp1RO6UKaRycOFB4DfaxuF7HQ5iINX7QyeczhEb1aGRq2F MY6pmo9VVJBMHKtLcBPHKJ+Uj95pPTquReiWmNZvn59SOmyFhwG71m9ZfjvvX3txIOJv 2EyfKmKq1MeKWCqt46hHRkFaNv6VcImWv0h7uBCdOtpf60w3ASLLUjDRjc6gtnLxHhjX HPbSzFjEt4rMa5l01paXGcQge46toMiHUWk2a9kVWuSbumMR5fLOdOdm3qWz7ZaSZJK7 ywCeAIbrVqacGCU6Vs8hCWvWQmuy8p/Axsa20am8ejVnzaTZ4Z3PHmDp0Gee61jlMMiB QauQ== X-Gm-Message-State: AOAM530SdX30EeCoypCJZqvMF5aKJMnd0Fbjl1YAu3lyQpWL6jPIa8U1 KzOC3XqZ5rcZOuxqF/AGsd20h3+YYec= X-Google-Smtp-Source: ABdhPJzkOTVTBxtZQ0MNreKoAGiS8MaJrQjnXPfERoja+w8UlyjpqTXOQ0Ic08I5Y/CDtWlQf/26Cg== X-Received: by 2002:a19:3f51:: with SMTP id m78mr718549lfa.182.1589399537307; 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 h12sm244285lji.25.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 a4so530674lfh.12 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-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@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