Bug 198724

Summary: PTRACE_[SG]ET_THREAD_AREA not supported by sys_ptrace32 on kernel.x86_64
Product: [Fedora] Fedora Reporter: Alexandre Oliva <oliva>
Component: kernelAssignee: Kernel Maintainer List <kernel-maint>
Status: CLOSED ERRATA QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: wtogami
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-11-07 01:15:41 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:

Description Alexandre Oliva 2006-07-13 05:19:19 UTC
Description of problem:
The 32-bit libthread_db included in the latest glibc breaks 32-bit gdb running
on a 64-bit kernel.  At first I thought it was something broken in the new gdb,
but then I took gdb-6.3.0.0-1.122.i386 from FC5 and a threaded program built on
FC5 and tried it on rawhide/x86_64, and the symptom is the same as using the
latest gdb.i386 on rawhide/x86_64:

[Thread debugging using libthread_db enabled]
Error while reading shared library symbols:
Cannot find new threads: generic error
Cannot find user-level thread for LWP 19788: generic error

The problem is that td_ta_thr_iter_p() returns 1 instead of 0, for some reason I
haven't tried to figure out yet.

gdb.x86_64 works perfectly well, and the latest gdb.i386 works perfectly on
rawhide/i386, on kernel.i686.

Version-Release number of selected component (if applicable):
glibc-2.4.90-13.i686
kernel-2.6.17-1.2364.fc6, and also whatever kernel runs on the brew i386 build
machines, which is how I know it is not a kernel problem.  I can tell from the
failures that it is an x86_64 kernel.

How reproducible:
Every time

Steps to Reproduce:
1.Install gdb.i386 on x86_64 rawhide
2.Try to debug any 32-bit threaded program, setting a breakpoint in main

Actual results:
See above

Expected results:
It should not fail

Additional info:

Comment 1 Jakub Jelinek 2006-07-13 12:19:48 UTC
32-bit gdb ever worked on 64-bit x86-64 kernel?  That's news for me.

Comment 2 Alexandre Oliva 2006-07-13 18:46:11 UTC
Yes, I have used it in the not-too-distant past, even to debug multi-threaded
programs and to run its testsuite.

Comment 3 Alexandre Oliva 2006-07-13 22:53:48 UTC
And I've just verified that it works on FC5/x86_64 with all updates and testing
updates as of yesterday.

Comment 4 Alexandre Oliva 2006-07-14 05:04:38 UTC
Sorry, false alarm, it's not in glibc, it's in the kernel.  sys_ptrace32
regressed in this regard between the FC5 kernel and the rawhide kernel, in that
the latter no longer handles PTRACE_[SG]ET_THREAD_AREA.  I don't quite see that
the handling in the FC5 kernel is entirely correct, but, oddly enough, it
appears to work.  Anyhow, this makes it a kernel bug, and apparently a
regression while at that.

Comment 5 Chuck Ebbert 2007-11-07 01:15:41 UTC
Fixed upstream in Nov 2006.