mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Guilherme G. Piccoli" <gpiccoli@igalia.com>
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
Subject: Re: [RFC PATCH 0/2] Introduce a way to expose the interpreted file with binfmt_misc
Date: Fri, 6 Oct 2023 09:51:32 +0200	[thread overview]
Message-ID: <31021a6a-4238-5fb0-45a9-2ea95d6b73e7@igalia.com> (raw)
In-Reply-To: <20230907204256.3700336-1-gpiccoli@igalia.com>

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

  parent reply	other threads:[~2023-10-06  7:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-07 20:24 Guilherme G. Piccoli
2023-09-07 20:24 ` [RFC PATCH 1/2] binfmt_misc, fork, proc: Introduce flag to expose the interpreted binary in procfs Guilherme G. Piccoli
2023-09-07 20:24 ` [RFC PATCH 2/2] fork, procfs: Introduce /proc/self/interpreter symlink Guilherme G. Piccoli
2023-10-06  7:51 ` Guilherme G. Piccoli [this message]
2023-10-06 12:07 ` [RFC PATCH 0/2] Introduce a way to expose the interpreted file with binfmt_misc David Hildenbrand
2023-10-09 17:37   ` Kees Cook
2023-10-11 23:53     ` Ryan Houdek
2023-11-13 17:33     ` Guilherme G. Piccoli
2023-11-13 18:29       ` Eric W. Biederman
2023-11-13 19:16         ` David Hildenbrand
2023-11-14 16:11           ` Eric W. Biederman
2023-11-14 16:14             ` David Hildenbrand
2023-11-13 19:17         ` Guilherme G. Piccoli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=31021a6a-4238-5fb0-45a9-2ea95d6b73e7@igalia.com \
    --to=gpiccoli@igalia.com \
    --cc=akpm@linux-foundation.org \
    --cc=brauner@kernel.org \
    --cc=dave@stgolabs.net \
    --cc=david@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=joshua@froggi.es \
    --cc=keescook@chromium.org \
    --cc=kernel-dev@igalia.com \
    --cc=kernel@gpiccoli.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mcgrof@kernel.org \
    --cc=oleg@redhat.com \
    --cc=sonicadvance1@gmail.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.org \
    --cc=yzaikin@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®