Skip to content

Commit

Permalink
s390: ensure that syscall arguments are properly masked on s390
Browse files Browse the repository at this point in the history
When executing s390 code on s390x the syscall arguments are not
properly masked, leading to some malformed audit records.

Signed-off-by: Paul Moore <paul@paul-moore.com>
  • Loading branch information
Paul Moore committed Jun 22, 2016
1 parent 66b12ab commit da7f750
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions arch/s390/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,7 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
{
long ret = 0;
unsigned long mask = -1UL;

/* Do the secure computing check first. */
if (secure_computing()) {
Expand Down Expand Up @@ -849,9 +850,12 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
trace_sys_enter(regs, regs->gprs[2]);

audit_syscall_entry(regs->gprs[2], regs->orig_gpr2,
regs->gprs[3], regs->gprs[4],
regs->gprs[5]);
if (is_compat_task())
mask = 0xffffffff;

audit_syscall_entry(regs->gprs[2], regs->orig_gpr2 & mask,
regs->gprs[3] & mask, regs->gprs[4] & mask,
regs->gprs[5] & mask);
out:
return ret ?: regs->gprs[2];
}
Expand Down

0 comments on commit da7f750

Please sign in to comment.