From owner-freebsd-bugs@FreeBSD.ORG Sat Dec 8 08:00:02 2012 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AC4BFFD0 for ; Sat, 8 Dec 2012 08:00:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 7B2E28FC15 for ; Sat, 8 Dec 2012 08:00:02 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id qB8802Oa098192 for ; Sat, 8 Dec 2012 08:00:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id qB8802Qb098191; Sat, 8 Dec 2012 08:00:02 GMT (envelope-from gnats) Resent-Date: Sat, 8 Dec 2012 08:00:02 GMT Resent-Message-Id: <201212080800.qB8802Qb098191@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Jerome St-Louis Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5119BF02 for ; Sat, 8 Dec 2012 07:52:17 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 38B048FC0C for ; Sat, 8 Dec 2012 07:52:17 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.5/8.14.5) with ESMTP id qB87qHNS093810 for ; Sat, 8 Dec 2012 07:52:17 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.5/8.14.5/Submit) id qB87qHNL093809; Sat, 8 Dec 2012 07:52:17 GMT (envelope-from nobody) Message-Id: <201212080752.qB87qHNL093809@red.freebsd.org> Date: Sat, 8 Dec 2012 07:52:17 GMT From: Jerome St-Louis To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: misc/174272: Segmentation Fault calling stat() from an application compiled as 32 bit on a 64 bit machine X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Dec 2012 08:00:02 -0000 >Number: 174272 >Category: misc >Synopsis: Segmentation Fault calling stat() from an application compiled as 32 bit on a 64 bit machine >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Dec 08 08:00:02 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Jerome St-Louis >Release: FreeBSD 9.0 >Organization: Ecere Corporation >Environment: FreeBSD freebsd9-64 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan 3 07:46:30 UTC 2012 root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64 >Description: As summarized, invoking the stat() function from an application compiled with gcc -m32 on an amd64 install of FreeBSD 9.0 gives a segmentation fault. What is up with that? Am I doing something wrong? Does FreeBSD not support compiling and running 32 bit applications on a 64 bit installation? Invoking stat() seems pretty basic functionality... This is most disappointing as it prevents users from running our software on 64 bit versions of FreeBSD until we port it to 64 bit. Valgrind gives a warning: Warning: client switching stacks? SP change 0xfeffcca8 --> 0x39848928 And then... Invalid read of size 4 at 0x8048491: main (in /root/sdk/a.out) Address 0x39848928 is on thread 1's stack Invalid read of size 4 at 0xFeFFCD94: ??? Address 0x0 is not stack'd, malloc'd or (recently) free'd .. Many thanks! Best regards, Jerome >How-To-Repeat: Paste the following into bla.c: #include int main() { struct stat s; stat(argv[1], &s); return 0; } Compile with: gcc -m32 bla.c Run with: ./a.out Observe: Segmentation fault: 11 (core dumped) >Fix: >Release-Note: >Audit-Trail: >Unformatted: