Bug 224131

Summary: No zero holes for PTRACE_PEEKUSR/PTRACE_POKEUSR?
Product: Red Hat Enterprise Linux 5 Reporter: Alexey Dobriyan <adobriyan>
Component: kernelAssignee: Roland McGrath <roland>
Status: CLOSED ERRATA QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.0CC: dzickus, petrides
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2007-0959 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-11-07 19:21:59 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Third segment in i386_uarea none

Description Alexey Dobriyan 2007-01-24 11:15:03 UTC
I wonder why "i386_uarea" array contains only two segments?

arch/i386/kernel/ptrace.c:
   735	static const struct ptrace_layout_segment i386_uarea[] = {
   736		{0, FRAME_SIZE*4, 0, 0},
   737		{offsetof(struct user, u_debugreg[0]),
   738		 offsetof(struct user, u_debugreg[8]), 4, 0},
   739		{0, 0, -1, 0}
   740	};

If ptrace is ptrace, ptrace(PTRACE_PEEKUSR, addr, ...) would return 0 for
accesses in hole. If ptrace is utrace it would return -EIO, for same accesses.

strace(1) notices this when seeing unknown syscall. On i386 it checks MAX_ARGS
(32) args, and gets -EIO on 17-th:

syscall.c:
  2161	if (tcp->scno >= 0 && tcp->scno < nsyscalls && sysent[tcp->scno].nargs != -1)
  2162		tcp->u_nargs = sysent[tcp->scno].nargs;
  2163	else
  2164	  	tcp->u_nargs = MAX_ARGS;
  2165	for (i = 0; i < tcp->u_nargs; i++) {
  2166		if (upeek(pid, i*4, &tcp->u_arg[i]) < 0)
  2167			return -1;
  2168	}

Comment 1 Alexey Dobriyan 2007-01-24 11:15:04 UTC
Created attachment 146399 [details]
Third segment in i386_uarea

Comment 2 Ernie Petrides 2007-09-05 21:02:01 UTC
Don, this problem was fixed in linux-2.6-misc-utrace-update.patch (in the
RHEL-5 CVS repo).  I couldn't find the corresponding patch tracking file.

Please add this BZ to the RHEL5.1 advisory.

Comment 5 errata-xmlrpc 2007-11-07 19:21:59 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2007-0959.html