Bug 110656

Summary: 32 bit threaded applications crash on amd64 SMP kernel.
Product: Base System Reporter: Martin M. Mladenov <fm>
Component: amd64Assignee: freebsd-amd64 (Nobody) <amd64>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 6.2-RELEASE   
Hardware: Any   
OS: Any   

Description Martin M. Mladenov 2007-03-22 06:20:04 UTC
   32 bit applications using the posix threads library crash when calling pthread_create on an SMP amd64 kernel. This happens
	 with existing binaries, built natively on a x86 machine, as well as binaries built with cc -m32 on the amd64 system. 
  	 A backtrace for the example in the next section yields:
	
	Core was generated by `pthread-crash'.
	Program terminated with signal 11, Segmentation fault.
	Reading symbols from /usr/lib32/libpthread.so.2...(no debugging symbols found)...done.
	Loaded symbols for /usr/lib32/libpthread.so.2
	Reading symbols from /usr/lib32/libc.so.6...(no debugging symbols found)...done.
	Loaded symbols for /usr/lib32/libc.so.6
	Reading symbols from /libexec/ld-elf.so.1...(no debugging symbols found)...done.
	Loaded symbols for /libexec/ld-elf.so.1
	#0  0x0804d100 in ?? ()
	[New Thread 0x805301408053200 (runnable)]
	[New Thread 0x2809f1c808053000 (runnable)]
	Cannot get thread info: generic error
	(gdb) bt
	#0  0x0804d100 in ?? ()
	
	This has been reproduced on two machines with completely different hardware.

Fix: 

None known.
How-To-Repeat:    The problem can be reproduced by the following code (pthread_crash.c):
        #include <stdio.h>
        #include <pthread.h>

        void *thread(void *data) {
          puts("Thread.");
          return NULL;
        }
 
        int main() {
          pthread_t pth;
          void *pv;
          pthread_create(&pth,NULL,thread,NULL);
          pthread_join(pth,&pv);
          return 0;
        }
        The code is compiled with:
        cc -m32 -B/usr/lib32 -pthread -o pthread-crash pthread-crash.c
	This code runs fine when compiled to 64 bit.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2007-03-22 07:34:01 UTC
State Changed
From-To: open->closed

Duplicate of amd/110655.