From: Hajime Tazaki <thehajime@gmail.com>
To: linux-um@lists.infradead.org, jdike@addtoit.com, richard@nod.at,
anton.ivanov@cambridgegreys.com, johannes@sipsolutions.net
Cc: thehajime@gmail.com, ricarkol@google.com,
Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
Eric Biederman <ebiederm@xmission.com>,
Kees Cook <kees@kernel.org>,
linux-fsdevel@vger.kernel.org, linux-mm@kvack.org
Subject: [RFC PATCH 01/13] fs: binfmt_elf_efpic: add architecture hook elf_arch_finalize_exec
Date: Thu, 24 Oct 2024 21:09:09 +0900 [thread overview]
Message-ID: <c327f6bfe8db1ceb5d45a8e0aeba4c46c6c8e064.1729770373.git.thehajime@gmail.com> (raw)
In-Reply-To: <cover.1729770373.git.thehajime@gmail.com>
FDPIC ELF loader adds an architecture hook at the end of loading
binaries to finalize the mapped memory before moving toward exec
function. The hook is used by UML under !MMU when translating
syscall/sysenter instructions before calling execve.
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Jan Kara <jack@suse.cz>
Cc: Eric Biederman <ebiederm@xmission.com>
Cc: Kees Cook <kees@kernel.org>
Cc: linux-fsdevel@vger.kernel.org
Cc: linux-mm@kvack.org
Signed-off-by: Hajime Tazaki <thehajime@gmail.com>
---
fs/binfmt_elf_fdpic.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index 4fe5bb9f1b1f..ab16fdf475b0 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -175,6 +175,12 @@ static int elf_fdpic_fetch_phdrs(struct elf_fdpic_params *params,
return 0;
}
+int __weak elf_arch_finalize_exec(struct elf_fdpic_params *exec_params,
+ struct elf_fdpic_params *interp_params)
+{
+ return 0;
+}
+
/*****************************************************************************/
/*
* load an fdpic binary into various bits of memory
@@ -457,6 +463,10 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm)
dynaddr);
#endif
+ retval = elf_arch_finalize_exec(&exec_params, &interp_params);
+ if (retval)
+ goto error;
+
finalize_exec(bprm);
/* everything is now ready... get the userspace context ready to roll */
entryaddr = interp_params.entry_addr ?: exec_params.entry_addr;
--
2.43.0
next parent reply other threads:[~2024-10-24 12:09 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1729770373.git.thehajime@gmail.com>
2024-10-24 12:09 ` Hajime Tazaki [this message]
2024-10-24 12:09 ` [RFC PATCH 02/13] x86/um: nommu: elf loader for fdpic Hajime Tazaki
2024-10-25 8:56 ` Johannes Berg
2024-10-25 12:54 ` Hajime Tazaki
[not found] ` <cover.1731290567.git.thehajime@gmail.com>
2024-11-11 6:27 ` [RFC PATCH v2 01/13] fs: binfmt_elf_efpic: add architecture hook elf_arch_finalize_exec Hajime Tazaki
2024-11-11 6:27 ` [RFC PATCH v2 02/13] x86/um: nommu: elf loader for fdpic Hajime Tazaki
2024-11-12 12:48 ` Geert Uytterhoeven
2024-11-12 22:07 ` Hajime Tazaki
2024-11-13 8:19 ` Geert Uytterhoeven
2024-11-13 8:36 ` Johannes Berg
2024-11-13 8:36 ` Johannes Berg
2024-11-13 10:27 ` Geert Uytterhoeven
2024-11-13 13:17 ` Hajime Tazaki
2024-11-13 13:55 ` Geert Uytterhoeven
2024-11-13 23:32 ` Hajime Tazaki
2024-11-14 1:40 ` Greg Ungerer
2024-11-14 10:41 ` Hajime Tazaki
2024-11-22 9:33 ` [RFC PATCH v2 00/13] nommu UML Lorenzo Stoakes
2024-11-22 9:53 ` Johannes Berg
2024-11-22 10:29 ` Lorenzo Stoakes
2024-11-22 12:18 ` Christoph Hellwig
2024-11-22 12:25 ` Lorenzo Stoakes
2024-11-22 12:38 ` Christoph Hellwig
2024-11-22 12:49 ` Damien Le Moal
2024-11-22 12:52 ` Lorenzo Stoakes
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=c327f6bfe8db1ceb5d45a8e0aeba4c46c6c8e064.1729770373.git.thehajime@gmail.com \
--to=thehajime@gmail.com \
--cc=anton.ivanov@cambridgegreys.com \
--cc=brauner@kernel.org \
--cc=ebiederm@xmission.com \
--cc=jack@suse.cz \
--cc=jdike@addtoit.com \
--cc=johannes@sipsolutions.net \
--cc=kees@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-um@lists.infradead.org \
--cc=ricarkol@google.com \
--cc=richard@nod.at \
--cc=viro@zeniv.linux.org.uk \
/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