[PATCH] Path decoding for system calls that return file descriptors implemented.

Zubin Mithra zubin.mithra at gmail.com
Tue May 27 01:02:29 UTC 2014


Hi Dmitry,

On Tue, May 27, 2014 at 4:53 AM, Dmitry V. Levin <ldv at altlinux.org> wrote:
> Hi Zubin,
>
> On Mon, May 26, 2014 at 10:18:11PM +0530, zubin.mithra at gmail.com wrote:
>> From: eQuiNoX__ <equinox.71717171 at gmail.com>
>
> Could you choose one of your names for use in git commits and stick with
> it, at least for the length of this GSoC, please?  This could be done
> e.g. by setting user.name and user.email with git-config(1).

Sure thing, I'll change that.

>
>> Subject: [PATCH] Path decoding for system calls that return file descriptors implemented.
>
> Please try to make summary lines not longer than 72 characters, e.g.
>         Decode paths associated with file descriptors returned by syscalls
> Also, please omit the trailing dot from summary lines.

Will do.

>
>> * Type of `show_fd_path` changed from `bool` to `unsigned int` to
>>   support the `-yy` flag
>
> Why do you want to decode returned descriptors only for -yy?
> Backwards compatibility?

Yes, that is what I had in mind. "-y" would behave as it always had,
while "-yy" would have decoding of return fds, path resolution of
arguments etc.

>
>> * util.c (returns_fd): New function that checks if the tcb refers
>>   to a function that returns a file descriptor
>> * `trace_syscall_exiting` now uses `returns_fd` to determine if
>>   `tcp->u_rval` needs to be passed to `printfd`
>
> (trace_syscall_exiting): Use returns_fd to determine whether tcp->u_rval
> is a file descriptor.
>
>> --- a/syscall.c
>> +++ b/syscall.c
>> @@ -2669,7 +2669,12 @@ trace_syscall_exiting(struct tcb *tcp)
>>                               tprintf("= %lu", tcp->u_rval);
>>                               break;
>>                       case RVAL_DECIMAL:
>> -                             tprintf("= %ld", tcp->u_rval);
>> +                             if ( show_fd_path == 2 && returns_fd(tcp) ) {
>
> What if show_fd_path > 2?

According to the current implementation, it would behave as if a "-y"
had been performed. The fd returned would not be decoded.
Calls to printfd would behave as they normally would(if a "-y" had been used).

Thank you for the review! I'll submit a patch today.


-- zm




More information about the Strace-devel mailing list