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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DECD9CF6D28 for ; Wed, 2 Oct 2024 14:09:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 663656B02B1; Wed, 2 Oct 2024 10:09:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 613176B02B3; Wed, 2 Oct 2024 10:09:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 48DB86B02B2; Wed, 2 Oct 2024 10:09:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 1E4C76B02B0 for ; Wed, 2 Oct 2024 10:09:53 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 811181401D5 for ; Wed, 2 Oct 2024 14:09:52 +0000 (UTC) X-FDA: 82628845824.27.D1E00BA Received: from fhigh-a1-smtp.messagingengine.com (fhigh-a1-smtp.messagingengine.com [103.168.172.152]) by imf14.hostedemail.com (Postfix) with ESMTP id 2A64F10001E for ; Wed, 2 Oct 2024 14:09:48 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=tycho.pizza header.s=fm1 header.b=FZXvD6c8; dkim=pass header.d=messagingengine.com header.s=fm2 header.b="h VhpksM"; dmarc=none; spf=pass (imf14.hostedemail.com: domain of tycho@tycho.pizza designates 103.168.172.152 as permitted sender) smtp.mailfrom=tycho@tycho.pizza ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727878095; a=rsa-sha256; cv=none; b=5kj9caTnhb/xnUbQj71wc8h1xtT48R2id1uVe+uCs6HgVC9x97otV3caWHLfI7dtkKr1Tj Jkcz6hJ3456HhyU5sWH/1IHI5j2M+PtVIdqsJwFeaVq0n1SxKCYeohdchkQkbfuYcy+s7z 8kMMqIIwS+LUFwsM7AxkJ0HCgvVFNwo= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=tycho.pizza header.s=fm1 header.b=FZXvD6c8; dkim=pass header.d=messagingengine.com header.s=fm2 header.b="h VhpksM"; dmarc=none; spf=pass (imf14.hostedemail.com: domain of tycho@tycho.pizza designates 103.168.172.152 as permitted sender) smtp.mailfrom=tycho@tycho.pizza ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1727878095; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=D9f5mwetgYmnswxXDIMmoQPKc8ofGIpzwf7vHe4haFM=; b=Q8ASPFMy4J1Vtilx0lhCeufgp+LqeQ+EgKIdFMcqZVZVJIzx6aCMOtkaK0bM+9Yn+Ff6hB s5HvZYy86DScJTEvqwDkxxAiqdifmR4HK3gG8/6yuAURzWkOj4Myv8LYJoTTXErUCSj3J7 A26rI86fy6ZSkVStamVt3icD1LLPQJM= Received: from phl-compute-05.internal (phl-compute-05.phl.internal [10.202.2.45]) by mailfhigh.phl.internal (Postfix) with ESMTP id 2106A11401B1; Wed, 2 Oct 2024 10:09:48 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Wed, 02 Oct 2024 10:09:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tycho.pizza; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1727878188; x=1727964588; bh=D9f5mwetgYmnswxXDIMmoQPKc8ofGIpzwf7vHe4haFM=; b= FZXvD6c8gX9dl4ov59CcEc9JhfyiDf3XlQu9nsZe3/M0U3iGEJU0OiLUOKdIpLHT 2bm+KcYUFVnsBXlsoEP6qstmx4F8Dk7FKW6H4ylsUmgKQUIrAA9C+FDSR3EXCP5M vIbX7OvgaOSqMHllkREj/qfjMIb0btv4rS4YPpE0wCTL2qFDnxrxgc+Kze6CadeM JgiZLKeNVKQPm7Nn/lwKwsG2XXIed+zH719Q4smlPqhv69nMP4l/W/A/EqqoGMd0 WY3e9AraTaedvFfSFcu7wyukSKNRehKmI53NRcO11pZ/xuh13EGVOYeH67ZPqbj0 boELUedf84CFtYsL/tOsSw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1727878188; x= 1727964588; bh=D9f5mwetgYmnswxXDIMmoQPKc8ofGIpzwf7vHe4haFM=; b=h VhpksMZbTy3hg05gWDKTwOsgC8FIYIfg3LIRJNCuCWiqcda27qYgWdcyHLEiVDXW E/GsA2cH14E+xL8eH9RRixsc+Wbb9smIsxBtZYWCnna92pjharmvMY7udbAXo7db /QV0ZOTS4D5PHOcVf8A+YcABAvpoafR14DShE00cttOqTqf3yVgyvnl7z/8+Zadp zuIEtcII8s4tIINxcxPRpssMYuKp227RpuQQO28tFk63HjgmcwlYTfYA4Q8JQ53J AX3h6wFt2XXnCwqEbZnPM0PkBlX/0s/JDt5RogEmi7F+XerOrmkPoiIAC2bQLDYo UYrAwfqVZtDvCfdZoUJ9g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdduledgieelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepfffhvfevuffkfhggtggugfgjsehtkeertddttdej necuhfhrohhmpefvhigthhhoucetnhguvghrshgvnhcuoehthigthhhosehthigthhhord hpihiiiigrqeenucggtffrrghtthgvrhhnpeettddvheefffetkeejieehhfehieekgedv jeelieehkeefueevheehteegteevgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrh grmhepmhgrihhlfhhrohhmpehthigthhhosehthigthhhordhpihiiiigrpdhnsggprhgt phhtthhopeduvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepiigshihsiigvkh esihhnrdifrgifrdhplhdprhgtphhtthhopegthihphhgrrhestgihphhhrghrrdgtohhm pdhrtghpthhtohepvhhirhhoseiivghnihhvrdhlihhnuhigrdhorhhgrdhukhdprhgtph htthhopegsrhgruhhnvghrsehkvghrnhgvlhdrohhrghdprhgtphhtthhopehjrggtkhes shhushgvrdgtiidprhgtphhtthhopegvsghivgguvghrmhesgihmihhsshhiohhnrdgtoh hmpdhrtghpthhtohepkhgvvghssehkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhn uhigqdhfshguvghvvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplh hinhhugidqmhhmsehkvhgrtghkrdhorhhg X-ME-Proxy: Feedback-ID: i21f147d5:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 2 Oct 2024 10:09:45 -0400 (EDT) Date: Wed, 2 Oct 2024 08:09:42 -0600 From: Tycho Andersen To: Zbigniew =?utf-8?Q?J=C4=99drzejewski-Szmek?= Cc: Aleksa Sarai , Alexander Viro , Christian Brauner , Jan Kara , Eric Biederman , Kees Cook , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Tycho Andersen Subject: Re: [PATCH v3 1/2] exec: fix up /proc/pid/comm in the execveat(AT_EMPTY_PATH) case Message-ID: References: <20241001134945.798662-1-tycho@tycho.pizza> <20241001.175124-western.preview.meager.saws-pzvpWxOhfokt@cyphar.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Rspamd-Queue-Id: 2A64F10001E X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: sst8kxqcsh4kxu9rcdj9kzcwmn8p9d9k X-HE-Tag: 1727878188-465275 X-HE-Meta: U2FsdGVkX1/h0h4baQ90dBE921vz2kuIoQPvhQ9YcpKsbvx+wdtrJAUox8ocG1uwHXaBD9ps67lLWD9d0C8JXmkCd2c5KQB3x3QSv75X2db8gueCNNpAnFEp60/0o+onN2fSpgFZzE8VcGe8pTZNBFuIq76HV2JbHTnzAIbVrrwM1c1bt+j8+oZryIDJOrJz1nSnzpNiJHQwL/U6s2jQaTQdJp92DgeVJsCtMWIIOMUgYuBV1VHby7ox3liiuM/lzO9R8A9WDUdaYrPhktP+p547VFtgrqcJd2kmIYJ94L7VTDKsOjtCqKDNqIVy8Tpx59KnZPQhZ3hJ6pYhQwV34WIxHksH8QqjGy3EoMNoLSmLKTUkYB9GowBUWBgCRJJXvMxvt/4/+OWwW4a9k8GQTfWm//lrnQb5uC5Gm2RIQHFmdD2/sk6TgdJXEjjwdr3TdQJ0DFp1/eYBWM2BT9ZbUM+aA1Wmgp9AjR8GXRpXSy8xyKi9knL/Z0vCVexa+YvjnqvN1KCy8LC5gsnMgO2ZkmHMNsX+HjqQcx1rHpPK3QjzWHtkr66NJPsPqdX64f3j2p6OiOIgoe3lHG1Wk+lR6kW54SjDdVo4NpFzwaN/jpE2czYftirJ9Lefp9nBhNjN0DXVnc8FjqBszgxmwIyXFqKuYRGGs7Cioaqhz28WS54dNAhLsfWOrTn1zwRR0v8LYPeeojlxy9aM/y2RtMbgJHyPcPsYeowv/mrwoxHQ0X24q3C2n3I5SdKbIxbFcPsVp4CcHvGRtTgukbRENxkljQGaS2QWLiTT0B0xRfw7zITXYVeZ2nszvKVMYvHZFHeSPKfPrRY1I6BrEUZgbHt5aE85YJXWWfyIHievMbvl96o5nQIaJAQO+EtOBajW7rOV3kXptKfJ1LK+SclxSoWTK6ShBWNGjPPWvSyJv6NmBS+qdhvpnCGp6e6ADTO9yj89v4UjSIhbJWD1KmT+p0h Vshjhzia IRjoC+QiwiQeoxwH4oZ7WPQ9QMWv/Q5AMOyEKs5Nh5Jd7KahKx7mwbAvaDbCU3gnWJckw5nwvzPZ47bC7s9TqIWNTyRwMr7mJroHwIYI5oEH+btKUre/cHg/p69/fiyBpRMUlq5WVI8I5bKBP14t/U4odZXCp158SMi4yEiBRtsgcUNBtzIayhdl2QLqLIDKBOFLc8hCTlkCNZ4JVqJwgDoj6T/6zhSmljVFqz+mPzR7XEgRVgiilKd+Ihcbg6MBbtznZ4wnd3WrdZI1lhmFD3lgrpf2MAqGYI+0E8a1EOwOb2zkNPxD2RRxZmYlkysiVyO/IawoWJqhXyj0qtG1MW+Z9AyRqiQRJrbvFbWjGapskznVHsoQ6XPOCfLtyaohyo7hoLvVzrqBSiMM= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Wed, Oct 02, 2024 at 01:45:15PM +0000, Zbigniew Jędrzejewski-Szmek wrote: > On Tue, Oct 01, 2024 at 08:42:56PM +0200, Aleksa Sarai wrote: > > On 2024-10-01, Tycho Andersen wrote: > > > From: Tycho Andersen > > > > > > Zbigniew mentioned at Linux Plumber's that systemd is interested in > > > switching to execveat() for service execution, but can't, because the > > > contents of /proc/pid/comm are the file descriptor which was used, > > > instead of the path to the binary. This makes the output of tools like > > > top and ps useless, especially in a world where most fds are opened > > > CLOEXEC so the number is truly meaningless. > > > > > > Change exec path to fix up /proc/pid/comm in the case where we have > > > allocated one of these synthetic paths in bprm_init(). This way the actual > > > exec machinery is unchanged, but cosmetically the comm looks reasonable to > > > admins investigating things. > > > > While I still think the argv[0] solution was semantically nicer, it > > seems this is enough to fix the systemd problem for most cases and so we > > can revisit the argv[0] discussion in another 10 years. :D > ... > Unfortunately, I don't think that the approach with > f_path.dentry->d_name.name can be used :( hmm. Somehow earlier I had managed to convince myself that this gives the right answer for symlinks too (instead of the original kbasename(__d_path(file->f_path, root, buf, buflen)), but now upon retesting it doesn't. So I agree, seems like the argv[0] hack is needed unfortunately. Tycho