[PATCH v3 2/3] The -z and -Z options print only successful and failing syscalls respectively. However, failure of syscall is only known after syscall return. Thus, we end up with something like this on, e.g., ENOENT:

Dmitry V. Levin ldv at altlinux.org
Wed May 22 08:57:09 UTC 2019


On Wed, May 22, 2019 at 10:12:35AM +0200, Paul Chaignon wrote:
> Thanks for the review!  I'll be sending the v4.
> 
> On Wed, May 22, 2019 at 05:23AM, Dmitry V. Levin wrote:
> > On Thu, Apr 25, 2019 at 04:22:36PM +0200, burkhard.kohl at intel.com wrote:
> > [...]
> > > @@ -753,6 +757,15 @@ syscall_exiting_trace(struct tcb *tcp, struct timespec *ts, int res)
> > >  	if (raw(tcp)) {
> > >  		/* sys_res = printargs(tcp); - but it's nop on sysexit */
> > >  	} else {
> > 
> > This doesn't look correct: -z/-Z should apply to raw(tcp) case as well.
> > 
> > > +#if HAVE_OPEN_MEMSTREAM
> > > +		if ((not_failing_only && syserror(tcp)) ||
> > > +			(failing_only && !syserror(tcp))) {
> > > +			line_ended();
> > > +			strace_close_memstream(tcp, true);
> > > +			return 0;   /* ignore failed/successful
> > > +						 * syscalls */
> > > +		}
> > > +#else
> > >  	/* FIXME: not_failing_only (IOW, option -z) is broken:
> > >  	 * failure of syscall is known only after syscall return.
> > >  	 * Thus we end up with something like this on, say, ENOENT:
> > 
> > I suggest to reject -z/-Z options when open_memstream is not available
> > and remove all !HAVE_OPEN_MEMSTREAM code.
> 
> Are you suggesting we keep the new "struct tcb" fields regardless of
> whether open_memstream is available and they are actually used?

I did not suggest that, but I think you are right: it has little use
to keep it under HAVE_OPEN_MEMSTREAM guard because most systems provide
open_memstream and !HAVE_OPEN_MEMSTREAM case is not going to be tested.

> Should we still expose and document the -z/-Z options when open_memstream
> is not available (and error on any actual usage)?  That seems clearer for
> the users.

Yes, let's just issue an error in !HAVE_OPEN_MEMSTREAM case when these
options are actually used.


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20190522/5af29b4f/attachment.bin>


More information about the Strace-devel mailing list