acrn-kernel/arch/loongarch
Hengqi Chen c3597996a3 LoongArch: Preserve syscall nr across execve()
[ Upstream commit d6c5f06e46a836e6a70c7cfd95bb38a67d9252ec ]

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
configs
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
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
vdso
Kbuild
Kconfig Revert "loongarch/cpu: Switch to arch_cpu_finalize_init()" 2023-08-16 18:27:20 +02:00
Kconfig.debug
Makefile LoongArch: Add dependency between vmlinuz.efi and vmlinux.efi 2023-12-20 17:00:23 +01:00