]> granicus.if.org Git - strace/log
strace
10 years agoCleanup inotify syscalls decoding
Dmitry V. Levin [Wed, 5 Feb 2014 15:43:04 +0000 (15:43 +0000)]
Cleanup inotify syscalls decoding

* linux/inotify.h: New file.
* file.c (inotify_modes, inotify_init_flags, sys_inotify_add_watch,
sys_inotify_rm_watch, sys_inotify_init1): Move...
* inotify.c: ... here.
(inotify_modes): Rename to inotify_flags, convert to XLAT form.
(inotify_init_flags): Convert to XLAT form.
* Makefile.am (strace_SOURCES): Add inotify.c.
(EXTRA_DIST): Add linux/inotify.h.

10 years agoEnhance reboot decoding
Dmitry V. Levin [Wed, 5 Feb 2014 14:51:19 +0000 (14:51 +0000)]
Enhance reboot decoding

* linux/reboot.h: New file.
* system.c (bootflags1, bootflags2, bootflags3, sys_reboot): Move...
* reboot.c: ... here.
(bootflags2, bootflags3): Update constants.
* Makefile.am (strace_SOURCES): Add reboot.c.
(EXTRA_DIST): Add linux/reboot.h.

10 years agoImplement kexec_load decoding
Dmitry V. Levin [Wed, 5 Feb 2014 13:48:26 +0000 (13:48 +0000)]
Implement kexec_load decoding

* kexec.c: New file.
* linux/kexec.h: Likewise.
* Makefile.am (strace_SOURCES): Add kexec.c.
(EXTRA_DIST): Add linux/kexec.h.
* linux/dummy.h (sys_kexec_load): Remove.
* linux/syscall.h (sys_kexec_load): New prototype.

10 years agoUse prepared editions of recently imported linux headers
Dmitry V. Levin [Wed, 5 Feb 2014 12:56:26 +0000 (12:56 +0000)]
Use prepared editions of recently imported linux headers

* linux/fanotify.h: Replace with edition prepared with headers_install.sh.
* linux/personality.h: Likewise.

10 years agoImplement fanotify_init and fanotify_mark decoding
Dmitry V. Levin [Wed, 5 Feb 2014 04:13:18 +0000 (04:13 +0000)]
Implement fanotify_init and fanotify_mark decoding

* fanotify.c: New file.
* linux/fanotify.h: Likewise.
* Makefile.am (strace_SOURCES): Add fanotify.c.
(EXTRA_DIST): Add linux/fanotify.h.
* defs.h (print_dirfd): New prototype.
* file.c (print_dirfd): Export.
* linux/dummy.h (sys_fanotify_init, sys_fanotify_mark): Remove.
* linux/syscall.h (sys_fanotify_init, sys_fanotify_mark): New
prototypes.
* pathtrace.c (pathtrace_match): Handle sys_fanotify_init and
sys_fanotify_mark.

10 years agoUse XLAT_END macro
Dmitry V. Levin [Wed, 5 Feb 2014 02:20:51 +0000 (02:20 +0000)]
Use XLAT_END macro

Automatically update all xlat structures using the following sed regexp:
s/^[[:space:]]*{[[:space:]]*0[[:space:]]*,[[:space:]]*NULL[[:space:]]*,\?[[:space:]]*}[[:space:]]*,\?[[:space:]]*/\tXLAT_END/

10 years agoItroduce XLAT_END macro to make xlat structures more compact
Dmitry V. Levin [Wed, 5 Feb 2014 02:18:52 +0000 (02:18 +0000)]
Itroduce XLAT_END macro to make xlat structures more compact

* defs.h (XLAT_END): New macro.

10 years agoConvert personality_options to XLAT form
Dmitry V. Levin [Wed, 5 Feb 2014 02:09:49 +0000 (02:09 +0000)]
Convert personality_options to XLAT form

* linux/personality.h: New file.
* Makefile.am (EXTRA_DIST): Add it.
* system.c: Include <linux/personality.h>.
(personality_options): Update PER_* constants, convert to XLAT form.

10 years agoConvert futexops to XLAT form
Dmitry V. Levin [Wed, 5 Feb 2014 02:01:16 +0000 (02:01 +0000)]
Convert futexops to XLAT form

* process.c: Define FUTEX_*_PRIVATE macros.
(futexops): Convert to XLAT form.

10 years agoConvert sigev_value to XLAT form
Dmitry V. Levin [Wed, 5 Feb 2014 01:46:10 +0000 (01:46 +0000)]
Convert sigev_value to XLAT form

* time.c (sigev_value): Convert to XLAT form.
(printsigevent32, printsigevent): Update use of sigev_value.

10 years agoUse XLAT macro
Dmitry V. Levin [Wed, 5 Feb 2014 01:33:50 +0000 (01:33 +0000)]
Use XLAT macro

Automatically convert all xlat structures to XLAT form
using the following sed regexp:
s/^[[:space:]]*{[[:space:]]*\([^",}[:space:]]\+\)[[:space:]]*,[[:space:]]*"\1",\?[[:space:]]*}[[:space:]]*/\tXLAT(\1)/

10 years agoIntroduce XLAT macro to ease maintenance of xlat structures
Dmitry V. Levin [Wed, 5 Feb 2014 01:28:45 +0000 (01:28 +0000)]
Introduce XLAT macro to ease maintenance of xlat structures

* defs.h (XLAT): New macro.

Suggested-by: Mike Frysinger <vapier@gentoo.org>
10 years agoDecode ptp ioctls
Stefan Sørensen [Fri, 31 Jan 2014 11:01:01 +0000 (12:01 +0100)]
Decode ptp ioctls

* defs.h (ptp_ioctl): New prototype.
* ioctl.c (ioctl_decode): Call ptp_ioctl when code is '='.
* Makefile.am (strace_SOURCES): Add ptp.c.
(EXTRA_DIST): Add linux/ptp_clock.h.
* ptp.c: New file.
* linux/ptp_clock.h: New file.

Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
10 years agoDecode dynamic posix clocks
Stefan Sørensen [Mon, 3 Feb 2014 09:01:27 +0000 (10:01 +0100)]
Decode dynamic posix clocks

* time.c (cpuclocknames): New xlat structure.
(printclockname): New function that decodes posix clock names,
including dynamic fd encoded clocks.
(sys_clock_settime, sys_clock_gettime, sys_clock_nanosleep,
sys_clock_adjtime, sys_timer_create, sys_timerfd, sys_timerfd_create):
Use it.

Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
10 years agoUpdate ADJ_* constants
Stefan Sørensen [Fri, 31 Jan 2014 11:01:02 +0000 (12:01 +0100)]
Update ADJ_* constants

* time.c (adjtimex_modes): Add ADJ_TAI, ADJ_SETOFFSET, ADJ_MICRO,
ADJ_NANO, ADJ_OFFSET_SS_READ.

Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
10 years agoAdd decoding of sockets descriptor 'paths' for network calls
Philippe Ombredanne [Sat, 1 Feb 2014 17:57:45 +0000 (09:57 -0800)]
Add decoding of sockets descriptor 'paths' for network calls

* net.c (sys_bind, sys_listen, do_accept, sys_send, sys_sendto,
sys_sendmsg, sys_sendmmsg, sys_recv, sys_recvfrom, sys_recvmsg,
sys_recvmmsg, sys_shutdown, sys_getsockopt, sys_setsockopt): Decode
socket descriptor arguments using printfd.
* pathtrace.c (pathtrace_match): Also check TRACE_NETWORK syscalls
that take socket descriptor arguments.
* tests/net-fd.test: New test for socket descriptor arguments decoding.
* tests/Makefile.am (TESTS): Add net-fd.test.
(net-fd.log): New dependency on net.log.

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
10 years agotests: rename all tests so that their names end in .test suffix
Dmitry V. Levin [Sun, 2 Feb 2014 15:20:11 +0000 (15:20 +0000)]
tests: rename all tests so that their names end in .test suffix

Due to automake limitations, some features work only for tests
that end in one of the suffixes listed in TEST_EXTENSIONS.

* tests/detach-running: Rename to detach-running.test.
* tests/detach-sleeping: Rename to detach-sleeping.test.
* tests/detach-stopped: Rename to detach-stopped.test.
* tests/net: Rename to net.test.
* tests/ptrace_setoptions: Rename to ptrace_setoptions.test.
* tests/qual_syscall: Rename to qual_syscall.test.
* tests/sigaction.sh: Rename to sigaction.test.
* tests/stat: Rename to stat.test.
* tests/strace-f: Rename to strace-f.test.
* tests/Makefile.am (TESTS): Update.
(LOG_COMPILER): Rename to TEST_LOG_COMPILER.

10 years agonet: add more sockopt options
Mike Frysinger [Thu, 30 Jan 2014 23:53:43 +0000 (18:53 -0500)]
net: add more sockopt options

This syncs with the defines as available in linux-3.13.

* net.c (sockipoptions): Add IP_IPSEC_POLICY, IP_XFRM_POLICY,
IP_PASSSEC, IP_TRANSPARENT, IP_ORIGDSTADDR, IP_RECVORIGDSTADDR,
IP_MINTTL, IP_NODEFRAG, IP_UNBLOCK_SOURCE, IP_BLOCK_SOURCE,
IP_ADD_SOURCE_MEMBERSHIP, IP_DROP_SOURCE_MEMBERSHIP, MCAST_JOIN_GROUP,
MCAST_BLOCK_SOURCE, MCAST_UNBLOCK_SOURCE, MCAST_LEAVE_GROUP,
MCAST_JOIN_SOURCE_GROUP, MCAST_LEAVE_SOURCE_GROUP, IP_MULTICAST_ALL,
IP_UNICAST_IF.

10 years agomips: fix sigaction reporting
Chris Dearman [Tue, 10 Dec 2013 03:58:42 +0000 (19:58 -0800)]
mips: fix sigaction reporting

MIPS userland uses the same sigaction structure with a full signal
mask for old_sigaction and new_sigaction and does does not have
an sa_restorer field.

These changes have been tested on MIPS O32 big/little endian, MIPS N64
big endian and x86-64.

* signal.c (old_sigaction) [MIPS]: Add definition for MIPS.
(decode_old_sigaction) [MIPS]: Print sa_mask according to its definition.
(new_sigaction) [MIPS]: Add definition for MIPS.

Signed-off-by: Chris Dearman <chris.dearman@imgtec.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
10 years agoFactor out struct sigaction printing code
Dmitry V. Levin [Tue, 7 Jan 2014 22:41:30 +0000 (22:41 +0000)]
Factor out struct sigaction printing code

* signal.c [HAVE_SIGACTION] (decode_old_sigaction): New function.
[HAVE_SIGACTION] (sys_sigaction): Use it.
(decode_new_sigaction): New function.
(sys_rt_sigaction): Use it.

10 years agotests: add a test for rt_sigaction output
Dmitry V. Levin [Tue, 7 Jan 2014 19:32:32 +0000 (19:32 +0000)]
tests: add a test for rt_sigaction output

Since "struct sigaction" varies between architectures, rt_sigaction
decoding sometimes produces incorrect output.  This test is expected
to catch basic rt_sigaction decoding bugs.

Based on a patch proposed by Chris Dearman.

* tests/sigaction.c: New file.
* tests/sigaction.awk: Likewise.
* tests/sigaction.sh: New test.
* tests/Makefile.am (check_PROGRAMS): Add sigaction.
(TESTS): Add sigaction.sh.
(EXTRA_DIST): Add sigaction.awk.
* tests/.gitignore: Add sigaction.

10 years agomem: add missed MAP_HUGETLB mmap flag
Kirill A. Shutemov [Thu, 2 Jan 2014 11:15:32 +0000 (13:15 +0200)]
mem: add missed MAP_HUGETLB mmap flag

* mem.c (mmap_flags): Add MAP_HUGETLB mmap flag.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
10 years agoDelete old PTRACE_{PEEK,POKE}USR logic
Mike Frysinger [Tue, 31 Dec 2013 07:43:17 +0000 (02:43 -0500)]
Delete old PTRACE_{PEEK,POKE}USR logic

The code base has settled on PTRACE_{PEEK,POKE}USER (with an E) and has
logic in defs.h to make sure it's set sanely.  Delete this old logic as
the defs.h takes care of it now.

* process.c: Delete PTRACE_PEEKUSR/PTRACE_POKEUSR defines.
* signal.c: Likewise.
* syscall.c: Delete PTRACE_PEEKUSR define.
* util.c: Likewise.

10 years agoDecode the O_PATH flag
Mike Frysinger [Tue, 31 Dec 2013 06:13:27 +0000 (01:13 -0500)]
Decode the O_PATH flag

* file.c (open_mode_flags): Add O_PATH.

11 years agoRemove unused configure checks
Dmitry V. Levin [Wed, 13 Nov 2013 22:50:32 +0000 (22:50 +0000)]
Remove unused configure checks

* configure.ac (AC_CHECK_FUNCS): Remove _sys_siglist and sys_siglist.
(AC_CHECK_DECLS): Likewise.

11 years agoAssume that <sys/ptrace.h> provides a valid ptrace prototype
Dmitry V. Levin [Wed, 13 Nov 2013 18:09:04 +0000 (18:09 +0000)]
Assume that <sys/ptrace.h> provides a valid ptrace prototype

We used to explicitly list architectures where <sys/ptrace.h> from glibc
is known to provide a valid prototype for ptrace, and use a homegrown
replacement for all the rest.  Situation seems to be better nowadays,
glibc is not the only libc available, so let's use ptrace prototype from
<sys/ptrace.h> by default, leaving the replacement for rare broken cases
if any.

* defs.h: Use ptrace prototype workaround iff
NEED_PTRACE_PROTOTYPE_WORKAROUND is defined.

11 years agoStop using _LFS64_LARGEFILE
Dmitry V. Levin [Tue, 12 Nov 2013 22:34:42 +0000 (22:34 +0000)]
Stop using _LFS64_LARGEFILE

There is only one place left in the code where strace guesses whether
libc provides LFS64 functions and structures.  The most natural thing to
do there is to check for _LARGEFILE64_SOURCE - the macro provided by
glibc.  Other libc implementations that provide nondegenerate LFS64
interfaces are expected to define this macro as well.

* defs.h (_LFS64_LARGEFILE): Remove.
* strace.c: Use _LARGEFILE64_SOURCE instead of _LFS64_LARGEFILE.

11 years agoDefine truncate64, ftruncate64, and getdents64 decoders unconditionally
Dmitry V. Levin [Tue, 12 Nov 2013 22:25:06 +0000 (22:25 +0000)]
Define truncate64, ftruncate64, and getdents64 decoders unconditionally

These decoders are referenced by most architectures, there were no
undefined references so far because _LFS64_LARGEFILE appears to be
always defined by glibc when _GNU_SOURCE is defined.

* file.c (sys_truncate64, sys_ftruncate64, sys_getdents64): Define
unconditionally.

11 years agoDefine printflock64 only if it is referenced by other code
Dmitry V. Levin [Tue, 12 Nov 2013 21:49:03 +0000 (21:49 +0000)]
Define printflock64 only if it is referenced by other code

* configure.ac (AC_CHECK_TYPES): Add struct flock64.
* desc.c (HAVE_F_SETLK64, HAVE_F_SETLKW64, HAVE_F_GETLK64): New macros.
[!HAVE_STRUCT_FLOCK64] (struct flock64): Define.
(printflock64): Define only if referenced by other code.
(sys_fcntl): Handle F_FREESP64, F_SETLK64, F_SETLKW64, and F_GETLK64 iff
these constants are defined and differ from their non-64bit versions.

11 years agoMake PTRACE_PEEKUSER/PTRACE_POKEUSER checks less glibc specific
Dmitry V. Levin [Tue, 12 Nov 2013 21:20:50 +0000 (21:20 +0000)]
Make PTRACE_PEEKUSER/PTRACE_POKEUSER checks less glibc specific

* configure.ac (AC_CHECK_DECLS): Add PTRACE_PEEKUSER and
PTRACE_POKEUSER.
* defs.h: Define PTRACE_PEEKUSER and PTRACE_POKEUSER only if
they are not provided by <sys/ptrace.h>.

Reported by John Spencer.

11 years agoRemove unneeded redefinitions of IPPROTO_* macros
Dmitry V. Levin [Tue, 12 Nov 2013 16:13:43 +0000 (16:13 +0000)]
Remove unneeded redefinitions of IPPROTO_* macros

IPPROTO_* macros are defined by <netinet/in.h>, no need to redefine
them.

* net.c (IPPROTO_EGP, IPPROTO_PUP, IPPROTO_IDP, IPPROTO_IGMP,
IPPROTO_RAW, IPPROTO_MAX): Remove.

Reported by John Spencer.

11 years agoRemove unused AC_OFF_T_IS_LONG_LONG configure check
Dmitry V. Levin [Tue, 12 Nov 2013 15:43:06 +0000 (15:43 +0000)]
Remove unused AC_OFF_T_IS_LONG_LONG configure check

* configure.ac: Remove AC_OFF_T_IS_LONG_LONG.
* m4/long_long.m4: Likewise.

11 years agoRemove unused code
Dmitry V. Levin [Tue, 12 Nov 2013 15:39:09 +0000 (15:39 +0000)]
Remove unused code

* configure.ac (AC_CHECK_TYPES): Remove struct opthdr and
struct t_opthdr.
* net.c (print_sock_optmgmt): Remove.

11 years agoUse struct sigcontext instead of struct sigcontext_struct
Dmitry V. Levin [Tue, 12 Nov 2013 15:27:38 +0000 (15:27 +0000)]
Use struct sigcontext instead of struct sigcontext_struct

* configure.ac (AC_CHECK_TYPES): Remove struct sigcontext_struct.
* signal.c (sys_sigreturn) [S390 || S390X || POWERPC || ALPHA): Replace
struct sigcontext_struct with struct sigcontext.

Reported by John Spencer.

11 years agoUse standard names of sched_param structure members
Dmitry V. Levin [Tue, 12 Nov 2013 15:09:56 +0000 (15:09 +0000)]
Use standard names of sched_param structure members

* process.c (sys_sched_setscheduler, sys_sched_getparam,
sys_sched_setparam): Use portable struct sched_param member name
sched_priority instead of glibc specific __sched_priority.

Reported by John Spencer.

11 years agoMake SIGEV_THREAD_ID decoding less glibc specific
Dmitry V. Levin [Mon, 11 Nov 2013 23:54:30 +0000 (23:54 +0000)]
Make SIGEV_THREAD_ID decoding less glibc specific

SIGEV_THREAD_ID decoding requires access to an internal member of
struct sigevent.  There seems to be no portable way to do it besides
adding a configure check.

* configure.ac (AC_CHECK_MEMBERS): Check for
struct sigevent._sigev_un._pad and struct sigevent.__pad.
* time.c (printsigevent): Use an appropriate struct sigevent member
to print thread id.

Reported by John Spencer.

11 years agoRemove unused configure checks
Dmitry V. Levin [Mon, 11 Nov 2013 15:59:49 +0000 (15:59 +0000)]
Remove unused configure checks

* configure.ac (AC_CHECK_MEMBERS): Remove T_conn_res.QUEUE_ptr,
T_conn_res.ACCEPTOR_id, dqblk.dqb_curblocks, sigcontext.sc_hi2.

11 years agoAssume "long long" availability
Dmitry V. Levin [Mon, 11 Nov 2013 15:52:37 +0000 (15:52 +0000)]
Assume "long long" availability

Most of the code already uses long long types unconditionally.

* configure.ac: Remove the check for long long.
* file.c (printstat64): Remove HAVE_LONG_LONG checks, use %llu format
string unconditionally.

11 years agoInclude <sys/poll.h> only if there is no <poll.h>
Dmitry V. Levin [Wed, 6 Nov 2013 01:17:05 +0000 (01:17 +0000)]
Include <sys/poll.h> only if there is no <poll.h>

* pathtrace.c: Do not include <sys/poll.h> if <poll.h> is available.
* stream.c: Likewise.

11 years agoMove io_* syscalls decoding to a separate file
Dmitry V. Levin [Mon, 11 Nov 2013 15:06:18 +0000 (15:06 +0000)]
Move io_* syscalls decoding to a separate file

* desc.c (sys_io_setup, sys_io_destroy, sys_io_submit, sys_io_cancel,
sys_io_getevents, declarations from libaio.h): Move to ...
* aio.c: new file.
* Makefile.am (strace_SOURCES): Add aio.c.

11 years agoStop using external libaio.h.
Denys Vlasenko [Mon, 11 Nov 2013 11:50:47 +0000 (12:50 +0100)]
Stop using external libaio.h.

This change incorporates a partial copy instead
of using external libaio.h.
Why?
Because we want to properly decode 32-bit aio calls
by 64-bit strace. For that, we need more definitions than
libaio.h provides.
(These defs are not done yet, but will eventually be done).
Keeping our local 32-bit compat defs in sync with libaio.h
_without seeing libaio structs_ is hard/more bug prone.
A smaller benefit is that we don't need libaio installed.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agosys_io_submit: simplify iocb_cmd_lookup() helper.
Denys Vlasenko [Mon, 11 Nov 2013 11:31:18 +0000 (12:31 +0100)]
sys_io_submit: simplify iocb_cmd_lookup() helper.

This helper returns two values (a string and an enum).
The caller prints the string. It's simpler to just print
the string in the caller itself. This eliminates
"return by reference" and more importantly, an intermediate
static string buffer for the string result.

Since function of the helper is different now,
it is renamed to tprint_lio_opcode().

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agosys_io_submit: stop traversing iocb vector after first failure.
Denys Vlasenko [Mon, 11 Nov 2013 11:24:29 +0000 (12:24 +0100)]
sys_io_submit: stop traversing iocb vector after first failure.

The program may use a very large nr but supply either outright
invalid iocbpp[], or one with far fewer elements than nr.
We used to try reading iocbpp[i] until i == nr.
With this change, we stop on the first failure.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoFix pathtrace_match() to match recent fixes to select decoding.
Denys Vlasenko [Sat, 9 Nov 2013 19:46:55 +0000 (20:46 +0100)]
Fix pathtrace_match() to match recent fixes to select decoding.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoFix select decoding on e.g. 32-bit ppc process by 64-bit strace.
Denys Vlasenko [Sat, 9 Nov 2013 19:40:31 +0000 (20:40 +0100)]
Fix select decoding on e.g. 32-bit ppc process by 64-bit strace.

Added next_set_bit() function which finds the next set bit,
properly taking into account word size of the traced process.
Use it in decode_select() instead of fd_isset().
Also, properly round fdsize up to word size of traced process,
not to strace's word size.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoSpeed up and explain fd_isset()
Denys Vlasenko [Wed, 6 Nov 2013 10:34:02 +0000 (11:34 +0100)]
Speed up and explain fd_isset()

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoAdd a test for the latest select decoding fix
Dr. David Alan Gilbert [Tue, 5 Nov 2013 23:28:56 +0000 (23:28 +0000)]
Add a test for the latest select decoding fix

* test/select.c (main): Add a test for nfds larger than FD_SETSIZE.

11 years agoFix select decoding for glibc in _FORTIFY_SOURCE mode
Dmitry V. Levin [Tue, 5 Nov 2013 23:00:22 +0000 (23:00 +0000)]
Fix select decoding for glibc in _FORTIFY_SOURCE mode

glibc in _FORTIFY_SOURCE mode raises SIGABRT when descriptor greater
or equal to FD_SETSIZE is passed to FD_ISSET.  Select family syscalls,
however, can legitimately accept such descriptors.  To overcome this
limitation, we have to replace FD_ISSET with an equivalent that imposes
no such restrictions.

* desc.c (fd_isset): New function.
(decode_select): Use it instead of FD_ISSET.

11 years agoMore select decoding fixes
Dmitry V. Levin [Tue, 5 Nov 2013 22:46:43 +0000 (22:46 +0000)]
More select decoding fixes

* desc.c (decode_select): Actually print arg[0] as int on entering
syscall.  When arg[0] is negative, do not attempt to fetch and decode
descriptor sets on entering syscall, kernel will reject it anyway.
On exiting syscall, stop checking descriptor sets as soon as all
returned descriptors are found.

11 years agoTruncate arg[0] to int in select decoding.
Denys Vlasenko [Tue, 5 Nov 2013 15:20:16 +0000 (16:20 +0100)]
Truncate arg[0] to int in select decoding.

This matches kernel's behavior.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agotest/select.c: make comment more understandable.
Denys Vlasenko [Tue, 5 Nov 2013 11:44:55 +0000 (12:44 +0100)]
test/select.c: make comment more understandable.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoFix select decoding with bogus (huge or negative) nfds.
Dr. David Alan Gilbert [Tue, 5 Nov 2013 10:54:51 +0000 (11:54 +0100)]
Fix select decoding with bogus (huge or negative) nfds.

We used to allocate and fetch bit arrays using a sanitized
length, but then iterate over them with "j < arg[0]" condition,
where arg[0] is not sanitized. This segfaults if arg[0] is huge
or negative. This change fixes this.

Add test/select.c to capture the case.

Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoWork around conflict between <sys/ptrace.h> and <linux/ptrace.h>
Ali Polatel [Tue, 24 Sep 2013 17:04:32 +0000 (20:04 +0300)]
Work around conflict between <sys/ptrace.h> and <linux/ptrace.h>

Since glibc-2.18~39 <sys/ptrace.h> defines ptrace_peeksiginfo_args
which collides with <linux/ptrace.h>.

* configure.ac: Check for `struct ptrace_peeksiginfo_args' in
<sys/ptrace.h>.
* process.c: Work around potential conflict between <sys/ptrace.h>
and <linux/ptrace.h> by redefining ptrace_peeksiginfo_args.
* signal.c: Likewise.
* syscall.c: Likewise.
* util.c: Likewise.

Signed-off-by: Ali Polatel <alip@exherbo.org>
11 years agoAdd support for ARC Cores from Synopsys
Vineet Gupta [Fri, 16 Aug 2013 07:17:06 +0000 (12:47 +0530)]
Add support for ARC Cores from Synopsys

Take #2 on mainlining strace support for ARC (last one was 4.6 based back
in March 2011), see
http://sourceforge.net/p/strace/mailman/message/27210168/

The syscall ABI is asm-generic/unistd.h based (so no legacy syscalls),
hence very similar to metag port.

test/* all seem to work well.

* linux/arc/ioctlent.h.in: New file.
* linux/arc/syscallent.h: Likewise.
* Makefile.am (EXTRA_DIST): Add linux/arc/ioctlent.h.in and
linux/arc/syscallent.h.
* configure.ac: Add ARC to the list of supported architectures.
* defs.h: Add ARC support.
* process.c (struct_user_offsets): Likewise.
* signal.c (sys_sigreturn): Likewise.
* syscall.c (print_pc, get_regset, get_regs, get_scno, get_syscall_args,
get_syscall_result, get_error): Likewise.
* util.c (change_syscall): Likewise.

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
11 years agoAdd support for decoding sync_file_range
William Manley [Fri, 9 Aug 2013 17:04:11 +0000 (18:04 +0100)]
Add support for decoding sync_file_range

* file.c (sync_file_range_flags): New xlat structure.
(sys_sync_file_range, sys_sync_file_range2): New functions.
* linux/syscall.h (sys_sync_file_range, sys_sync_file_range2): New
prototypes.
* linux/dummy.h (sys_sync_file_range, sys_sync_file_range2): Remove.
* linux/mips/syscallent-o32.h: Set the number of sync_file_range
arguments to 7.

11 years agofanotify_mark: fix number of args for 32bit arches
Mike Frysinger [Mon, 19 Aug 2013 05:00:39 +0000 (01:00 -0400)]
fanotify_mark: fix number of args for 32bit arches

The fanotify_mark func takes a 64bit mask, so 32bit arches have to split
it up into two fields.  When the syscall was added, it was listed as only
having 5 fields total (since that's correct for 64bit systems).

* linux/arm/syscallent.h: Set the number of fanotify_mark arguments to 6.
* linux/bfin/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/metag/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/or1k/syscallent.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/tile/syscallent1.h: Likewise.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Chris Metcalf <cmetcalf@tilera.com> [for tile]
11 years agox86, x86_64: fix compilation warnings
Dmitry V. Levin [Wed, 11 Sep 2013 13:26:17 +0000 (13:26 +0000)]
x86, x86_64: fix compilation warnings

Fix "dereferencing type-punned pointer will break strict-aliasing rules"
warnings introduced by commit v4.8-52-gb51f364.

* signal.c (sys_sigreturn): Avoid dereferencing type-punned pointers.

11 years agoRemove rt parameter from [s]printsigmask()
Denys Vlasenko [Thu, 18 Jul 2013 18:42:41 +0000 (20:42 +0200)]
Remove rt parameter from [s]printsigmask()

In almost all cases, the parameter was 1 ("decode RT sigs too").
This change hardwires it to be 1.

The cases where it was 0 are, and why the change to "decode RT sigs too"
is fine:

IA64: 64-bit arch, all 64 signals fit in one word in any case.
S390[x]: sc.oldmask is a sigset_t on kernel side,
(sigset_t *)&sc.oldmask[0] does contain all 64 signals.
TILE: uc.uc_sigmask is a sigset_t on kernel side,
memcpy(&sigm, &uc.uc_sigmask, NSIG / 8) copies all 64 signals.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoConvert some uses of long_to_sigmask+printsigmask to sprintsigmask_long
Denys Vlasenko [Thu, 18 Jul 2013 18:37:06 +0000 (20:37 +0200)]
Convert some uses of long_to_sigmask+printsigmask to sprintsigmask_long

This allows to drop long_to_sigmask function,
and a whole bunch of sigset_t variables.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoSimplify some sigmask manipulations
Denys Vlasenko [Thu, 18 Jul 2013 18:12:33 +0000 (20:12 +0200)]
Simplify some sigmask manipulations

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoAdd compat support for sys_pselect6
Denys Vlasenko [Thu, 18 Jul 2013 16:10:13 +0000 (18:10 +0200)]
Add compat support for sys_pselect6

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoI386: fix signedness mismatch warning
Denys Vlasenko [Thu, 18 Jul 2013 15:40:45 +0000 (17:40 +0200)]
I386: fix signedness mismatch warning

&i386_regs.esp is a pointer to long, not unsigned long.
It needs a cast.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoFix sigset printing via print_sigset().
Denys Vlasenko [Thu, 18 Jul 2013 15:02:21 +0000 (17:02 +0200)]
Fix sigset printing via print_sigset().

Replace print_sigset() with print_sigset_addr_len(),
which takes not only addr, but also len parameter.
This allows us to drop "do we need to print RT signals?" parameter,
and this fixes RT signals printing in many syscalls.

sys_epoll_pwait: print RT signals too, print sigmask size argument.

sys_sigprocmask: print_sigset -> print_sigset_addr_len(current_wordsize),
no change in functionality.

sys_sigpending: use print_sigset_addr_len(current_wordsize)
instead of open-coding it.

sys_rt_sigprocmask: use print_sigset_addr_len instead of open-coding it.
sys_rt_sigpending: ditto.
sys_rt_sigsuspend: ditto.
sys_rt_sigtimedwait: ditto.

do_signalfd: print_sigset -> print_sigset_addr_len. This fixes
RT signals printing (wasn't showing them before).

sys_ppoll: ditto.

copy_sigset_len() is folded into its only user, print_sigset_addr_len(),
and copy_sigset() is gone.

While at it, checked kernel sources and noted where kernel enforces
sigset_size == NSIG / 8 (== sizeof(kernel_sigset_t)),
and where it allows word-sized sigset_size ([rt_]sigpending).

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agosys_rt_sigaction: fix sigset copying
Denys Vlasenko [Thu, 18 Jul 2013 08:10:46 +0000 (10:10 +0200)]
sys_rt_sigaction: fix sigset copying

In practice, we always copy as many bytes as syscall param says
(8, or 16 on mips). However, malicious program can call sigaction
with wrong sigset size. Such syscall will result in EINVAL,
but we (strace) end up copying 128 bytes (sizeof(sigset_t)),
which copyes some garbage from stack after struct sigaction.

Now we always copy NSIG / 8 bytes (which is 8 bytes, or 16 on mips).

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoARM: remove wrong NSIG = 32 define
Denys Vlasenko [Thu, 18 Jul 2013 07:41:20 +0000 (09:41 +0200)]
ARM: remove wrong NSIG = 32 define

ARM in fact has 64 signals (1..64), and NSIG should be 65
(as usual, rememebr that NSIG_libc == NSIG_kernel+1).

I carefully reviewed all usages of NSIG. In syscall.c,
the only usage is:
        for (i = 0; i <= NSIG; i++)
                if (strcasecmp(s, signame(i) + 3) == 0)...
which is safe even if NSIG is way too big - signame(i)
returns a well-formed string for any i.

In signal.c, memcpy(&sigset, &sc.sc_mask, NSIG / 8) is used by
IA64 and TILE code, so ARM change can't affect it. And final
usage is:
 struct new_sigaction::unsigned long sa_mask[NSIG / sizeof(long)];
It will grow on ARM (and become correct in the process).
Its only use is
 memcpy(&sigset, &sa.sa_mask, NSIG / 8);
 printsigmask(&sigset, 1);
which used to copy garbage in high bits, now it will copy actual data.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoARM: fix sigreturn decoding
Denys Vlasenko [Wed, 17 Jul 2013 15:26:56 +0000 (17:26 +0200)]
ARM: fix sigreturn decoding

Decoding of test/sigreturn testcase:
Was:
sigreturn() (mask [QUIT TRAP ABRT BUS SEGV USR2 PIPE STKFLT STOP XCPU VTALRM PROF WINCH IO PWR RTMIN]) = 0
Now:
sigreturn() (mask [CHLD RT_1 RT_3 RT_31 RT_32]) = 0

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoGroup USE_CUSTOM_PRINTF define with other tweakables
Denys Vlasenko [Tue, 16 Jul 2013 10:18:59 +0000 (12:18 +0200)]
Group USE_CUSTOM_PRINTF define with other tweakables

No code changes.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoImprove sigreturn decoding on x86 to show RT signal bits too.
Denys Vlasenko [Tue, 16 Jul 2013 10:06:25 +0000 (12:06 +0200)]
Improve sigreturn decoding on x86 to show RT signal bits too.

This includes decoding of 32-bit sigreturn by 64-bit strace,
which previously wasn't done.

Added a test for it.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agopowerpc: enhance 32/64bit detection
Anton Blanchard [Thu, 11 Jul 2013 02:03:57 +0000 (12:03 +1000)]
powerpc: enhance 32/64bit detection

We were using uname to determine if userspace was 32 or 64bit.
This fails when we have a 64bit kernel and a 32bit userspace.

* configure.ac (powerpc*): Similar to x86, use a runtime test
to determine if we are 32 or 64bit.

Signed-off-by: Anton Blanchard <anton@samba.org>
11 years agopowerpc: fix some compiler warnings
Anton Blanchard [Fri, 12 Jul 2013 10:24:02 +0000 (12:24 +0200)]
powerpc: fix some compiler warnings

Fix a number of differing signedness warnings when building on
powerpc.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agopowerpc: fix iflag build issue (static -> extern)
Anton Blanchard [Fri, 12 Jul 2013 10:22:06 +0000 (12:22 +0200)]
powerpc: fix iflag build issue (static -> extern)

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoPTRACE_SEIZE can set ptrace options immediately, use this feature
Denys Vlasenko [Wed, 10 Jul 2013 12:33:05 +0000 (14:33 +0200)]
PTRACE_SEIZE can set ptrace options immediately, use this feature

This eliminates some rare bugs, such as post-execve SIGTRAP
generation when we attach to a process, and it manages to finish
execve'ing before we set TRACEEXEC option to suppress that.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoIf -o|logger is in use, exit trace loop if nprocs == 0.
Denys Vlasenko [Mon, 8 Jul 2013 11:55:04 +0000 (13:55 +0200)]
If -o|logger is in use, exit trace loop if nprocs == 0.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoExit trace loop if got ECHILD, not if nprocs == 0.
Denys Vlasenko [Mon, 8 Jul 2013 09:28:27 +0000 (11:28 +0200)]
Exit trace loop if got ECHILD, not if nprocs == 0.

Comment gives a testcase which wasn't handled correctly
by the old code.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agos390[x]: get rid of syscall_mode, delete code which never triggers
Denys Vlasenko [Sun, 7 Jul 2013 10:47:39 +0000 (12:47 +0200)]
s390[x]: get rid of syscall_mode, delete code which never triggers

Before this change, the logic was as follows:
syscall entry:
  get_scno:
    syscall_mode = GPR2
    scno = syscall_mode unless syscall_mode == -ENOSYS
    (if -ENOSYS, scn is retrieved by decoding current insn)
  fixup:
    gpr2 = GPR2
    syscall_mode = scno unless syscall_mode == -ENOSYS
    if (gpr2 != syscall_mode) stray_entry
syscall exit:
  get_res:
    gpr2 = GRP2
  fixup:
    syscall_mode = scno unless syscall_mode == -ENOSYS
    if (WAITEXECVE && gpr2 in (-ENOSYS, scno)) gpr2 = 0;
  get_error:
    gpr2 is retval

Entry fixup's if() can never trigger:
regardless whether GPR2 is -ENOSYS or not, syscall_mode is always
equal to GRP2 value there. So it can be removed.

On sysexit path, syscall mode is never used.

Therefore, syscall_mode variable is deleted. grp2 is read from
GPR2 register in get_scno, redundant read in entry fixup is removed.
As a result, entry fixup's s390 code block vanishes completely.

gpr2 variable is renamed s390_gpr2 to match the convention used
by other arches.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoARM: add STRACE_KNOWS_ONLY_EABI define which can be used to omit OABI support
Denys Vlasenko [Thu, 4 Jul 2013 07:54:19 +0000 (09:54 +0200)]
ARM: add STRACE_KNOWS_ONLY_EABI define which can be used to omit OABI support

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoAdd paranoia check before passing a long to pid2tcb(int pid)
Denys Vlasenko [Thu, 4 Jul 2013 07:26:24 +0000 (09:26 +0200)]
Add paranoia check before passing a long to pid2tcb(int pid)

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoIn debug output, show waitpid status with 6 hex digits, not 4
Denys Vlasenko [Tue, 2 Jul 2013 10:18:22 +0000 (12:18 +0200)]
In debug output, show waitpid status with 6 hex digits, not 4

This shows event byte values better (without variable offset):

 [wait(0x01057f) = 29491] WIFSTOPPED,sig=SIGTRAP,EVENT_FORK (1)
 [wait(0x80057f) = 29492] WIFSTOPPED,sig=SIGTRAP,EVENT_STOP (128)
         ^^

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoReplace suspicious popen_pid assignment with an obviously correct one
Denys Vlasenko [Tue, 2 Jul 2013 09:31:24 +0000 (11:31 +0200)]
Replace suspicious popen_pid assignment with an obviously correct one

popen_pid = vfork() does work correctly, but for a subtle reason
that wrong assignment of 0 happens in the child _first_,
and _then_ correct value overwrites it in the parent.

(And in a hyphothetical system where vfork = fork,
popen_pid wouldn't be shared, so it will also be ok.)

However, it's not necessary to be difficult.
This change makes it so that assignment is done only in parent.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoConvert trace() from returning int to returning void
Denys Vlasenko [Mon, 1 Jul 2013 11:02:33 +0000 (13:02 +0200)]
Convert trace() from returning int to returning void

The cleanup sequence in error cases, and on normal code path
was nearly the same, no point in duplicating it.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoRemove ia64-specific printing of current address on signal delivery
Denys Vlasenko [Mon, 1 Jul 2013 10:49:14 +0000 (12:49 +0200)]
Remove ia64-specific printing of current address on signal delivery

The address is printed anyway by printleader() if -i is active.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoRename ia32 to ia64_ia32mode, and make it bool, not long
Denys Vlasenko [Mon, 1 Jul 2013 10:28:17 +0000 (12:28 +0200)]
Rename ia32 to ia64_ia32mode, and make it bool, not long

Grepping for just ia32 was turning up many false positives.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoFold is_restart_error() into its sole user
Denys Vlasenko [Sun, 30 Jun 2013 21:53:49 +0000 (23:53 +0200)]
Fold is_restart_error() into its sole user

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoUpdate qemu_multiarch_testing/README
Denys Vlasenko [Sat, 29 Jun 2013 12:34:48 +0000 (14:34 +0200)]
Update qemu_multiarch_testing/README

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agosys_clone: add a comment about CLONE_PTRACE and CLONE_UNTRACED
Denys Vlasenko [Fri, 28 Jun 2013 16:57:27 +0000 (18:57 +0200)]
sys_clone: add a comment about CLONE_PTRACE and CLONE_UNTRACED

No code changes.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoPOWERPC: get rid of "static long ppc_result"
Denys Vlasenko [Fri, 28 Jun 2013 14:47:38 +0000 (16:47 +0200)]
POWERPC: get rid of "static long ppc_result"

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoPOWERPC: read ppc_regs.nip if -i
Denys Vlasenko [Fri, 28 Jun 2013 12:51:50 +0000 (14:51 +0200)]
POWERPC: read ppc_regs.nip if -i

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoPOWERPC: if GETREGS fails with EIO, don't try it again
Denys Vlasenko [Fri, 28 Jun 2013 12:41:30 +0000 (14:41 +0200)]
POWERPC: if GETREGS fails with EIO, don't try it again

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoGet rid of powerpc_getreg(), it's a copy of upeek()
Denys Vlasenko [Fri, 28 Jun 2013 12:36:39 +0000 (14:36 +0200)]
Get rid of powerpc_getreg(), it's a copy of upeek()

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoChange upeek() to take pid, not full tcp.
Denys Vlasenko [Fri, 28 Jun 2013 12:35:47 +0000 (14:35 +0200)]
Change upeek() to take pid, not full tcp.

This will be used by next change.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agopowerpc: Provide a fallback for old kernels without PTRACE_GETREGS
Anton Blanchard [Wed, 26 Jun 2013 04:42:37 +0000 (14:42 +1000)]
powerpc: Provide a fallback for old kernels without PTRACE_GETREGS

PTRACE_GETREGS was added to the ppc kernel in 2.6.23. In order to
provide backward compatibility for very old kernels, add a manual
fallback.

* syscall.c (powerpc_getreg, powerpc_getregs_old): New functions.
(get_regs): Call powerpc_getregs_old if PTRACE_GETREGS is not supported.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agopowerpc: Use PTRACE_GETREGS to fetch all registers
Anton Blanchard [Wed, 26 Jun 2013 13:53:33 +0000 (15:53 +0200)]
powerpc: Use PTRACE_GETREGS to fetch all registers

* defs.h: declare ppc_regs and get_regs_error.
* signal.c (sys_sigreturn): Use ppc_regs instead of upeek.
* syscall.c: define ppc_regs.
(printcall): Use ppc_regs instead of upeek.
(get_scno): Replace multiple upeek calls with one PTRACE_GETREGS call.
(get_syscall_result): Likewise.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoAnother manpage tweak
Denys Vlasenko [Wed, 26 Jun 2013 13:40:13 +0000 (15:40 +0200)]
Another manpage tweak

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoManpage update
Denys Vlasenko [Wed, 26 Jun 2013 13:35:16 +0000 (15:35 +0200)]
Manpage update

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoUpdate build_static_example.sh
Denys Vlasenko [Wed, 26 Jun 2013 13:07:23 +0000 (15:07 +0200)]
Update build_static_example.sh

Now it also contains a tested example of i686 build on 64-bit host.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoIn -f mode, do not assume that new pid is stopped - handle exits too
Denys Vlasenko [Wed, 26 Jun 2013 12:29:19 +0000 (14:29 +0200)]
In -f mode, do not assume that new pid is stopped - handle exits too

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoSet strace_child only in the right branch
Denys Vlasenko [Wed, 26 Jun 2013 12:27:11 +0000 (14:27 +0200)]
Set strace_child only in the right branch

"strace_child = pid" assignment was racing in NOMMU case
because of vfork (no way to know which process would win).

After this change, strace_child is set to nonzero only
in one process after [v]fork.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoGet rid of TCB_INUSE and TCB_STRACE_CHILD
Denys Vlasenko [Wed, 26 Jun 2013 12:14:29 +0000 (14:14 +0200)]
Get rid of TCB_INUSE and TCB_STRACE_CHILD

We can use tcb::pid == 0 as an indicator of free tcb,
and we already have strace_child variable which holds
pid of our child, if any.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoFix debug output of wait4 result (was reusing buf[] on unknown events)
Denys Vlasenko [Fri, 21 Jun 2013 14:41:50 +0000 (16:41 +0200)]
Fix debug output of wait4 result (was reusing buf[] on unknown events)

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
11 years agoShow PTRACE_EVENT_STOP correctly in debug output
Denys Vlasenko [Fri, 21 Jun 2013 14:33:56 +0000 (16:33 +0200)]
Show PTRACE_EVENT_STOP correctly in debug output

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>