From: Dmitry V. Levin Date: Wed, 13 Jan 2016 20:53:41 +0000 (+0000) Subject: s390, s390x: fix printing of syscalls unknown to the kernel X-Git-Tag: v4.12~640 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1763fa5f62d6db333383beb244aa4599d22b96b1;p=strace s390, s390x: fix printing of syscalls unknown to the kernel On s390/s390x, syscalls with NR up to 255 can be implemented directly using "svc NR", for NR >= 256 "svc 0" with %r1=NR is used. The latter method is allowed for NR < 256, too. When the syscall number specified directly or indirectly is recognized by the kernel, i.e. it is less than its NR_syscalls value, it is stored in %r2 and is available to arch_get_scno via s390_regset.gprs[2]. For syscall numbers >= NR_syscalls this register is set to 0, but %r1 remains unchanged and could be used by arch_get_scno via s390_regset.gprs[1] to decide what the syscall number is. * linux/s390/get_scno.c (arch_get_scno): If s390_regset.gprs[2] is zero, take syscall number from s390_regset.gprs[1]. * NEWS: Mention this fix. This fixes Debian bug #485979 and Fedora bug #1298294. --- diff --git a/NEWS b/NEWS index f2ec0223..33fb3b08 100644 --- a/NEWS +++ b/NEWS @@ -11,6 +11,8 @@ Noteworthy changes in release ?.?? (????-??-??) * Fixed build on arc, metag, nios2, or1k, and tile architectures. * Fixed decoding of 32-bit times syscall return value on 64-bit architectures. * Fixed decoding of mlock2 syscall on sparc. + * Fixed decoding of syscalls unknown to the kernel on s390/s390x. + (addresses Debian bug #485979 and Fedora bug #1298294). Noteworthy changes in release 4.11 (2015-12-21) =============================================== diff --git a/linux/s390/get_scno.c b/linux/s390/get_scno.c index 8650e1f1..d323860d 100644 --- a/linux/s390/get_scno.c +++ b/linux/s390/get_scno.c @@ -2,6 +2,7 @@ static int arch_get_scno(struct tcb *tcp) { - tcp->scno = s390_regset.gprs[2]; + tcp->scno = s390_regset.gprs[2] ? + s390_regset.gprs[2] : s390_regset.gprs[1]; return 1; }