From owner-freebsd-bugs Mon Apr 15 11: 0:40 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id CAD1037B416 for ; Mon, 15 Apr 2002 11:00:04 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g3FI04F16391; Mon, 15 Apr 2002 11:00:04 -0700 (PDT) (envelope-from gnats) Received: from infres.enst.fr (infres-192.enst.fr [137.194.192.1]) by hub.freebsd.org (Postfix) with ESMTP id E3D9A37B41B for ; Mon, 15 Apr 2002 10:50:17 -0700 (PDT) Received: from shalmaneser.enst.fr (shalmaneser.enst.fr [137.194.162.11]) by infres.enst.fr (Postfix) with ESMTP id 9267F18F4 for ; Mon, 15 Apr 2002 19:50:16 +0200 (MEST) Received: by shalmaneser.enst.fr (Postfix, from userid 11117) id 0958C1158A; Mon, 15 Apr 2002 19:50:15 +0200 (CEST) Message-Id: <20020415175015.0958C1158A@shalmaneser.enst.fr> Date: Mon, 15 Apr 2002 19:50:15 +0200 (CEST) From: Thomas Quinot Reply-To: Thomas Quinot To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/37104: truss(1) does not print strings from stack correctly Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >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 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