The patch titled Subject: elf: init pt_regs pointer later has been added to the -mm tree. Its filename is elf-init-pt_regs-pointer-later.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/elf-init-pt_regs-pointer-later.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/elf-init-pt_regs-pointer-later.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Alexey Dobriyan <adobriyan@xxxxxxxxx> Subject: elf: init pt_regs pointer later Get "current_pt_regs" pointer right before usage. Space savings on x86_64: add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-180 (-180) Function old new delta load_elf_binary 5806 5626 -180 !!! Link: http://lkml.kernel.org/r/20190419200343.GA19788@avx2 Signed-off-by: Alexey Dobriyan <adobriyan@xxxxxxxxx> Tested-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/binfmt_elf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/binfmt_elf.c~elf-init-pt_regs-pointer-later +++ a/fs/binfmt_elf.c @@ -704,12 +704,12 @@ static int load_elf_binary(struct linux_ unsigned long start_code, end_code, start_data, end_data; unsigned long reloc_func_desc __maybe_unused = 0; int executable_stack = EXSTACK_DEFAULT; - struct pt_regs *regs = current_pt_regs(); struct { struct elfhdr elf_ex; struct elfhdr interp_elf_ex; } *loc; struct arch_elf_state arch_state = INIT_ARCH_ELF_STATE; + struct pt_regs *regs; loc = kmalloc(sizeof(*loc), GFP_KERNEL); if (!loc) { @@ -1150,6 +1150,7 @@ out_free_interp: MAP_FIXED | MAP_PRIVATE, 0); } + regs = current_pt_regs(); #ifdef ELF_PLAT_INIT /* * The ABI may specify that certain registers be set up in special _ Patches currently in -mm which might be from adobriyan@xxxxxxxxx are ramfs-support-o_tmpfile.patch elf-make-scope-of-pos-variable-smaller.patch elf-free-pt_interp-filename-asap.patch elf-delete-trailing-return-in-functions-returning-void.patch elf-save-1-indent-level.patch elf-move-variables-initialization-closer-to-their-usage.patch elf-extract-prot_-calculations.patch elf-init-pt_regs-pointer-later.patch exec-move-recursion_depth-out-of-critical-sections.patch