SYS_FUNC macro fix for musl

Szabolcs Nagy nsz at port70.net
Tue Dec 15 21:56:49 UTC 2015


* Dmitry V. Levin <ldv at altlinux.org> [2015-12-15 14:59:32 +0300]:
> On Tue, Dec 15, 2015 at 12:02:31PM +0100, Szabolcs Nagy wrote:
> > * Dmitry V. Levin <ldv at altlinux.org> [2015-12-15 00:35:56 +0300]:
> > > On Mon, Dec 14, 2015 at 09:05:50PM +0100, Szabolcs Nagy wrote:
> > > > --- a/linux/ia64/syscallent.h
> > > > +++ b/linux/ia64/syscallent.h
> > > > @@ -31,10 +31,10 @@
> > > >   * with 64-bit layout get redirected to printargs.
> > > >   */
> > > >  #undef SYS_FUNC_NAME
> > > > -#define SYS_FUNC_NAME(syscall_name) printargs
> > > > +#define SYS_FUNC_NAME(syscall_name) sys_printargs
> > > 
> > > You don't need this, sys_printargs is a macro defined to printargs.
> > 
> > i haven't tested it on ia64, but it seemed to me
> > that redirecting sys_* to sys_printargs for i386
> > syscalls was intentional.
> 
> Yes, the redirection itself is intentional, but there is no difference whether
> it's printargs or sys_printargs.
> 

ah ok

attached an updated patch with that fix.

i ran the tests and had some failures, some of them
might be musl bugs, but at least the %Lu printf format
specifier used in some tests is invalid.
(%L is for long double, for long long unsigned use %llu)
attached the test logs too

i could not build strace on a musl+busybox based
system because the strace build system uses a lot
of grep and sed with \+,\?,\| extensions to bre.
(it may be added to musl regex as a posix extension
since others seem to use it too, but this is not
strictly conforming.)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-SYS_FUNC-and-SEN-macros-for-musl.patch
Type: text/x-diff
Size: 2631 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20151215/264b2332/attachment.bin>
-------------- next part --------------
========================================================
   strace 4.10.0.574-00d8-dirty: tests/test-suite.log
========================================================

# TOTAL: 107
# PASS:  68
# SKIP:  23
# XFAIL: 0
# FAIL:  16
# XPASS: 0
# ERROR: 0

.. contents:: :depth: 2

SKIP: _newselect
================

_newselect.test: skipped test: ./_newselect exited with code 77
SKIP _newselect.test (exit status: 77)

FAIL: fcntl
===========

../strace: fcntl.test.tmp
../strace: fcntl.test.tmp
../strace: fcntl.test.tmp
../strace: fcntl.test.tmp
../strace: fcntl.test.tmp
--- fcntl.test.tmp.out
+++ fcntl.test.tmp
@@ -1,8 +1,8 @@
-fcntl(0, F_SETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=-2379362051860529427, l_len=-2379362048367726579}) = -1 EINVAL (Invalid argument)
-fcntl(0, F_SETLKW, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=-2379362051860529427, l_len=-2379362048367726579}) = -1 EINVAL (Invalid argument)
-fcntl(0, F_SETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=0, l_len=4096}) = 0
-fcntl(0, F_GETLK, {l_type=F_UNLCK, l_whence=SEEK_SET, l_start=0, l_len=4096, l_pid=0}) = 0
-fcntl(0, F_SETLK, {l_type=F_UNLCK, l_whence=SEEK_SET, l_start=0, l_len=4096}) = 0
+fcntl(0, F_SETLK, {l_type=F_RDLCK, l_whence=SEEK_SET}) = -1 EINVAL (Invalid argument)
+fcntl(0, F_SETLKW, {l_type=F_RDLCK, l_whence=SEEK_SET}) = -1 EINVAL (Invalid argument)
+fcntl(0, F_SETLK, {l_type=F_RDLCK, l_whence=SEEK_SET}) = 0
+fcntl(0, F_GETLK, {l_type=F_UNLCK, l_whence=SEEK_SET, l_pid=0}) = 0
+fcntl(0, F_SETLK, {l_type=F_UNLCK, l_whence=SEEK_SET}) = 0
 fcntl(0, F_SETLK64, 0x7ffd6330be30) = -1 EINVAL (Invalid argument)
 fcntl(0, F_SETLKW64, 0x7ffd6330be30) = -1 EINVAL (Invalid argument)
 fcntl(0, F_GETLK64, 0x7ffd6330be30) = -1 EINVAL (Invalid argument)
fcntl.test: failed test: ../strace -a8 -efcntl ./fcntl output mismatch
FAIL fcntl.test (exit status: 1)

SKIP: fcntl64
=============

fcntl64.test: skipped test: ./fcntl64 exited with code 77
SKIP fcntl64.test (exit status: 77)

SKIP: file_handle
=================

file_handle.test: skipped test: ./file_handle exited with code 77
SKIP file_handle.test (exit status: 77)

FAIL: fstat
===========

../strace: Requested path 'fstat.sample' resolved into '/home/nsz/dev/os/strace/tests/fstat.sample'
--- fstat.test.tmp.out
+++ fstat.test.tmp
@@ -1,2 +1,2 @@
-fstat(0, {st_dev=makedev(253, 0), st_mode=S_IFREG|0644, st_nlink=1, st_uid=1001, st_gid=1001, st_blksize=4096, st_blocks=0, st_atime=1969/12/31-20:59:17.000000135, st_mtime=1969/12/31-20:59:19.000000246, st_ctime=2015/12/15-21:31:13.100161775}) = 0
+fstat(0, {st_dev=makedev(253, 0), st_ino=1851505, st_mode=S_IFREG|0644, st_nlink=1, st_uid=1001, st_gid=1001, st_blksize=4096, st_blocks=0, st_size=43147718418, st_atime=1969/12/31-20:59:17.000000135, st_mtime=1969/12/31-20:59:19.000000246, st_ctime=2015/12/15-21:31:13.100161775}) = 0
 +++ exited with 0 +++
fstat.test: failed test: ../strace -vefstat -Pfstat.sample ./fstat output mismatch
FAIL fstat.test (exit status: 1)

SKIP: fstat64
=============

fstat64.test: skipped test: ./fstat64 exited with code 77
SKIP fstat64.test (exit status: 77)

SKIP: fstatat64
===============

fstatat64.test: skipped test: ./fstatat64 exited with code 77
SKIP fstatat64.test (exit status: 77)

FAIL: ftruncate
===============

--- ftruncate.test.tmp.out
+++ ftruncate.test.tmp
@@ -1 +1,2 @@
+ftruncate(-1, 1004211376030073054) = -1 EBADF (Bad file descriptor)
 +++ exited with 0 +++
ftruncate.test: failed test: ../strace -a24 -eftruncate ./ftruncate output mismatch
FAIL ftruncate.test (exit status: 1)

SKIP: ftruncate64
=================

ftruncate64.test: skipped test: ./ftruncate64 exited with code 77
SKIP ftruncate64.test (exit status: 77)

FAIL: getdents
==============

../strace: getdents.test.tmp
../strace: getdents.test.tmp
../strace: getdents.test.tmp
--- getdents.test.tmp.out
+++ getdents.test.tmp
@@ -1,3 +1,3 @@
-getdents(0, ["A\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nZ", d_type=DT_REG}, ".", d_type=DT_DIR}, "..", d_type=DT_DIR}], 8192) = 328
+getdents(0, [{d_ino="A\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nZ", d_type=DT_REG}, {d_ino=".", d_type=DT_DIR}, {d_ino="..", d_type=DT_DIR}], 8192) = 328
 getdents(0, [], 8192) = 0
 +++ exited with 0 +++
getdents.test: failed test: ../strace -a22 -vegetdents ./getdents output mismatch
FAIL getdents.test (exit status: 1)

FAIL: ioctl
===========

--- ioctl.test.tmp.out
+++ ioctl.test.tmp
@@ -1,4 +1,5 @@
 ioctl(-1, TCGETS, 0x7ffe492378f0) = -1 EBADF (Bad file descriptor)
+ioctl(1, TIOCGWINSZ, 0x7ffe49237538) = -1 ENOTTY (Not a tty)
 ioctl(-1, MMTIMER_GETRES, 0x7ffe492378e8) = -1 EBADF (Bad file descriptor)
 ioctl(-1, VIDIOC_ENUMINPUT, 0) = -1 EBADF (Bad file descriptor)
 ioctl(-1, HIDIOCGRDESCSIZE or HIDIOCGVERSION, 0x7ffe492378e8) = -1 EBADF (Bad file descriptor)
ioctl.test: failed test: ../strace -a16 -e ioctl ./ioctl output mismatch
FAIL ioctl.test (exit status: 1)

SKIP: llseek
============

llseek.test: skipped test: ./llseek exited with code 77
SKIP llseek.test (exit status: 77)

FAIL: lseek
===========

--- lseek.test.tmp.out
+++ lseek.test.tmp
@@ -1 +1,2 @@
+lseek(-1, 1004211376030073054, SEEK_SET) = -1 EBADF (Bad file descriptor)
 +++ exited with 0 +++
lseek.test: failed test: ../strace -a30 -elseek ./lseek output mismatch
FAIL lseek.test (exit status: 1)

FAIL: lstat
===========

--- lstat.test.tmp.out
+++ lstat.test.tmp
@@ -1,2 +1,2 @@
-lstat("lstat.sample", {st_dev=makedev(253, 0), st_mode=S_IFREG|0640, st_nlink=1, st_uid=1001, st_gid=1001, st_blksize=4096, st_blocks=0, st_atime=1969/12/31-20:59:17.000000135, st_mtime=1969/12/31-20:59:19.000000246, st_ctime=2015/12/15-21:31:13.316828448}) = 0
+lstat("lstat.sample", {st_dev=makedev(253, 0), st_ino=1851559, st_mode=S_IFREG|0640, st_nlink=1, st_uid=1001, st_gid=1001, st_blksize=4096, st_blocks=0, st_size=43147718418, st_atime=1969/12/31-20:59:17.000000135, st_mtime=1969/12/31-20:59:19.000000246, st_ctime=2015/12/15-21:31:13.316828448}) = 0
 +++ exited with 0 +++
lstat.test: failed test: ../strace -velstat -Plstat.sample ./lstat output mismatch
FAIL lstat.test (exit status: 1)

SKIP: lstat64
=============

lstat64.test: skipped test: ./lstat64 exited with code 77
SKIP lstat64.test (exit status: 77)

SKIP: membarrier
================

membarrier.test: skipped test: ./membarrier exited with code 77
SKIP membarrier.test (exit status: 77)

SKIP: mlock2
============

mlock2.test: skipped test: ./mlock2 exited with code 77
SKIP mlock2.test (exit status: 77)

FAIL: mmsg
==========

--- ./mmsg.expected
+++ mmsg.test.tmp
@@ -1,12 +1,3 @@
-sendmmsg(1, {{{msg_name(0)=NULL, msg_iov(2)=[{"one", 3}, {"two", 3}], msg_controllen=0, msg_flags=0}, 6}, {{msg_name(0)=NULL, msg_iov(1)=[{"three", 5}], msg_controllen=0, msg_flags=0}, 5}}, 2, 0) = 2
- = 2 buffers in vector 0
- * 3 bytes in buffer 0
- | 00000  6f 6e 65                                          one              |
- * 3 bytes in buffer 1
- | 00000  74 77 6f                                          two              |
- = 1 buffers in vector 1
- * 5 bytes in buffer 0
- | 00000  74 68 72 65 65                                    three            |
 recvmmsg(0, {{{msg_name(0)=NULL, msg_iov(2)=[{"one", 3}, {"two", 3}], msg_controllen=0, msg_flags=0}, 6}, {{msg_name(0)=NULL, msg_iov(1)=[{"three", 5}], msg_controllen=0, msg_flags=0}, 5}}, 2, 0, NULL) = 2 (left NULL)
  = 2 buffers in vector 0
  * 3 bytes in buffer 0
mmsg.test: failed test: ../strace -e trace=recvmmsg,sendmmsg -e read=0 -e write=1 ./mmsg output mismatch
FAIL mmsg.test (exit status: 1)

SKIP: mq
========

mq.test: skipped test: ./mq exited with code 77
SKIP mq.test (exit status: 77)

FAIL: newfstatat
================

--- newfstatat.test.tmp.out
+++ newfstatat.test.tmp
@@ -1,2 +1,2 @@
-newfstatat(AT_FDCWD, "newfstatat.sample", {st_dev=makedev(253, 0), st_mode=S_IFREG|0640, st_nlink=1, st_uid=1001, st_gid=1001, st_blksize=4096, st_blocks=0, st_atime=1969/12/31-20:59:17.000000135, st_mtime=1969/12/31-20:59:19.000000246, st_ctime=2015/12/15-21:31:13.890161799}, AT_SYMLINK_NOFOLLOW) = 0
+newfstatat(AT_FDCWD, "newfstatat.sample", {st_dev=makedev(253, 0), st_ino=1851595, st_mode=S_IFREG|0640, st_nlink=1, st_uid=1001, st_gid=1001, st_blksize=4096, st_blocks=0, st_size=43147718418, st_atime=1969/12/31-20:59:17.000000135, st_mtime=1969/12/31-20:59:19.000000246, st_ctime=2015/12/15-21:31:13.890161799}, AT_SYMLINK_NOFOLLOW) = 0
 +++ exited with 0 +++
newfstatat.test: failed test: ../strace -venewfstatat -Pnewfstatat.sample ./newfstatat output mismatch
FAIL newfstatat.test (exit status: 1)

SKIP: oldselect
===============

oldselect.test: skipped test: ./oldselect exited with code 77
SKIP oldselect.test (exit status: 77)

FAIL: pselect6
==============

../strace: pselect6.test.tmp
../strace: pselect6.test.tmp
../strace: pselect6.test.tmp
../strace: pselect6.test.tmp
--- pselect6.test.tmp.out
+++ pselect6.test.tmp
@@ -1,6 +1,7 @@
-pselect6(5, [3 4], [3 4], [1 2], NULL, {NULL, 8}) = 1 (out [4])
-pselect6(5, NULL, [1 2 3 4], NULL, {pselect6(-1, NULL, 0x7fa088e32080, NULL, NULL, {[HUP CHLD], 8}) = -1 EINVAL (Invalid argument)
-pselect6(1025, [3], [], NULL, {0, 123}, {[HUP CHLD], 8}) = 0 (Timeout)
-pselect6(0, NULL, NULL, NULL, {0, 222222222}, {[HUP CHLD], 8}) = ? ERESTARTNOHAND (To be restarted if no handler)
+pselect6(5, [3 4], [3 4], [1 2], NULL, {NULL) = 1 (out [4])
+pselect6(5, NULL, [1 2 3 4], NULL, {789985, 789986}, NULL) = 3 (out [1 2 4], left {789985, 788024})
+pselect6(-1, NULL, 0x7fa088e32080, NULL, NULL, {[HUP CHLD]) = -1 EINVAL (Invalid argument)
+pselect6(1025, [3], [], NULL, {0, 123}, {[HUP CHLD]) = 0 (Timeout)
+pselect6(0, NULL, NULL, NULL, {0, 222222222}, {[HUP CHLD]) = ? ERESTARTNOHAND (To be restarted if no handler)
 --- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
 +++ exited with 0 +++
pselect6.test: failed test: ../strace -e pselect6 ./pselect6 output mismatch
FAIL pselect6.test (exit status: 1)

SKIP: readdir
=============

readdir.test: skipped test: ./readdir exited with code 77
SKIP readdir.test (exit status: 77)

FAIL: select
============

--- select.test.tmp.out
+++ select.test.tmp
@@ -1,4 +1,5 @@
 select(5, [3 4], [3 4], [3 4], NULL) = 1 ()
-select(5, NULL, [1 2 3 4], NULL, {select(-1, NULL, 0x7fc873800080, NULL, NULL) = -1 EINVAL (Invalid argument)
+select(5, NULL, [1 2 3 4], NULL, {789985, 789986}) = 3 (out [1 2 4], left {789985, 789984})
+select(-1, NULL, 0x7fc873800080, NULL, NULL) = -1 EINVAL (Invalid argument)
 select(1025, [3], [], NULL, {0, 123}) = 0 (Timeout)
 +++ exited with 0 +++
select.test: failed test: ../strace -a36 -eselect ./select output mismatch
FAIL select.test (exit status: 1)

SKIP: sendfile64
================

sendfile64.test: skipped test: ./sendfile64 ./sendfile64 exited with code 77
SKIP sendfile64.test (exit status: 77)

FAIL: sigreturn
===============

Failed patterns of expected output:
rt_sigprocmask\(SIG_SETMASK, \[(USR2 CHLD|CHLD USR2) RT_2 RT_3 RT_4 RT_26 RT_27\], NULL, [[:digit:]]+\) += 0|osf_sigprocmask\(SIG_SETMASK, \[(USR2 CHLD|CHLD USR2) RT_2 RT_3 RT_4 RT_26 RT_27\]\) += 0 +\(old mask \[[^]]*\]\)
(rt_)?sigreturn\((\{mask=\[(USR2 CHLD|CHLD USR2) RT_2 RT_3 RT_4 RT_26 RT_27\]\})?\) += 0
Actual output:
rt_sigprocmask(SIG_SETMASK, [USR2 CHLD RT_3 RT_4 RT_26 RT_27], NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RT_1 RT_2], NULL, 8) = 0
rt_sigaction(SIGUSR1, {0x7fbff31c89c0, [], SA_RESTORER|SA_RESTART, 0x7fbff2f83e0b}, {SIG_DFL, [], 0}, 8) = 0
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1 RT_2], [USR2 CHLD RT_3 RT_4 RT_26 RT_27], 8) = 0
tkill(31631, SIGUSR1)                   = 0
rt_sigprocmask(SIG_SETMASK, [USR2 CHLD RT_3 RT_4 RT_26 RT_27], NULL, 8) = 0
--- SIGUSR1 {si_signo=SIGUSR1, si_code=SI_TKILL, si_pid=31631, si_uid=1001} ---
rt_sigreturn({mask=[USR2 CHLD RT_3 RT_4 RT_26 RT_27]}) = 0
+++ exited with 0 +++
sigreturn.test: failed test: ../strace -esignal ./sigreturn output mismatch
FAIL sigreturn.test (exit status: 1)

FAIL: stat
==========

--- stat.test.tmp.out
+++ stat.test.tmp
@@ -1,2 +1,2 @@
-stat("stat.sample", {st_dev=makedev(253, 0), st_mode=S_IFREG|0640, st_nlink=1, st_uid=1001, st_gid=1001, st_blksize=4096, st_blocks=0, st_atime=1969/12/31-20:59:17.000000135, st_mtime=1969/12/31-20:59:19.000000246, st_ctime=2015/12/15-21:31:14.426828481}) = 0
+stat("stat.sample", {st_dev=makedev(253, 0), st_ino=1851656, st_mode=S_IFREG|0640, st_nlink=1, st_uid=1001, st_gid=1001, st_blksize=4096, st_blocks=0, st_size=43147718418, st_atime=1969/12/31-20:59:17.000000135, st_mtime=1969/12/31-20:59:19.000000246, st_ctime=2015/12/15-21:31:14.426828481}) = 0
 +++ exited with 0 +++
stat.test: failed test: ../strace -vestat -Pstat.sample ./stat output mismatch
FAIL stat.test (exit status: 1)

SKIP: stat64
============

stat64.test: skipped test: ./stat64 exited with code 77
SKIP stat64.test (exit status: 77)

SKIP: timer_create
==================

timer_create.test: skipped test: ./timer_create exited with code 77
SKIP timer_create.test (exit status: 77)

FAIL: times
===========

../strace: times.test.tmp
../strace: times.test.tmp
--- times.test.tmp.out
+++ times.test.tmp
@@ -1,2 +1,2 @@
-times({tms_utime=28, tms_stime=11, tms_cutime=34, tms_cstime=25}) = 1432169758
+times()                                 = 1432169758
 +++ exited with 0 +++
times.test: failed test: ../strace -etimes -esignal=none ./times output mismatch
FAIL times.test (exit status: 1)

FAIL: truncate
==============

--- truncate.test.tmp.out
+++ truncate.test.tmp
@@ -1 +1,2 @@
-truncate("truncate\nfilename", +++ exited with 0 +++
+truncate("truncate\nfilename", 1004211376030073054) = -1 ENOENT (No such file or directory)
++++ exited with 0 +++
truncate.test: failed test: ../strace -etruncate ./truncate output mismatch
FAIL truncate.test (exit status: 1)

SKIP: truncate64
================

truncate64.test: skipped test: ./truncate64 exited with code 77
SKIP truncate64.test (exit status: 77)

SKIP: uid16
===========

uid16.test: skipped test: ./uid16 exited with code 77
SKIP uid16.test (exit status: 77)

SKIP: uid32
===========

uid32.test: skipped test: ./uid32 exited with code 77
SKIP uid32.test (exit status: 77)

SKIP: umount
============

umount.test: skipped test: ./umount exited with code 77
SKIP umount.test (exit status: 77)

SKIP: userfaultfd
=================

userfaultfd.test: skipped test: ./userfaultfd exited with code 77
SKIP userfaultfd.test (exit status: 77)

SKIP: utime
===========

utime.test: skipped test: test executable does not use utime syscall
SKIP utime.test (exit status: 77)

FAIL: xettimeofday
==================

--- xettimeofday.test.tmp.out
+++ xettimeofday.test.tmp
@@ -1,4 +1,4 @@
 gettimeofday({1450215076, 23597}, NULL) = 0
 gettimeofday({1450215076, 23674}, {tz_minuteswest=0, tz_dsttime=0}) = 0
-settimeofday({-1, 1000000000}, {tz_minuteswest=0, tz_dsttime=0}) = -1 EINVAL (Invalid argument)
+settimeofday({-1, 1000000000}, NULL) = -1 EINVAL (Invalid argument)
 +++ exited with 0 +++
xettimeofday.test: failed test: ../strace -a20 -e trace=gettimeofday,settimeofday ./xettimeofday output mismatch
FAIL xettimeofday.test (exit status: 1)

SKIP: strace-k
==============

strace-k.test: skipped test: strace -k is not available
SKIP strace-k.test (exit status: 77)



More information about the Strace-devel mailing list