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 7C755C4332F for ; Mon, 13 Nov 2023 17:33:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E363B6B0200; Mon, 13 Nov 2023 12:33:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DE6366B0202; Mon, 13 Nov 2023 12:33:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CD5506B0203; Mon, 13 Nov 2023 12:33:42 -0500 (EST) 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 BF59E6B0200 for ; Mon, 13 Nov 2023 12:33:42 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 88EF21A0877 for ; Mon, 13 Nov 2023 17:33:42 +0000 (UTC) X-FDA: 81453628284.25.5DC5808 Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) by imf15.hostedemail.com (Postfix) with ESMTP id EA42AA0024 for ; Mon, 13 Nov 2023 17:33:38 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=igalia.com header.s=20170329 header.b=FYzTBB+c; dmarc=none; spf=pass (imf15.hostedemail.com: domain of gpiccoli@igalia.com designates 178.60.130.6 as permitted sender) smtp.mailfrom=gpiccoli@igalia.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1699896820; 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=Oszu5XvrVNjHHpeK4r7h72jVIlFgy+VOxbgYat+iRyE=; b=ryCgkIMYK8kWhk9QAQp0FhLdcwyJ8b8vC5aOWg0Rm/0aljYYngK3bVi4lhZcjRHethG1Xc yRtyTFL7gLZCTPfME54YEKdTpC/KBwUZkC5nKTT/bK4fLWqamfQwvcINNYkn6ufSfFArza H6Yfikl7JWmC/VkRnOOJGE5x7NFrtnQ= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=igalia.com header.s=20170329 header.b=FYzTBB+c; dmarc=none; spf=pass (imf15.hostedemail.com: domain of gpiccoli@igalia.com designates 178.60.130.6 as permitted sender) smtp.mailfrom=gpiccoli@igalia.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1699896820; a=rsa-sha256; cv=none; b=mwfet2M2Wid87wYHrweDyUvcZlkYDDMq2RpFlyT3snc8mS8ZYkHrmFud+P8Oxqu0/mSJOn X/Lcuxirone6Hq1Sfpos1fqzg6l8qC739S4ccRDlFVD/WrpZG3nsGcSCFd6Ds+aKwBIrll 3ABiKpajI8sBPdYwmyS4bbyskrJ5ErE= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Oszu5XvrVNjHHpeK4r7h72jVIlFgy+VOxbgYat+iRyE=; b=FYzTBB+cC+G7OVtfs0tkFHV+y1 HKEc7qQeBcuzChdD76UPhjieh/h2iFH8z68QD2xTtYf4gLOlJJh6UO8srGtujduhUiYwTWytQuAP1 pIlzaZ/Jg7cLi+VzruoZoc2K4YC61d+AemRwb8GfoJaFWgN/9GDepi5EqyyorbZdw2/JMHefanrLW hLOEhTYSqFeRMoC7gFS0qC9SEFwXK7LUeOAVoTQOv+hQ5TN3x+lZagRiKUJOKhk7bSgjqLdECJe1i kLM2TsYYwST0WUrlNFMhCorQHSoBa9jYgvx5b9qvwzf3HyFWl/v3WvZlQN5g7HZ8KADUufDJXQyBX Ebq7DVKQ==; Received: from 189-68-155-43.dsl.telesp.net.br ([189.68.155.43] helo=[192.168.1.60]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_128_GCM:128) (Exim) id 1r2aoK-002oJt-CX; Mon, 13 Nov 2023 18:33:20 +0100 Message-ID: <8dc5069f-5642-cc5b-60e0-0ed3789c780b@igalia.com> Date: Mon, 13 Nov 2023 14:33:13 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: [RFC PATCH 0/2] Introduce a way to expose the interpreted file with binfmt_misc To: Kees Cook , David Hildenbrand , sonicadvance1@gmail.com Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, kernel-dev@igalia.com, kernel@gpiccoli.net, ebiederm@xmission.com, oleg@redhat.com, yzaikin@google.com, mcgrof@kernel.org, akpm@linux-foundation.org, brauner@kernel.org, viro@zeniv.linux.org.uk, willy@infradead.org, dave@stgolabs.net, joshua@froggi.es References: <20230907204256.3700336-1-gpiccoli@igalia.com> <202310091034.4F58841@keescook> Content-Language: en-US From: "Guilherme G. Piccoli" In-Reply-To: <202310091034.4F58841@keescook> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: EA42AA0024 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: abf6mx4j3pw4khkik59ijn6ok48zs8kw X-HE-Tag: 1699896818-718583 X-HE-Meta: U2FsdGVkX19Dkj9kjdS5mxtmUMdFovbE8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wPyBsD4jqbFANm2IBf5ekqFEAWOME1DtwvvgHMUrAVZBxRNIsOdR7lHPm4gHv/nV1/MTDs/X//ZOWmnIR6MBjIngO2Kr6FdP449UdXKtSONQALBKKeYw6ezUUJ6L84i7rvJ+vMhp7UNZNFFhfu3m7Rfetvuw0w8gtDcag3U6AIGWyex/WPboYfwx7Dg0P8QnCamgMmtL/OkgfkkvEMuBlAjX5ElIb09kEWG2Do3rSv1cNVzXkCqXrTkjQDL X-Bogosity: Ham, tests=bogofilter, spamicity=0.004038, 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 09/10/2023 14:37, Kees Cook wrote: > On Fri, Oct 06, 2023 at 02:07:16PM +0200, David Hildenbrand wrote: >> On 07.09.23 22:24, Guilherme G. Piccoli wrote: >>> Currently the kernel provides a symlink to the executable binary, in the >>> form of procfs file exe_file (/proc/self/exe_file for example). But what >>> happens in interpreted scenarios (like binfmt_misc) is that such link >>> always points to the *interpreter*. For cases of Linux binary emulators, >>> like FEX [0] for example, it's then necessary to somehow mask that and >>> emulate the true binary path. >> >> I'm absolutely no expert on that, but I'm wondering if, instead of modifying >> exe_file and adding an interpreter file, you'd want to leave exe_file alone >> and instead provide an easier way to obtain the interpreted file. >> >> Can you maybe describe why modifying exe_file is desired (about which >> consumers are we worrying? ) and what exactly FEX does to handle that (how >> does it mask that?). >> >> So a bit more background on the challenges without this change would be >> appreciated. > > Yeah, it sounds like you're dealing with a process that examines > /proc/self/exe_file for itself only to find the binfmt_misc interpreter > when it was run via binfmt_misc? > > What actually breaks? Or rather, why does the process to examine > exe_file? I'm just trying to see if there are other solutions here that > would avoid creating an ambiguous interface... > Thanks Kees and David! Did Ryan's thorough comment addressed your questions? Do you have any take on the TODOs? I can maybe rebase against 6.7-rc1 and resubmit , if that makes sense! But would be better having the TODOs addressed, I guess. Thanks in advance for reviews and feedback on this. Cheers, Guilherme