From nobody@FreeBSD.org  Mon Sep 15 13:27:45 2008
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 30050106564A
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 15 Sep 2008 13:27:45 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 1E1208FC08
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 15 Sep 2008 13:27:45 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m8FDRi5L063904
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 15 Sep 2008 13:27:44 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.2/8.14.1/Submit) id m8FDRiD6063898;
	Mon, 15 Sep 2008 13:27:44 GMT
	(envelope-from nobody)
Message-Id: <200809151327.m8FDRiD6063898@www.freebsd.org>
Date: Mon, 15 Sep 2008 13:27:44 GMT
From: Chitti Nimmagadda <Chitti.Nimmagadda@citrix.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: 32bit application on FreeBSD-6.3 amd64 gets SIGBUS
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         127397
>Category:       amd64
>Synopsis:       [amd64] 32bit application on FreeBSD-6.3 amd64 gets SIGBUS
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-amd64
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Sep 15 13:30:01 UTC 2008
>Closed-Date:    Sat Nov 13 18:43:33 UTC 2010
>Last-Modified:  Sat Nov 13 18:43:33 UTC 2010
>Originator:     Chitti Nimmagadda
>Release:        FreeBSD-6.3
>Organization:
Citrix
>Environment:
FreeBSD freebsd64bit 6.3-RELEASE FreeBSD 6.3-RELEASE #0: Wed Jan 16 01:43:02 UTC 2008     root@palmer.cse.buffalo.edu:/usr/obj/usr/src/sys/SMP  amd64

>Description:
I'm running a 32bit application on amd64 FreeBSD-6.3 and the application
is getting a SIGBUS. 

The issue can be reproduced with the following test program "foo.c"
====
main()
{
        char c1;
        static int a;
        static int b;
        static int c;
        int d;

        while(1) {
                a = b;
                b = c;
                c = a;
        }
}
====

The program is compiled using the following command:
gcc -g -m32 -L/usr/lib32 -B/usr/lib32 -o foo foo.c

following is the info from gdb
==
freebsd64bit# ./foo
^C
freebsd64bit# ./foo
^C
freebsd64bit# ./foo
^C
freebsd64bit# ./foo
Bus error (core dumped)
freebsd64bit# gdb -c foo.core foo
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or 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.
This GDB was configured as "amd64-marcel-freebsd"...
Core was generated by `foo'.
Program terminated with signal 10, Bus error.
Reading symbols from /usr/lib32/libc.so.6...done.
Loaded symbols for /usr/lib32/libc.so.6
Reading symbols from /libexec/ld-elf.so.1...done.
Loaded symbols for /libexec/ld-elf.so.1
#0  0x08048501 in main () at foo.c:10
10                      a = b;
(gdb) x/i 0x08048501
0x8048501 <main+33>:    mov    %eax,0x80496dc
(gdb)
==

system details:
OS 6.3 FreeBSD amd64
CPU: Intel(R) Xeon(R) CPU X5355  @ 2.66GHz (2666.78-MHz K8-class CPU)
Memory: 16GB

The issue is reproducible only on the SMP kernel.

This issue is not reproducible all the times, but occurs more frequently
within the first 5mins after the machine is booted (after the login prompt)

Any solution or workaround exist for this issue?

Thanks,
Chitti.
>How-To-Repeat:


>Fix:


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-amd64 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Tue Sep 16 02:53:06 UTC 2008 
Responsible-Changed-Why:  
With a little bit of hesitation, move this one over to the amd64 category, 
in hopes that it will be a little more high-profile there. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=127397 

From: Chitti R Nimmagadda <chittir@yahoo.com>
To: bug-followup@FreeBSD.org
Subject: Re: amd64/127397: [amd64] 32bit application on FreeBSD-6.3 amd64 gets SIGBUS
Date: Fri, 19 Sep 2008 02:41:33 -0700 (PDT)

 Setting the PCB_32BIT flag in pcb_flags(file sys/amd64/ia32/ia32_signal.c,
 line 760) is resolving the issue

State-Changed-From-To: open->closed 
State-Changed-By: arundel 
State-Changed-When: Sat Nov 13 18:37:25 UTC 2010 
State-Changed-Why:  
Fixed in HEAD and 8.x (r180992) and MFC'ed to 7.x (r181752). I can confirm that 
the example application compiled with the according gcc line to produce a 32bit 
binary no longer crashes with SIGBUS. 
Since 6.x went EoL: close this PR. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=127397 
>Unformatted:
