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 2BA7BE92FF7 for ; Fri, 6 Oct 2023 07:51:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6ED19940016; Fri, 6 Oct 2023 03:51:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 69E2394000B; Fri, 6 Oct 2023 03:51:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 58C04940016; Fri, 6 Oct 2023 03:51:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 4815794000B for ; Fri, 6 Oct 2023 03:51:47 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 15A13A038C for ; Fri, 6 Oct 2023 07:51:47 +0000 (UTC) X-FDA: 81314267454.05.D4E6B87 Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) by imf16.hostedemail.com (Postfix) with ESMTP id 88546180015 for ; Fri, 6 Oct 2023 07:51:42 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=igalia.com header.s=20170329 header.b=kNuCrFaW; spf=pass (imf16.hostedemail.com: domain of gpiccoli@igalia.com designates 178.60.130.6 as permitted sender) smtp.mailfrom=gpiccoli@igalia.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1696578704; 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=iuK03HmNqgCaa8FhOu7IDj+wgutL2t54fgRlwMCc6iw=; b=ZEEu5/Dwxg4PbKUQ+VgS3SpxKh+TzILhDyq9QtecBdvuHbSQQMJ2Lgoq2cNqZldIoXYGZf gXqOQ8gLjjPjDLKA3k4MbcxPDorDxJX+EziCb8irJlhBwZ5jc9MRbct/tn1pN04vdwv/il TYfcMbIRhDoatot/odGMOtb6rFACTxk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1696578704; a=rsa-sha256; cv=none; b=eQ5mHLF962/3JOXIGOeeU8upVevfTj7h4e1zeYXPb0udTyBsI315AhtkfAltrAUAOPE8zm xtEUDGeJh2B1h2vOSijmte217wWeUOjamHUFJmhD+P3lJrTW5w1dFd4NDxYPOHcdfBvctp eN7EFUMKnIKUYCAjT3hKsCbN78vix1o= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=igalia.com header.s=20170329 header.b=kNuCrFaW; spf=pass (imf16.hostedemail.com: domain of gpiccoli@igalia.com designates 178.60.130.6 as permitted sender) smtp.mailfrom=gpiccoli@igalia.com; dmarc=none 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=iuK03HmNqgCaa8FhOu7IDj+wgutL2t54fgRlwMCc6iw=; b=kNuCrFaW39RlsEpKJf9vOpPzHH zG02syRAUaeEW3/ocBPYR5/3Azpku/r4b9FBl+74anGSuXuNQ6AoLh4GMMZ2fvw0yun0XQvMwNe7J abBUjM8Y8SqAsG+/wp5xZx3VomD6AWyfmfoiNHZNpUfUQdlaSpGcfiNvlK+K4GPR08q2XbxsgV88u xH6OLHi34c0g7LmuTmvQ1I5TAL9rvKbJzaQgQ5nJt7d/m7ePqokcqfk8y9L7WP4gHwh/S9hz2oTBP jYjqDD7KgSnBw7BftXI1jZcwGXIrPqG3xbCAU4RXwDi6x8LWigcrWPqO/Dt5MmW3Ui4OsfYMfCRas OXgWUSuA==; Received: from cpe90-146-105-192.liwest.at ([90.146.105.192] helo=[192.168.178.99]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_128_GCM:128) (Exim) id 1qofcU-00CTMq-7L; Fri, 06 Oct 2023 09:51:34 +0200 Message-ID: <31021a6a-4238-5fb0-45a9-2ea95d6b73e7@igalia.com> Date: Fri, 6 Oct 2023 09:51:32 +0200 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 Content-Language: en-US To: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: linux-mm@kvack.org, kernel-dev@igalia.com, kernel@gpiccoli.net, keescook@chromium.org, 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, david@redhat.com, dave@stgolabs.net, sonicadvance1@gmail.com, joshua@froggi.es References: <20230907204256.3700336-1-gpiccoli@igalia.com> From: "Guilherme G. Piccoli" In-Reply-To: <20230907204256.3700336-1-gpiccoli@igalia.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 88546180015 X-Rspam-User: X-Stat-Signature: p4afzdzfd3byg9b15xprcteqkpz8jw6g X-Rspamd-Server: rspam03 X-HE-Tag: 1696578702-555276 X-HE-Meta: U2FsdGVkX1/jM2zm2fFrZ1lcnYxL6XdC5GXSj3o+k4avu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9UmqItCWdcx0sLWUTwA9WbM1XKP4fLeD2BXvk8aiJjDZTsFUuaUyRvHBqyL5UyAX7IWLL+XpX4OTj58HQ3vRIyNrxhshRxdUdZL7u7FdpF2UcAvASQQUQC5nayfAkYXkJNR9BQmJFa4N2iqjByB2k8tJ42S3VM32v5ul6K2HJ08Fwj83fIYCCeoTwwwVkRbtsUmGGq5vMicPlsQfYpuFP1OW5JvrZyg6c7fl0TN4kN8tvCQwmKwvqVk9oL2wjEDsu2AKpZOEqrqFlcGg3NHcFL60MNhu1EhjF/aU6gWzaFdN9oaxSXefo4wDuDA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000022, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 07/09/2023 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. > > We hereby propose a way to expose such interpreted binary as exe_file if > the flag 'I' is selected on binfmt_misc. When that flag is set, the file > /proc/self/exe_file points to the *interpreted* file, be it ELF or not. > In order to allow users to distinguish if such flag is used or not without > checking the binfmt_misc filesystem, we propose also the /proc/self/interpreter > file, which always points to the *interpreter* in scenarios where > interpretation is set, like binfmt_misc. This file is empty / points to > nothing in the case of regular ELF execution, though we could consider > implementing a way to point to the LD preloader if that makes sense... > > This was sent as RFC because of course it's a very core change, affecting > multiple areas and there are design choices (and questions) in each patch > so we could discuss and check the best way to implement the solution as > well as the corner cases handling. This is a very useful feature for > emulators and such, like FEX and Wine, which usually need to circumvent > this kernel limitation in order to expose the true emulated file name > (more examples at [1][2][3]). > > This patchset is based on the currently v6.6-rc1 candidate (Linus tree > from yesterday) and was tested under QEMU as well as using FEX. > Thanks in advance for comments, any feedback is greatly appreciated! > Cheers, > > Guilherme > > > [0] https://github.com/FEX-Emu/FEX > > [1] Using an environment variable trick to override exe_file: > https://gitlab.freedesktop.org/mesa/mesa/-/blob/main/src/util/u_process.c#L209 > > [2] https://github.com/baldurk/renderdoc/pull/2694 > > [3] FEX handling of the exe_file parsing: > https://github.com/FEX-Emu/FEX/blob/main/Source/Tools/FEXLoader/LinuxSyscalls/FileManagement.cpp#L499 > > Hi folks, gentle monthly ping. Any opinions / suggestions on that? Thanks in advance, Guilherme