linux-stable/arch/loongarch
Hengqi Chen c3597996a3 LoongArch: Preserve syscall nr across execve()
[ Upstream commit d6c5f06e46 ]

Currently, we store syscall nr in pt_regs::regs[11] and syscall execve()
accidentally overrides it during its execution:

    sys_execve()
      -> do_execve()
        -> do_execveat_common()
          -> bprm_execve()
            -> exec_binprm()
              -> search_binary_handler()
                -> load_elf_binary()
                  -> ELF_PLAT_INIT()

ELF_PLAT_INIT() reset regs[11] to 0, so in syscall_exit_to_user_mode()
we later get a wrong syscall nr. This breaks tools like execsnoop since
it relies on execve() tracepoints.

Skip pt_regs::regs[11] reset in ELF_PLAT_INIT() to fix the issue.

Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-01-20 11:50:06 +01:00
..
boot loongarch: efi: enable generic EFI compressed boot 2022-09-20 09:50:31 +02:00
configs LoongArch: Update Loongson-3 default config file 2022-10-12 16:36:23 +08:00
include LoongArch: Preserve syscall nr across execve() 2024-01-20 11:50:06 +01:00
kernel LoongArch: Implement constant timer shutdown interface 2023-12-20 17:00:23 +01:00
lib LoongArch: Improve dump_tlb() output messages 2022-09-03 18:01:27 +08:00
mm LoongArch: Replace kmap_atomic() with kmap_local_page() in copy_user_highpage() 2023-11-08 14:11:01 +01:00
net LoongArch: BPF: Don't sign extend function return value 2023-12-13 18:39:23 +01:00
pci LoongArch: Use TLB for ioremap() 2022-10-12 16:36:14 +08:00
vdso LoongArch: Fix build warnings in VDSO 2022-08-25 19:34:59 +08:00
Kbuild LoongArch: Add BPF JIT support 2022-10-12 16:36:20 +08:00
Kconfig Revert "loongarch/cpu: Switch to arch_cpu_finalize_init()" 2023-08-16 18:27:20 +02:00
Kconfig.debug LoongArch: Add prologue unwinder support 2022-08-12 13:10:11 +08:00
Makefile LoongArch: Add dependency between vmlinuz.efi and vmlinux.efi 2023-12-20 17:00:23 +01:00