Skip to content

Commit a338630

Browse files
ruanjinjie-engwilldeacon
authored andcommitted
arm64/ptrace: Return early for ptrace_report_syscall_entry() error
The generic entry abort the syscall_trace_enter() sequence if ptrace_report_syscall_entry() errors out, but arm64 not. When ptrace requests interception, it should prevent all subsequent system-call processing, including audit and seccomp. In preparation for moving arm64 over to the generic entry code, return early if ptrace_report_syscall_entry() encounters an error. Reviewed-by: Kevin Brodsky <kevin.brodsky@arm.com> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com> Signed-off-by: Will Deacon <will@kernel.org>
1 parent 741a900 commit a338630

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

arch/arm64/kernel/ptrace.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2372,15 +2372,18 @@ static __always_inline unsigned long ptrace_save_reg(struct pt_regs *regs,
23722372
return saved_reg;
23732373
}
23742374

2375-
static void report_syscall_entry(struct pt_regs *regs)
2375+
static int report_syscall_entry(struct pt_regs *regs)
23762376
{
23772377
unsigned long saved_reg;
2378-
int regno;
2378+
int regno, ret;
23792379

23802380
saved_reg = ptrace_save_reg(regs, PTRACE_SYSCALL_ENTER, &regno);
2381-
if (ptrace_report_syscall_entry(regs))
2381+
ret = ptrace_report_syscall_entry(regs);
2382+
if (ret)
23822383
forget_syscall(regs);
23832384
regs->regs[regno] = saved_reg;
2385+
2386+
return ret;
23842387
}
23852388

23862389
static void report_syscall_exit(struct pt_regs *regs)
@@ -2407,10 +2410,11 @@ static void report_syscall_exit(struct pt_regs *regs)
24072410
int syscall_trace_enter(struct pt_regs *regs)
24082411
{
24092412
unsigned long flags = read_thread_flags();
2413+
int ret;
24102414

24112415
if (flags & (_TIF_SYSCALL_EMU | _TIF_SYSCALL_TRACE)) {
2412-
report_syscall_entry(regs);
2413-
if (flags & _TIF_SYSCALL_EMU)
2416+
ret = report_syscall_entry(regs);
2417+
if (ret || (flags & _TIF_SYSCALL_EMU))
24142418
return NO_SYSCALL;
24152419
}
24162420

0 commit comments

Comments
 (0)