Date: Mon, 15 Apr 2002 19:50:15 +0200 (CEST) From: Thomas Quinot <thomas@cuivre.fr.eu.org> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/37104: truss(1) does not print strings from stack correctly Message-ID: <20020415175015.0958C1158A@shalmaneser.enst.fr>
next in thread | raw e-mail | index | archive | help
>Number: 37104
>Category: bin
>Synopsis: truss(1) does not print strings from stack correctly
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Mon Apr 15 11:00:04 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Thomas Quinot
>Release: FreeBSD 5.0-CURRENT i386
>Organization:
>Environment:
System: FreeBSD shalmaneser.enst.fr 5.0-CURRENT FreeBSD 5.0-CURRENT #14: Mon Apr 15 16:33:07 CEST 2002 quinot@shalmaneser.enst.fr:/usr/obj/usr/src/sys/SHALMANESER i386
>Description:
When the first argument of open(2) is a pointer to a string
on the stack, its value is not correctly printed. This might
also impact other system calls that take string arguments.
>How-To-Repeat:
cat > titi.c <<__EOF__
#include <fcntl.h>
main() {
char buf[256] = "/dev/null";
close (open ("/dev/null", O_RDONLY));
close (open (buf, O_RDONLY));
close (open ("/dev/null", O_RDONLY));
}
__EOF__
$ gcc -o titi titi.c
$ truss -o log ./titi
$ grep open log
open("/var/run/ld-elf.so.hints",0x0,03) = 4 (0x4)
open("/usr/lib/libc.so.5",0x0,027757770344) = 4 (0x4)
open("/dev/null",0x0,01001103120) = 4 (0x4)
open("",0x0,01001103160) = 4 (0x4)
open("/dev/null",0x0,01001103222) = 4 (0x4)
Note that the argument reported for the second from last call to open
is wrong.
Another demonstration of the problem can be produced by setting LANG
to a non-null value and trussing a binary that makes a call to setlocale,
eg: "LANG=foo truss /bin/ls 2>&1 | grep open". This will output garbage.
>Fix:
None known so far.
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020415175015.0958C1158A>
