Date: Fri, 2 May 1997 16:05:21 -0700 (PDT) From: Bruce Cole <cole@jnx.com> To: FreeBSD-gnats-submit@FreeBSD.ORG Cc: cole@jnx.com Subject: kern/3475: gdb(ptrace?) cause create/modify times on executable to change Message-ID: <199705022305.QAA12475@dakine.jnx.com> Resent-Message-ID: <199705022310.QAA29260@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 3475
>Category: kern
>Synopsis: gdb(ptrace?) cause create/modify times on executable to change
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Fri May 2 16:10:02 PDT 1997
>Last-Modified:
>Originator: Bruce Cole
>Organization:
Juniper Networks
>Release: FreeBSD 2.200-Juniper i386
>Environment:
Problem is seen on kernels based upon 2.2.1-RELEASE.
>Description:
Gdb'ing an executable and setting a breakpoint often results in
the creation and modification times on the gdb'd executable changing.
When you rerun the executable from under gdb, gdb complains that the
executable has changed (however it hasn't really at all). When
the executable is NFS mounted, this can result in the program dying
due to alleged text segment modification.
The problem happens even when the user does not have write access
to the executable that is being debugged!
It seems that something is going wrong in the kernel. When ptrace()
goes to set a breakpoint in the executable, I'd expect a copy on
write operation to occur, and for the executable's
creation/modification dates to remain untouched.
>How-To-Repeat:
Script started on Fri May 2 15:57:12 1997
dakine(cole): cat >! test.c
main()
{
printf("Hello world\n");
}
dakine(cole): cc -g -o test test.c
dakine(cole): ls -l test
-rwxrwxr-x 1 cole cole 9790 May 2 15:57 test*
dakine(cole): date
Fri May 02 03:58:00 PM
dakine(cole): gdb test
GDB is free software and you are welcome to distribute copies of it
under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for details.
GDB 4.16 (i386-unknown-freebsd3.0),
Copyright 1996 Free Software Foundation, Inc...
(gdb) break main
Breakpoint 1 at 0x1598: file test.c, line 3.
(gdb) run
Starting program: /usr/home/cole/test/test -N -f ~/conf/com.conf
Breakpoint 1, main () at test.c:3
3 printf("Hello world\n");
(gdb)
Suspended
dakine(cole): ls -l test
-rwxrwxr-x 1 cole cole 9790 May 2 15:57 test*
dakine(cole): sync
dakine(cole): ls -l test
-rwxrwxr-x 1 cole cole 9790 May 2 15:58 test*
dakine(cole): fg
gdb test
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) y
`/usr/home/cole/test/test' has changed; re-reading symbols.
Starting program: /usr/home/cole/test/test -N -f ~/conf/com.conf
Breakpoint 1, main () at test.c:3
3 printf("Hello world\n");
(gdb) quit
The program is running. Quit anyway (and kill it)? (y or n) y
dakine(cole): ^Dexit
Script done on Fri May 2 15:58:20 1997
>Fix:
>Audit-Trail:
>Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199705022305.QAA12475>
