On 03/24/2015 01:49 AM, Dmitry V. Levin wrote: > On Mon, Mar 23, 2015 at 05:50:39AM +0300, Dmitry V. Levin wrote: >> On Sat, Mar 21, 2015 at 05:06:32PM +0000, Denys Vlasenko wrote: >> [...] >>> commit 8497b6222ed8ef606996d0ceb2bae260d82f95e2 >>> Author: Denys Vlasenko <dvlas...@redhat.com> >>> Date: Sat Mar 21 17:51:52 2015 +0100 >>> >>> Show the syscall name in "resuming interrupted call" message >> >> It's nice when it works, but you've broken ARM and probably other >> architectures: >> >> $ ./strace true >> pid 1234 stray syscall exit >> Segmentation fault > > SPARC has also suffered from this change: > > sparc$ ./strace -e, true > syscall: unknown syscall trap 1a80000d f7aceb48 > +++ exited with 0 +++ > > Not as fatal as on ARM, but enough to trigger bexecve.test failure.
sparc seems to be one of a few architectures needing to examine syscall insn to determine personality. We seem to be carrying a lot of non-Linux cruft in this particular corner. Linux kernel does not support Solaris syscalls: 0x91d02008 is a "ta 0x8" instruction, and Linux kernel has no syscall trap gate set up for it. It won't work if a (presumably Solaris) userspace binary would try executing "ta 0x8". Same for 0x91d02027. So this is bogus too: if (trap == 0x91d02027) { scno = 156; } The gist is, only 0x91d02010 and 0x91d0206d are valid - those are 32-bit and 64-bit Linux syscall entry points. We need to check trap insn only on SPARC64, so for 32-bit strace we can save one round-trip to kernel. And this is bogus too: scno = sparc_regs.u_regs[U_REG_G1]; if (scno == 0) { scno = sparc_regs.u_regs[U_REG_O0]; ... because Linux kernel _always_ takes syscall# from %g1, zero value is no exception. I think entire personality 1 for SPARC is dead (doesn't work for many years) - all solaris_FOO()'s are printargs, except for lonely solaris_open(). > BTW, this "resuming interrupted system call" feature is broken on SPARC: > > $ sleep 2 & sleep 1; ./strace -p $! > [1] 24450 > Process 24450 attached > syscall: unknown syscall trap 1a800004 f7ebea10 > syscall_516(0, 0x14980, 0x117e0, 0x1, 0x2, 0xffaef328) = 0 > close(1) = 0 > close(2) = 0 > exit_group(0) = ? > +++ exited with 0 +++ > [1]+ Done sleep 2 > > ERESTART_RESTARTBLOCK is 516; what a coincidence! :) That's the result of bogus "if (scno == 0)" check. restart_syscall is syscall#0. We mishandle it. I'm going to push a run-tested fix. ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Strace-devel mailing list Strace-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/strace-devel