Bug 123514 - gdb has issues when tracing program from execve'd shell
gdb has issues when tracing program from execve'd shell
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: gdb (Show other bugs)
3.0
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Alexandre Oliva
Jay Turner
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-05-18 19:14 EDT by James Bourne
Modified: 2015-01-07 19:07 EST (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-12-30 07:59:19 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)
output from typescript and strace, sample program (32.82 KB, application/x-tar)
2004-05-18 19:16 EDT, James Bourne
no flags Details
shell wrapper RPMs (source and binary) (40.00 KB, application/octet-stream)
2004-05-18 19:18 EDT, James Bourne
no flags Details

  None (edit)
Description James Bourne 2004-05-18 19:14:56 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.2)
Gecko/20040301

Description of problem:
Background:
We use a shell wrapper written in house called stdsh which is a
standard shell that wraps the user shell.  This is utilized to allow
students and staff to have remapped shells on various O/S (/bin/bash
on Linux or /usr/ucb/bash on solaris for example) and to also change
shells based on the application (/bin/noax for example on an ftponly
server).  Additional info is that we use LDAP for centralized storage
of shell, homedir, and authentication info.

Issue:
When we run gdb from inside the execve'd shell on a simple test
program (hello world) gdb will ignore break points and will output 7
(always):
Detaching after fork from child process 30570.

(30570 of course being the pid of the child).

This issue started after the ptrace patch was released in 2.4.20
(March 17th approximately).  The original incantation of the patch
would not allow any tracing, after that execv had issue with ptraced
processes.

I will attach the sample files (in a tar.gz) including typescript of
the session, test program, and output from an strace -f of the gdb
session.  I will also attach the rpm and srpm for stdsh (our shell
wrapper).


Version-Release number of selected component (if applicable):
gdb-6.0post-0.20040223.20

How reproducible:
Always

Steps to Reproduce:
1.log in using stdsh and exec'ing /bin/bash
2.compile bar
3.execute gdb bar
4. set a break point (break main)
5. run bar 


Actual Results:  (gdb) break main
Breakpoint 1 at 0x8048388: file bar.c, line 6.
(gdb) run
Starting program: /users/testadm/bar 
Detaching after fork from child process 31034.
Detaching after fork from child process 31035.
Detaching after fork from child process 31038.
Detaching after fork from child process 31041.
Detaching after fork from child process 31044.
Detaching after fork from child process 31048.
Detaching after fork from child process 31049.
Tue May 18 17:05:26 MDT 2004
Hello world

Program exited normally.
(gdb) quit


Expected Results:  (gdb) break main
Breakpoint 1 at 0x8048388: file bar.c, line 6.
(gdb) run
Starting program: /users/jbourne/bar 

Breakpoint 1, main (argc=1, argv=0xbfffc0c4) at bar.c:6
6               printf("Hello world\n");
(gdb) continue
Continuing.
Hello world

Program exited normally.
(gdb) 


Additional info:

please see files attached to this ticket.
Comment 1 James Bourne 2004-05-18 19:16:22 EDT
Created attachment 100313 [details]
output from typescript and strace, sample program
Comment 2 James Bourne 2004-05-18 19:18:18 EDT
Created attachment 100314 [details]
shell wrapper RPMs (source and binary)
Comment 3 Jan Kratochvil 2006-12-30 07:59:19 EST
`stdsh-0.02.rc2-2.mrc.1.src' does not properly set $SHELL, it does not even set
properly argv[0].  Such execution environment is broken for many applications,
not only gdb(1).  Please fix `stdsh' instead.

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