Trace/BPT trap: 5 when accessing SystemVersion.plist in Mavericks

Posted by on Nov 9, 2013 in Geekery, Mac, OSX, programming | No Comments

If you’re reading this blog entry because you’re a subscriber, I’d stop now and skip this one. Unless you’re extremely geeky. This is more of a public service announcement to anyone who’s installed OSX 10.9 and Xcode 5, and finds themselves oddly unable to compile even the simplest program using the command-line tools, from gcc to clang.

Long story short: if you find yourself seeing traps (Trace/BPT trap: 5) and segmentation faults from clang or gcc, and *especially* if you track it down to an __open call dying very early in the process, it’s possible you’ve run into the same problem I did: a problem accessing /System/Library/CoreServices/SystemVersion.plist.

Here’s the situation I found myself in:

Matt-Gibsons-iMac:tmp matt$ cat /System/Library/CoreServices/SystemVersion.plist 
Trace/BPT trap: 5

Yup. Instead of seeing the content of SystemVersion.plist, like you’d expect, I got an instant trap from the OS, and no file content. Strangely, other users — root and normal test users — could read the file just fine.

The file permissions were fine, and if I moved the file to a different name, I could see it. If I put a new file with readable-by-everyone permissions in the place of SystemVersion.plist, it died with the same BPT trap error.

After a fair bit of detective work, and some sterling help from Apple’s compiler fronted team (thanks, Ted!), and following some confirmation and investigation by those nice people at Rogue Amoeba, I tracked this down to an errant, development version of their InstantOn extension, used by their Airfoil product range, among others:

Matt-Gibsons-iMac:~ matt$ kextstat | grep rogueamoeba
   68    0 0xffffff7f81657000 0x3000     0x3000     com.rogueamoeba.InstantOn (6.0.4) 
  113    0 0xffffff7f82276000 0x26000    0x26000    com.rogueamoeba.InstantOnCore (6.0.4) 
Matt-Gibsons-iMac:tmp matt$ cat /System/Library/CoreServices/SystemVersion.plist 
Trace/BPT trap: 5
Matt-Gibsons-iMac:tmp matt$ sudo kextunload -b com.rogueamoeba.InstantOn
Password:
Matt-Gibsons-iMac:tmp matt$ cat /System/Library/CoreServices/SystemVersion.plist 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>ProductBuildVersion</key>
	<string>13A603</string>
	<key>ProductCopyright</key>
	...

I have *no* idea where this old version of the InstantOn extension came from — as far as I can tell, having upgraded to a newer version with the help of Rogue Amoeba’s support team, the latest version of InstantOn doesn’t even use a kernel extension, let alone one that causes problems with reading SystemVersion.plist. And it wasn’t causing a problem with previous versions of OS X. So I think it’s safe to say that this is a rare (and almost certainly self-inflicted) problem.

But, given that it took me a few days, a lot of unproductive Googling, and help from Apple and Rogue Amoeba to find, I figured I’d post about it, just in case anyone else was in the same boat and might come across this in a web search. If *you’re* having trouble with clang or other compiler tools on Mavericks, it might be worth seeing if the user account with the problem can read /System/Library/CoreServices/SystemVersion.plist, and if not, check for a rogue version of Rogue Amoeba’s InstantOn…

If so, installing the latest version of Airfoil, or whatever product it is you’re using, then updating the InstantOn component, and then rebooting, might well fix it. And you can double-check in advance with:

sudo kextunload -b com.rogueamoeba.InstantOn

…which immediately fixed the problem for me, at least until the next reboot.

I’ll finish with the stack trace from the clang failure I was seeing, for the purposes of getting some relevant keywords into search engines:

Process:         clang [17565]
Path:            /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
Identifier:      clang
Version:         5.0 (500.2.79)
Code Type:       X86-64 (Native)
Parent Process:  clang [17562]
Responsible:     Terminal [16821]
User ID:         504

Date/Time:       2013-11-06 07:50:08.587 +0000
OS Version:      Mac OS X 10.9 (13A603)
Report Version:  11
Anonymous UUID:  8A5750A5-5308-E479-7847-5F0575D83A23

Sleep/Wake UUID: 7BCECE0C-0163-4DE6-8F63-1F64FA54BA34

Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000

VM Regions Near 0:
--> 
    __TEXT                 0000000100000000-0000000101ad3000 [ 26.8M] r-x/rwx SM=COW  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   ???                           	0x0000000101c44a02 0 + 4324608514
1   ???                           	0x0000000101c48e1d 0 + 4324625949
2   libsystem_kernel.dylib        	0x00007fff8ad525da __open + 10
3   clang                         	0x0000000100052050 0x100000000 + 335952
4   clang                         	0x0000000100050a5b 0x100000000 + 330331
5   clang                         	0x0000000100036789 0x100000000 + 223113
6   clang                         	0x000000010003132d 0x100000000 + 201517
7   clang                         	0x0000000100026f91 0x100000000 + 159633
8   clang                         	0x0000000100007ec0 main + 23632
9   libdyld.dylib                 	0x00007fff8d18c5fd start + 1

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x0000000000000000  rbx: 0x00007fff8b7f3318  rcx: 0xa3006940d70d4575  rdx: 0x00000000000f7000
  rdi: 0x0000000101c15a00  rsi: 0x000000001b800001  rbp: 0x00007fff5fbfc820  rsp: 0x00007fff5fbfc360
   r8: 0x0000000101e00370   r9: 0x0000000101e04f30  r10: 0x00000000f4808b95  r11: 0x00000000de08b794
  r12: 0x00000000000003b1  r13: 0x0000000000000000  r14: 0x0000000000002000  r15: 0x0000000102800000
  rip: 0x0000000101c44a02  rfl: 0x0000000000010246  cr2: 0x0000000000000000

Logical CPU:     0
Error Code:      0x00000004
Trap Number:     14

Binary Images:
       0x100000000 -        0x101ad2ff7 +clang (5.0 - 500.2.79)  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
    0x7fff6112d000 -     0x7fff61160817  dyld (239.3)  /usr/lib/dyld
    0x7fff8451a000 -     0x7fff84549fd2  libsystem_m.dylib (3047.16)  /usr/lib/system/libsystem_m.dylib
    0x7fff849c6000 -     0x7fff849c8ff7  libquarantine.dylib (71)  /usr/lib/system/libquarantine.dylib
    0x7fff850dc000 -     0x7fff850f6fff  libdispatch.dylib (339.1.9)  /usr/lib/system/libdispatch.dylib
    0x7fff85128000 -     0x7fff85139ff7  libsystem_asl.dylib (217.1.4)  /usr/lib/system/libsystem_asl.dylib
    0x7fff85ab3000 -     0x7fff85abafff  libcompiler_rt.dylib (35)  /usr/lib/system/libcompiler_rt.dylib
    0x7fff85ea0000 -     0x7fff85ea1ff7  libsystem_blocks.dylib (63)  /usr/lib/system/libsystem_blocks.dylib
    0x7fff8612f000 -     0x7fff86130ff7  libSystem.B.dylib (1197.1.1)  /usr/lib/libSystem.B.dylib
    0x7fff861ae000 -     0x7fff861b2ff7  libcache.dylib (62)  /usr/lib/system/libcache.dylib
    0x7fff86354000 -     0x7fff8635bff3  libcopyfile.dylib (103)  /usr/lib/system/libcopyfile.dylib
    0x7fff86ad8000 -     0x7fff86c85f27  libobjc.A.dylib (551.1)  /usr/lib/libobjc.A.dylib
    0x7fff86d69000 -     0x7fff86d70ff7  libsystem_pthread.dylib (53.1.4)  /usr/lib/system/libsystem_pthread.dylib
    0x7fff87831000 -     0x7fff87835fff  libsystem_stats.dylib (93.1.26)  /usr/lib/system/libsystem_stats.dylib
    0x7fff879f2000 -     0x7fff87a40fff  libcorecrypto.dylib (161.1)  /usr/lib/system/libcorecrypto.dylib
    0x7fff87df4000 -     0x7fff87e05ff7  libz.1.dylib (53)  /usr/lib/libz.1.dylib
    0x7fff87e34000 -     0x7fff87e3dff3  libsystem_notify.dylib (121)  /usr/lib/system/libsystem_notify.dylib
    0x7fff89631000 -     0x7fff8965aff7  libc++abi.dylib (48)  /usr/lib/libc++abi.dylib
    0x7fff896fe000 -     0x7fff89725ff7  libsystem_network.dylib (241.3)  /usr/lib/system/libsystem_network.dylib
    0x7fff89757000 -     0x7fff8975cfff  libmacho.dylib (845)  /usr/lib/system/libmacho.dylib
    0x7fff8978c000 -     0x7fff89971ff7  com.apple.CoreFoundation (6.9 - 855.11)  /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
    0x7fff8ad13000 -     0x7fff8ad3affb  libsystem_info.dylib (449.1.3)  /usr/lib/system/libsystem_info.dylib
    0x7fff8ad3d000 -     0x7fff8ad59ff7  libsystem_kernel.dylib (2422.1.72)  /usr/lib/system/libsystem_kernel.dylib
    0x7fff8b6c0000 -     0x7fff8b6c2ff3  libsystem_configuration.dylib (596.12)  /usr/lib/system/libsystem_configuration.dylib
    0x7fff8b71d000 -     0x7fff8b71dff7  libkeymgr.dylib (28)  /usr/lib/system/libkeymgr.dylib
    0x7fff8b7c4000 -     0x7fff8b84dff7  libsystem_c.dylib (997.1.1)  /usr/lib/system/libsystem_c.dylib
    0x7fff8bde7000 -     0x7fff8bdedff7  libsystem_platform.dylib (24.1.4)  /usr/lib/system/libsystem_platform.dylib
    0x7fff8cce3000 -     0x7fff8cce4ff7  libDiagnosticMessagesClient.dylib (100)  /usr/lib/libDiagnosticMessagesClient.dylib
    0x7fff8d189000 -     0x7fff8d18cff7  libdyld.dylib (239.3)  /usr/lib/system/libdyld.dylib
    0x7fff8d3e2000 -     0x7fff8d424ff7  libauto.dylib (185.5)  /usr/lib/libauto.dylib
    0x7fff8d623000 -     0x7fff8d62dfff  libcommonCrypto.dylib (60049)  /usr/lib/system/libcommonCrypto.dylib
    0x7fff8db5f000 -     0x7fff8db7aff7  libsystem_malloc.dylib (23.1.10)  /usr/lib/system/libsystem_malloc.dylib
    0x7fff8e54c000 -     0x7fff8e553ff7  liblaunch.dylib (842.1.4)  /usr/lib/system/liblaunch.dylib
    0x7fff8e7c6000 -     0x7fff8e97eff3  libicucore.A.dylib (511.25)  /usr/lib/libicucore.A.dylib
    0x7fff8f357000 -     0x7fff8f3a9fff  libc++.1.dylib (120)  /usr/lib/libc++.1.dylib
    0x7fff8f87e000 -     0x7fff8f886fff  libsystem_dnssd.dylib (522.1.11)  /usr/lib/system/libsystem_dnssd.dylib
    0x7fff8f887000 -     0x7fff8f88cff7  libunwind.dylib (35.3)  /usr/lib/system/libunwind.dylib
    0x7fff8f8f4000 -     0x7fff8f8f5ff7  libsystem_sandbox.dylib (278.10)  /usr/lib/system/libsystem_sandbox.dylib
    0x7fff912fe000 -     0x7fff912ffffb  libremovefile.dylib (33)  /usr/lib/system/libremovefile.dylib
    0x7fff91372000 -     0x7fff91373fff  libunc.dylib (28)  /usr/lib/system/libunc.dylib
    0x7fff913f5000 -     0x7fff91419fff  libxpc.dylib (300.1.17)  /usr/lib/system/libxpc.dylib

External Modification Summary:
  Calls made by other processes targeting this process:
    task_for_pid: 1
    thread_create: 0
    thread_set_state: 0
  Calls made by this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by all processes on this machine:
    task_for_pid: 20173115
    thread_create: 2
    thread_set_state: 0

VM Region Summary:
ReadOnly portion of Libraries: Total=101.1M resident=68.5M(68%) swapped_out_or_unallocated=32.7M(32%)
Writable regions: Total=26.6M written=476K(2%) resident=552K(2%) swapped_out=0K(0%) unallocated=26.1M(98%)

REGION TYPE                      VIRTUAL
===========                      =======
Kernel Alloc Once                     4K
MALLOC                             18.2M
MALLOC (admin)                       16K
STACK GUARD                        56.0M
Stack                              8192K
VM_ALLOCATE                         164K
__DATA                             2144K
__LINKEDIT                         65.6M
__TEXT                             35.5M
__UNICODE                           544K
shared memory                         4K
===========                      =======
TOTAL                             186.1M

System Profile:
Model: iMac10,1, BootROM IM101.00CC.B00, 2 processors, Intel Core 2 Duo, 3.06 GHz, 16 GB, SMC 1.52f9
Graphics: ATI Radeon HD 4670, ATI Radeon HD 4670, PCIe, 256 MB
Memory Module: BANK 0/DIMM0, 4 GB, DDR3, 1067 MHz, 0x859B, 0x435434473353313036374D2E4D3136464B44
Memory Module: BANK 1/DIMM0, 4 GB, DDR3, 1067 MHz, 0x859B, 0x435434473353313036374D2E4D3136464B44
Memory Module: BANK 0/DIMM1, 4 GB, DDR3, 1067 MHz, 0x859B, 0x435434473353313036374D2E4D3136464B44
Memory Module: BANK 1/DIMM1, 4 GB, DDR3, 1067 MHz, 0x859B, 0x435434473353313036374D2E4D3136464B44
AirPort: spairport_wireless_card_type_airport_extreme (0x168C, 0x8F), Atheros 9280: 4.0.74.0-P2P
Bluetooth: Version 4.2.0f6 12982, 3 services, 23 devices, 1 incoming serial ports
Network Service: Ethernet, Ethernet, en0
Network Service: AirPort, AirPort, en1
Serial ATA Device: Hitachi HDE721010SLA330, 1 TB
Serial ATA Device: HL-DT-ST DVDRW  GA11N
USB Device: USB2.0 Hub
USB Device: USB2.0 Hub
USB Device: Fitbit Base Station
USB Device: Photosmart 2570 series
USB Device: USB2.0 Hub
USB Device: ET-0405-UV1.1-1
USB Device: Built-in iSight
USB Device: Internal Memory Card Reader
USB Device: FreeAgent
USB Device: IR Receiver
USB Device: U24XL
USB Device: Smart Energy Kit
USB Device: BRCM2046 Hub
USB Device: Bluetooth USB Host Controller
FireWire Device: My Book 111D, WD, Up to 800 Mb/sec
Thunderbolt Bus: 
« Instagram | Favourite Photo of the Month 2013 »