[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:
Paul Chaignon
paul.chaignon at gmail.com
Wed May 22 09:05:15 UTC 2019
On Wed, May 22, 2019 at 11:57AM, Dmitry V. Levin wrote:
> 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.
And if we keep the fields under HAVE_OPEN_MEMSTREAM guard, but not the
code using them, it's not going to compile. That's why I thought you were
suggesting this.
>
> > 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
More information about the Strace-devel
mailing list