Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp85914ybk; Tue, 12 May 2020 16:11:19 -0700 (PDT) X-Google-Smtp-Source: APiQypIZTfYMr5VrgkJfkpqiy86D59QCQzdwcfZjXqnXKFLFiOA1AhNNLKklALicB1PQ3griJ21B X-Received: by 2002:a17:906:1c94:: with SMTP id g20mr19294446ejh.319.1589325079473; Tue, 12 May 2020 16:11:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589325079; cv=none; d=google.com; s=arc-20160816; b=eTdlg1ejoAy0kfE8DkFQfxIMDANqFtRryIWNO8M4f7uepHPjc8EteCSwVqrN7oL2sN WQBVU2k2/RZRueP1uS7dZuubT2BaiNuZd5RtTjntQoDvtL8mogtfYb8aZG+DaZxQgeos Jy77nlJJQEKXB32hVPZlAyprxwiI13+KhtS9yk9BmUiG/DPB/805kXZEPiGt6FcM2BAY 2bsJqqH5JCicLFbZsMqG/fKf2juc6VHbfS9nQc8wLN0HhS7orY5cvYXVHxhLcz4Ky3wL dDNQfJ8Y336WU7/caUJIEX7Hy851PWoZC9NF7flpHzo0MHsA0TF4EX9pCYarGvApJjzw 5iOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=jPUDzmB2RaJE7QxC+Esx131H9VCB1o/rpPVErIJAzJU=; b=Mii/nsoF8ACE7vcRUOlOnqwgyOMXuUOcsuwgZx6W6h3RYfE2o34PnNlx4uTcuRuliQ HO/xigPBwpvf0oTD4TIuExxZkHV5+/toYcE/jiU+kKTud0vEgQRnjKFqaVI3Yb6MHRrr LY5ibb0FanbokHtUTHetznT16zfrFoOF+oqLO+0iqGqi+lJqMWcp0HYW77ISRPU+wXO1 UU7ms06FKAevpn9XcXoGgi0FYYwtazgKdnSCDBpdH87lJS6w4ROh9c/HLJvK7Dqr/RwK k3boq8Mw/FbWb78xNfwYpWfCJBLttgwZgBIPDqwUlgnlieX/b3/qCwKQkzSSt0PdggTj m5OA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=aJ1pbMal; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h10si7291840edn.261.2020.05.12.16.10.55; Tue, 12 May 2020 16:11:19 -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=@chromium.org header.s=google header.b=aJ1pbMal; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731569AbgELXJB (ORCPT + 99 others); Tue, 12 May 2020 19:09:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728220AbgELXJA (ORCPT ); Tue, 12 May 2020 19:09:00 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6BF0C061A0C for ; Tue, 12 May 2020 16:08:58 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id x15so6531770pfa.1 for ; Tue, 12 May 2020 16:08:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=jPUDzmB2RaJE7QxC+Esx131H9VCB1o/rpPVErIJAzJU=; b=aJ1pbMalItbAlYJJhzgzjRditf99BLgKT5bBvaX/wxrv2Egf5htQlaV8IS0drwDdL2 kKzuKpfK7N2zwzVJb4CmKxatoFDZeT8D5E/BZhkUyPgfD8q67s3KYVFgJJUt26w7AtXn Kxyyz6+IR2xq2F4UCtqDh0TEH1Cnvaq8Hgi4Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=jPUDzmB2RaJE7QxC+Esx131H9VCB1o/rpPVErIJAzJU=; b=O83VSiEarkpYDaRM6OxwK3r0aPDatPSyR6Dakl67rWD76d0/FuzyFlLQiPzDjrP8EP ra7mOSrIyKp7de/JKBWFJXFSoA0SU9YKY+UBcW3HKelP9nNaAzhkclHF1JKDo0QJDH3/ HDTzbT9zNdBU5Koq43Fu4HNJ7qv7pQs84KqgbfwlhbDAYuBqJ9YeAlw7Ledv8fMwXra6 rmQGOMak9V8tXID0J/OcSsPv6AP/mVZhEr6ZAHrOUdUbMIo9eKbQCnC8NhoISe8554xX 7qKi1I/tq0GFSy2/VPUMhTHjOOqK/pA0NR97MHftvAXC7TUK74o/S04oD5HWcrKZylvp XthA== X-Gm-Message-State: AGi0PuaB0jF/bhCMBVSnRikTnKyt6d3jHZRUJxvfWKhVY+bxwwZLbjZR FDSFG5LdDMPGN8OZyzXOpRLtSg== X-Received: by 2002:aa7:9ac9:: with SMTP id x9mr22349121pfp.304.1589324938284; Tue, 12 May 2020 16:08:58 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id s15sm1778377pgv.5.2020.05.12.16.08.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 May 2020 16:08:57 -0700 (PDT) Date: Tue, 12 May 2020 16:08:56 -0700 From: Kees Cook To: "Eric W. Biederman" Cc: Linus Torvalds , Tetsuo Handa , Linux Kernel Mailing List , Oleg Nesterov , Jann Horn , Greg Ungerer , Rob Landley , Bernd Edlinger , linux-fsdevel , Al Viro , Alexey Dobriyan , Andrew Morton , Casey Schaufler , LSM List , James Morris , "Serge E. Hallyn" , Andy Lutomirski Subject: Re: [PATCH 3/5] exec: Remove recursion from search_binary_handler Message-ID: <202005121606.5575978B@keescook> References: <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> <202005121218.ED0B728DA@keescook> <87lflwq4hu.fsf@x220.int.ebiederm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87lflwq4hu.fsf@x220.int.ebiederm.org> 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 03:31:57PM -0500, Eric W. Biederman wrote: > >> It is possible although unlikely for userspace to find the file > >> descriptor without consulting AT_EXECFD so just to be conservative I > >> think we should install the file descriptor in begin_new_exec even if > >> the next interpreter does not support AT_EXECFD. > > > > I think universally installing the fd needs to be a distinct patch -- > > it's going to have a lot of consequences, IMO. We can certainly deal > > with them, but I don't think it should be part of this clean-up series. > > I meant generically installing the fd not universally installing it. > > >> I am still working on how to handle recursive binfmts but I suspect it > >> is just a matter of having an array of struct files in struct > >> linux_binprm. > > > > If install is left if binfmt_misc, then the recursive problem goes away, > > yes? > > I don't think leaving the install in binfmt_misc is responsible at this > point. I'm nearly certain the answer is "yes", but I wonder if we should stop for a moment and ask "does anything still use MISC_FMT_OPEN_BINARY ? It looks like either "O" or "C" binfmt_misc registration flag. My installed binfmts on Ubuntu don't use them... I'm currently pulling a list of all the packages in Debian than depend on the binfmt-support package and checking their flags. -- Kees Cook