From nobody@FreeBSD.org Tue Nov 29 08:43:03 2011 Return-Path: Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6D33B1065676 for ; Tue, 29 Nov 2011 08:43:03 +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 42EDC8FC0A for ; Tue, 29 Nov 2011 08:43:03 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id pAT8h2bQ024159 for ; Tue, 29 Nov 2011 08:43:02 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id pAT8h2Nu024155; Tue, 29 Nov 2011 08:43:02 GMT (envelope-from nobody) Message-Id: <201111290843.pAT8h2Nu024155@red.freebsd.org> Date: Tue, 29 Nov 2011 08:43:02 GMT From: Rune To: freebsd-gnats-submit@FreeBSD.org Subject: uClibc explicit runtime loader segfaults under FreeBSD's Linux ABI X-Send-Pr-Version: www-3.1 X-GNATS-Notify: >Number: 162943 >Category: kern >Synopsis: uClibc explicit runtime loader segfaults under FreeBSD's Linux ABI >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Nov 29 08:50:11 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Rune >Release: 8.1, 9.0-RC2 >Organization: >Environment: varied between the machines, the kernels tested were at least both 8.1 of Debian/kFreeBSD and 9.0-RC2 from PC-BSD >Description: ld-uClibc.so.0 can be run and provides the expected diagnostics ("chances are you did not intend to run me") Running programs using the hardcoded implicit dynamic loader works too. Running "ld-uClibc.so.0 " segfaults quite early, before accessing any other files than the . uClibc is from git around 2011-09-15, it reports itself as 0.9.33-git. The tests were done with FreeBSD 8.1 (Debian kFreeBSD) and 9.0-RC2 (FreeBSD), with the same result. The library is configured and compiled for Linux 2.4.19. No problems detected running on various Linux kernels (2.6.x). Strace output on Linux (ktrace from FreeBSD done and compared but not preserved) Comparing strace on Linux and ktrace on FreeBSD (omitted) output while trying to run "ar" from gnu binutils, compiled and linked with uClibc: ----------------------------------------------------------------------------- execve("/.../ld-uClibc.so.0", ["/.../ld-uClibc.so.0", "/.../ar"], ....... mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x4000000, -1, 0) = 0xb7f7c000 open("/.../ar", O_RDONLY) = 3 fstat(3, {st_dev=makedev(3, 1), st_ino=613642, st_mode=S_IFREG|0555, st_nlink=1, st_uid=2001, st_gid=2001, st_blksize=4096, st_blocks=936, st_size=471140, st_at ime=2011/11/21-16:33:34, st_mtime=2011/11/19-21:47:37, st_ctime=2011/11/19-21:47 :38}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x4000000, -1, 0) = 0xb7f7b000 read(3, "\177ELF\1\1\1\3\0\0\0\0\0\0\0\0\2\0\3\0\1\0\0\0p\226\4\0104\0\0\0\314,\ 7\0\0\0\0\0004\0 \0\7\0(\0\27\0\26\0\6\0\0\0004\0\0\0004\200\4\0104\200\4\10\340 \0\0\0\340\0\0\0\5\0\0\0\4\0\0\0\3\0\0\0\24\1\0\0\24\201\4\10\24\201\4\10\37\0\0 \0\37\0\0\0\4\0\0\0\1\0\0\0\1\0\0\0\0\0\0\0\0\200\4\10\0\200\4\10T\27\7\0T\27\7\ 0\5\0\0\0\0\20\0\0\1\0\0\0\0 \7\0\0\240\v\10\0\240\v\10P\6\0\0\334I\0\0\6\0\0\0" .., 4096) = 4096 mmap2(0x8048000, 487424, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x804800 0 mmap2(0x8048000, 464724, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0x8 048000 mmap2(0x80ba000, 1616, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x72) = 0 x80ba000 mmap2(0x80bb000, 14812, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOU S, -1, 0) = 0x80bb000 =====> Segfault under FreeBSD happens here, before/instead of close() <====== close(3) = 0 ... ----------------------------------------------------------------------------- >How-To-Repeat: Compile uClibc on Linux with support for dynamic linking and explicit runtime loader. Run uClibc runtime loader with a binary (dynamically linked with uClibc) as the argument. >Fix: >Release-Note: >Audit-Trail: >Unformatted: