Regression: strace >=4.8 does not show filenames when tracing `man`

Andrew Guertin lists at dolphinling.net
Tue Mar 31 10:31:52 UTC 2015


On 03/30/2015 11:38 AM, Dmitry V. Levin wrote:
> On Mon, Mar 30, 2015 at 01:02:12PM +0300, Dmitry V. Levin wrote:
>> On Sun, Mar 29, 2015 at 10:37:33PM -0400, Andrew Guertin wrote:
>>> When running the command
>>>     `strace -e trace=file man`
>>> I don't get filenames in the output. For all other executables I've
>>> tried, strace works fine. Only man has problems.
>>
>> I suppose /usr/bin/man is installed as a privileged executable in your
>> system, and process_vm_readv syscall fails.
>
> This patch workarounds this issue, which is definitely a kernel bug.
>
> --- a/util.c
> +++ b/util.c
> @@ -1003,10 +1003,13 @@ umoven(struct tcb *tcp, long addr, unsigned int len, void *our_addr)
>   			case ENOSYS:
>   				process_vm_readv_not_supported = 1;
>   				break;
> +			case EPERM:
> +				/* operation not permitted, try PTRACE_PEEKDATA */
> +				break;
>   			case ESRCH:
>   				/* the process is gone */
>   				return -1;
> -			case EFAULT: case EIO: case EPERM:
> +			case EFAULT: case EIO:
>   				/* address space is inaccessible */
>   				return -1;
>   			default:
> @@ -1158,7 +1161,12 @@ umovestr(struct tcb *tcp, long addr, unsigned int len, char *laddr)
>   				case ESRCH:
>   					/* the process is gone */
>   					return -1;
> -				case EFAULT: case EIO: case EPERM:
> +				case EPERM:
> +					/* operation not permitted, try PTRACE_PEEKDATA */
> +					if (!nread)
> +						goto vm_readv_didnt_work;
> +					/* fall through */
> +				case EFAULT: case EIO:
>   					/* address space is inaccessible */
>   					if (nread) {
>   						perror_msg("umovestr: short read (%d < %d) @0x%lx",

Tested this and it works great! Thanks!

--Andrew




More information about the Strace-devel mailing list