Bug 224131 - No zero holes for PTRACE_PEEKUSR/PTRACE_POKEUSR?
No zero holes for PTRACE_PEEKUSR/PTRACE_POKEUSR?
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: kernel (Show other bugs)
5.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Roland McGrath
Brian Brock
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-01-24 06:15 EST by Alexey Dobriyan
Modified: 2007-11-30 17:07 EST (History)
2 users (show)

See Also:
Fixed In Version: RHBA-2007-0959
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-11-07 14:21:59 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Third segment in i386_uarea (400 bytes, patch)
2007-01-24 06:15 EST, Alexey Dobriyan
no flags Details | Diff

  None (edit)
Description Alexey Dobriyan 2007-01-24 06:15:03 EST
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 06:15:04 EST
Created attachment 146399 [details]
Third segment in i386_uarea
Comment 2 Ernie Petrides 2007-09-05 17:02:01 EDT
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 14:21:59 EST
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

Note You need to log in before you can comment on or make changes to this bug.