[PATCH v2 3/6] Collect finfo just before decoding ioctl command

Dmitry V. Levin ldv at altlinux.org
Sat Mar 12 15:28:29 UTC 2022


On Sat, Mar 12, 2022 at 03:02:06AM +0900, Masatake YAMATO wrote:
[...]
> diff --git a/src/ioctl.c b/src/ioctl.c
> index 8173bdc6b..0f9f0c9a9 100644
> --- a/src/ioctl.c
> +++ b/src/ioctl.c
> @@ -432,7 +432,12 @@ SYS_FUNC(ioctl)
>  	int ret;
>  
>  	if (entering(tcp)) {
> -		printfd(tcp, tcp->u_arg[0]);
> +		struct finfo finfoa;
> +		struct finfo *finfo = NULL;
> +		char path[PATH_MAX + 1];
> +		if (getfdpath_pid(tcp->pid, tcp->u_arg[0], path, sizeof(path)) >= 0)
> +			finfo = get_finfo_for_dev(path, &finfoa);
> +		printfd_with_finfo(tcp, tcp->u_arg[0], finfo);

If getfdpath_pid failed, could we forward this information to
printfd_with_finfo so that it wouldn't try to call getfdpath_pid again?


-- 
ldv


More information about the Strace-devel mailing list