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

Dmitry V. Levin ldv at altlinux.org
Mon Mar 30 15:38:25 UTC 2015


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",

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


More information about the Strace-devel mailing list