From 58e2fa4ec4b1e15b7c7510bc98befafa31c03f70 Mon Sep 17 00:00:00 2001 From: Kalesh Singh Date: Thu, 8 Feb 2024 21:56:31 -0800 Subject: [PATCH] ANDROID: 16K: Remove build time dependencies on ELF_EXEC_PAGESIZE Since page-compat mode needs to be runtime switchable, non-const globals need to be initialized from a function. Intialize elf_format.min_coredump from init_elf_binfmt() Remove preprocessor checks on ELF_EXEC_PAGESIZE. ELF_EXEC_PAGESIZE is always the same as PAGE_SIZE on Android supported architectures. This is a preparatory change for subsequent patches in the series. Bug: 383389337 Bug: 315325080 Bug: 302403436 Change-Id: I7d748ae1897384720272284493befff2aa4d2325 Signed-off-by: Kalesh Singh --- fs/binfmt_elf.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 0a216a078c31..b9014ab1f8ca 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -84,11 +84,7 @@ static int elf_core_dump(struct coredump_params *cprm); #define elf_core_dump NULL #endif -#if ELF_EXEC_PAGESIZE > PAGE_SIZE #define ELF_MIN_ALIGN ELF_EXEC_PAGESIZE -#else -#define ELF_MIN_ALIGN PAGE_SIZE -#endif #ifndef ELF_CORE_EFLAGS #define ELF_CORE_EFLAGS 0 @@ -104,7 +100,8 @@ static struct linux_binfmt elf_format = { .load_shlib = load_elf_library, #ifdef CONFIG_COREDUMP .core_dump = elf_core_dump, - .min_coredump = ELF_EXEC_PAGESIZE, + /* init_elf_binfmt() overrides .min_coredump with the correct emulated page-size. */ + .min_coredump = PAGE_SIZE, #endif }; @@ -2143,6 +2140,7 @@ end_coredump: static int __init init_elf_binfmt(void) { + elf_format.min_coredump = ELF_EXEC_PAGESIZE; register_binfmt(&elf_format); return 0; }