Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 224131 - No zero holes for PTRACE_PEEKUSR/PTRACE_POKEUSR?
Summary: No zero holes for PTRACE_PEEKUSR/PTRACE_POKEUSR?
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: kernel
Version: 5.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
: ---
Assignee: Roland McGrath
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-01-24 11:15 UTC by Alexey Dobriyan
Modified: 2007-11-30 22:07 UTC (History)
2 users (show)

Fixed In Version: RHBA-2007-0959
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2007-11-07 19:21:59 UTC


Attachments (Terms of Use)
Third segment in i386_uarea (deleted)
2007-01-24 11:15 UTC, Alexey Dobriyan
no flags Details | Diff


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2007:0959 normal SHIPPED_LIVE Updated kernel packages for Red Hat Enterprise Linux 5 Update 1 2007-11-08 00:47:37 UTC

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



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