[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

user/994: gdb: setgid() causes SIGTRAP




>Number:         994
>Category:       user
>Synopsis:       gdb: setgid() causes SIGTRAP
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Nov 27 13:00:02 MST 1999
>Last-Modified:
>Originator:     Claus Assmann
>Organization:
endmail.ORG
>Release:        GNU gdb 4.16.1
>Environment:
	System      : OpenBSD 2.5 (and 2.6 snapshot)
	Architecture: OpenBSD.i386
	Machine     : i386
>Description:
	using gdb to debug a program that uses setgid(gid_of_caller)
	causes a SIGTRAP.
>How-To-Repeat:
Here is a simple program which causes the problem:

#include <stdio.h>
main(int argc, char *argv[])
{
  int r;
  gid_t i;

  i = getgid();
  r = setgid(i);
  exit(r);
}

To reproduce the problem:
$ cc -g t.c
$ gdb ./a.out
(gdb) break main
Breakpoint 1 at 0x17a3: file t.c, line 8.
(gdb) run
Starting program: /tmp/./a.out 

Breakpoint 1, main (argc=1, argv=0xdfbfda10) at t.c:8
8         i = getgid();
(gdb) n
9         r = setgid(i);
(gdb) n

Program received signal SIGTRAP, Trace/breakpoint trap.


This problem occurs on my laptop running OpenBSD 2.5 and
my desktop machine running 2.6 snapshot (1999-10-29).

>Fix:
	Sorry, not known...
PS: this has also been mailed to openbsd-misc before I found
out that it can be reproduced on a stock 2.5 system.

>Audit-Trail:
>Unformatted: