Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp60739rdd; Mon, 8 Jan 2024 17:48:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IHdJ5eyotp9D8NUMUNiWGjCW6GorqXrXCMp14+PpHJn3wLaqb63fnn3G2auPcqhF9olE/Li X-Received: by 2002:a05:6214:5284:b0:681:a12:26b7 with SMTP id kj4-20020a056214528400b006810a1226b7mr14264qvb.52.1704764928091; Mon, 08 Jan 2024 17:48:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704764928; cv=none; d=google.com; s=arc-20160816; b=GK4npqEOl0gyITkFUY1QRiCKux1ylxDCEIg8hzpWsDphvqKZlXD9HIzKZtAYbJR5FL EdcHXKPmO3OCr1fFxhQ6VGA+L0BhpBdBDDpkz7nFMScDzrwd7Ek61AGvYCQ50RsUaPhG KcbkJ19CGb3kZjc9/8782IgpyQJl5NaXNbYA0ukWSQsZI9B2ZPBYgM5IXkC6UHMIe0rX KU8LwdtaYfL8OkN/JzBKlnZxi0YE0a8wmeuAeq6K14PCLo7doF1MF+bn+aBaQUvFYCuQ AVm4U88HJ4BoKX0TfUbQ3iD3hv18PtwsZ2VDu7HGuySGKygXb0Y2uJ6foIFXdTbpPZaP n0aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:references:in-reply-to :user-agent:subject:cc:to:from:date:dkim-signature; bh=JBqS6xsLFXTIyivyoLDuFsRaF1MFi5K5NOMb6XLOQ8g=; fh=FLj60KI7I1Q2rq1Orq2pNp+Raxc+pIXe+bpvBwtI4wc=; b=OAhcR/ATIdZrUfAy5JuYKC/xUcK0vxhhbTnJ8xH8o+MoQGmw3p1AFtBk06DSpMSmqO Qwi95W1lRpZdfe2xe8I9TnQC2hDeECzH8+Vzw3eXUdgiI0MbiCKo3bXtPK+5KQ6Y5w3R 5pfgpIjcDapW7L2PruyXxZ6W+UzeYgTKUaccxrHxCVljsL11YKFemK5EfVMaSU3WvpEC VX3uMAjIhee9RSYBGpGCOaeM+3nI3hEiivMqB3pUH6t1v0LiYplH1sAdBfHXituUJguQ OXDxdRDrHb/EA6/lf34rekiqU/EIwN0I3sZmmPckJ5nd77cBsSNScxCNipmu5DfDsE5x fyMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CF4UUbZy; spf=pass (google.com: domain of linux-kernel+bounces-20265-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20265-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id k4-20020a0cabc4000000b0067f028c008asi1260572qvb.44.2024.01.08.17.48.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 17:48:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-20265-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CF4UUbZy; spf=pass (google.com: domain of linux-kernel+bounces-20265-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20265-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id CD4201C23217 for ; Tue, 9 Jan 2024 01:48:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 160C7187E; Tue, 9 Jan 2024 01:48:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CF4UUbZy" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4AC8015AE for ; Tue, 9 Jan 2024 01:48:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82B8BC433C7; Tue, 9 Jan 2024 01:48:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704764921; bh=P5RIbyvI2gqq2hXY1u6dStIhTRuSZ7BantuUnOE43+o=; h=Date:From:To:CC:Subject:In-Reply-To:References:From; b=CF4UUbZyHUL/OylxsRyS2Tl17qnc/nUZSS8ZveLtTBd+ATaz9nQ2O+abweryv4JGv I4n/p4CXyKWPoHUw8r39IuEetv3BtHAOyb7kIiMw+Uqx1Xlgej3EjJ7/8OVywVDqzG iVu0IWQGVMqDi29L3ez79Y1zFgot65gMHITzkt+tW9kyreZScWJDdU2tDbLsHf5vXv dH6uYCs3ZVn+wn7vmOIPv5uBMVC8iVd+3M7t2T5JJZzD682M/kRA+6oRnc2W716yer ewU793/PDv1+Oh5f8n9YA2aQcmkypxI0wwxTFebED5osZR4Kc5U+yxMCCfSsciy+BP nloi/7AT2N/0g== Date: Mon, 08 Jan 2024 17:48:38 -0800 From: Kees Cook To: Linus Torvalds , Kees Cook CC: linux-kernel@vger.kernel.org, Alexey Dobriyan , Josh Triplett Subject: Re: [GIT PULL] execve updates for v6.8-rc1 User-Agent: K-9 Mail for Android In-Reply-To: References: <202401081028.0E908F9E0A@keescook> Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On January 8, 2024 4:19:45 PM PST, Linus Torvalds wrote: >On Mon, 8 Jan 2024 at 10:35, Kees Cook wrote: >> >> Josh Triplett (1): >> fs/exec=2Ec: Add fast path for ENOENT on PATH search before alloc= ating mm > >No, we're not doing this=2E > >If you want to open the file before the allocations, then dammit, do >exactly that=2E This was exactly the feedback I had originally and wrote almost what you s= uggest: https://lore=2Ekernel=2Eorg/lkml/202209161637=2E9EDAF6B18@keescook/ >Anyway, I want to repeat: this patch is UNTESTED=2E It compiles for me=2E >But that is literally all the testing it has gotten apart from a >cursory "this patch looks sane"=2E > >There might be something seriously wrong with this patch, but it at >least makes sense, unlike that horror that will look up the filename >twice=2E > >I bet whatever benchmark did the original was not using long filenames >with lots of components, or was only testing the ENOENT case=2E But the perf testing of my proposed "look it up once" patch showed a net l= oss to the successful execs which no one could explain=2E In the end we wen= t with the original proposal=2E If you think this is too much of a hack, I'm happy to drop it=2E My very f= irst reaction was "fix userspace; shells use access() not execve()" but it = seems enough other runtimes (Python?) use execve PATH searches that it woul= d make a measurable real-world difference=2E -Kees --=20 Kees Cook