site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Here is the output from the compiler and linker for the kernel extension (I stopped compiling x86_64 for testing purposes): CompileC /Library/Caches/Build/ProductionBuild.build/Release/KernelExtension.build/Objects-normal/ppc/SquelchCache.o KernelExtension/SquelchCache.c normal ppc c com.apple.compilers.gcc.4_0 cd /Volumes/Development/Source/Perforce_tree_3.0/ setenv LANG en_US.US-ASCII /Developer/usr/bin/gcc-4.0 -x c -arch ppc -fmessage-length=0 -pipe -nostdinc -fno-builtin -Wno-trigraphs -force_cpusubtype_ALL -msoft-float -Os -fno-common -mkernel -finline -fno-keep-inline-functions -DKEXT_DEBUG=0 -DUSE_ENCRYPTED_MD=1 -DVERIFY_TRUST=1 -DDEUCE_IP_ENABLED=1 -DEUCE_STREAM_ENABLED=1 -DKERNEL -DKERNEL_PRIVATE -DDRIVER_PRIVATE -DAPPLE -DNeXT -isysroot /Developer/SDKs/MacOSX10.4.0.sdk -mtune=G5 -mmacosx-version-min=10.4 -gdwarf-2 -I/Library/Caches/Build/ProductionBuild.build/Release/KernelExtension.build/SymIPS.hmap -F/Library/Caches/Build/Release -F/Library/Caches/Build/Release -I/Library/Caches/Build/Release/include -IPongo/FoundationHeaders -IPongo/GlobalHeaders -I/Developer/SDKs/MacOSX10.4.0.sdk/System/Library/Frameworks/Kernel.framework/Headers/machine -I/Library/Caches/Build/Any/include -I/Developer/SDKs/MacOSX10.4.0.sdk/System/Library/Frameworks/Kernel.framework/Headers -I/System/Library/Frameworks/Kernel.framework/Headers/bsd -I/System/Library/Frameworks/Kernel.framework/PrivateHeaders -I/Library/Caches/Build/ProductionBuild.build/Release/KernelExtension.build/DerivedSources/ppc -I/Library/Caches/Build/ProductionBuild.build/Release/KernelExtension.build/DerivedSources -include /var/folders/zz/zzzivhrRnAmviuee+++++++++++/-Caches-/com.apple.Xcode.0/SharedPrecompiledHeaders/Kext_Prefix-ermiczyudsenstebaqblpbrrkpva/Kext_Prefix.h -c /Volumes/Development/Source/Perforce_tree_3.0//KernelExtension/SquelchCache.c -o /Library/Caches/Build/ProductionBuild.build/Release/KernelExtension.build/Objects-normal/ppc/SquelchCache.o Ld /Library/Caches/Build/ProductionBuild.build/Release/KernelExtension.build/Objects-normal/ppc/SymIPS normal ppc cd /Volumes/Development/WorkSource/SymIPS_r3.0 setenv MACOSX_DEPLOYMENT_TARGET 10.4 /Developer/usr/bin/g++-4.0 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4.0.sdk -L/Library/Caches/Build/Release -L/Library/Caches/Build/Release/mNDC/lib -L/Library/Caches/Build/Any/lib -F/Library/Caches/Build/Release -F/Library/Caches/Build/Release -filelist /Library/Caches/Build/ProductionBuild.build/Release/KernelExtension.build/Objects-normal/ppc/KernelExtension.LinkFileList -mmacosx-version-min=10.4 -no_uuid -lndc -lcpp_kext -Xlinker -kext -nostdlib -lkmodc++ /Library/Caches/Build/ProductionBuild.build/Release/KernelExtension.build/Objects-normal/ppc/KernelExtension_info.o -lkmod -lcc_kext -o /Library/Caches/Build/ProductionBuild.build/Release/KernelExtension.build/Objects-normal/ppc/SymIPS CreateUniversalBinary Localization/Universal/PkgRoot/System/Library/Extensions/SymIPS.kext/Contents/MacOS/SymIPS normal "ppc i386" cd /Volumes/Development/WorkSource/SymIPS_r3.0 /usr/bin/lipo -create /Library/Caches/Build/ProductionBuild.build/Release/KernelExtension.build/Objects-normal/ppc/SymIPS /Library/Caches/Build/ProductionBuild.build/Release/KernelExtension.build/Objects-normal/i386/SymIPS -output /Volumes/Development/WorkSource/SymIPS_r3.0/Localization/Universal/PkgRoot/System/Library/Extensions/SymIPS.kext/Contents/MacOS/SymIPS Here is the backtrace from kextload: Process: kextload [148] Path: /sbin/kextload Identifier: kextload Version: ??? (???) Code Type: PPC (Native) Parent Process: SymDaemon [42] Date/Time: 2010-01-06 11:15:34.924 -0800 OS Version: Mac OS X 10.5.8 (9L31a) Report Version: 6 Anonymous UUID: 9E15765F-023C-4D8F-BE1E-089624D2A787 Exception Type: EXC_BAD_ACCESS (SIGBUS) Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000000 Crashed Thread: 0 Thread 0 Crashed: 0 com.apple.framework.IOKit 0x941692cc kld_file_prepare_for_link + 200 1 com.apple.framework.IOKit 0x9416b10c __kload_load_modules + 224 2 com.apple.framework.IOKit 0x9416c7b8 kload_load_dgraph + 856 3 com.apple.framework.IOKit 0x941591f4 _KXKextManagerLoadKextUsingOptions + 1272 4 kextload 0x00003800 0x1000 + 10240 5 kextload 0x00001ef4 0x1000 + 3828 Thread 0 crashed with PPC Thread State 32: srr0: 0x941692cc srr1: 0x0200d030 dar: 0x00000000 dsisr: 0x40000000 r0: 0x000006c8 r1: 0xbffff660 r2: 0x00000000 r3: 0x0000b000 r4: 0x00000000 r5: 0x001fc080 r6: 0x000039ea r7: 0x00000000 r8: 0x01ff0000 r9: 0x00000000 r10: 0x00812240 r11: 0x0258a044 r12: 0x93c5ad30 r13: 0x00000000 r14: 0x00000000 r15: 0xfffff704 r16: 0x00000003 r17: 0x00000000 r18: 0x00000000 r19: 0x0000023f r20: 0x000008fc r21: 0x0000023f r22: 0x00000002 r23: 0x024caddb r24: 0x00138df8 r25: 0x00000000 r26: 0x00000008 r27: 0x00138fe0 r28: 0x00000002 r29: 0x001392b0 r30: 0x001392b4 r31: 0x9416920c cr: 0x28422442 xer: 0x20000000 lr: 0x941696a8 ctr: 0x0000000b vrsave: 0x00000000 Binary Images: 0x1000 - 0x5ffe +kextload ??? (???) <5d0882d4d0e957d3e3140664cfc395f7> /sbin/kextload 0x8fe00000 - 0x8fe30c23 dyld 97.1 (???) <89a0055b0e7ea2db881b73c6e63bc774> /usr/lib/dyld 0x90031000 - 0x9003cffb libgcc_s.1.dylib ??? (???) <ea47fd375407f162c76d14d64ba246cd> /usr/lib/libgcc_s.1.dylib 0x90c6d000 - 0x90d92ff3 com.apple.CoreFoundation 6.5.7 (476.19) <dee0f0024f3bf976cfa0a0816e8aa338> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation 0x90e9f000 - 0x90f82fff libobjc.A.dylib ??? (???) <39035ba996e55c617e20595dcd89c063> /usr/lib/libobjc.A.dylib 0x9113d000 - 0x911a4ffb libstdc++.6.dylib ??? (???) <a4e9b10268b3ffac26d0296499b24e8e> /usr/lib/libstdc++.6.dylib 0x92233000 - 0x9225eff7 libauto.dylib ??? (???) <b3a3a4b0f09653bd6d58f1847922b533> /usr/lib/libauto.dylib 0x92788000 - 0x92796fff libz.1.dylib ??? (???) <1a70dd3594a8c5ad39d785af5da23237> /usr/lib/libz.1.dylib 0x93c54000 - 0x93df4ff3 libSystem.B.dylib ??? (???) <900415cd2c829b2de9a6cdcdaa6307e3> /usr/lib/libSystem.B.dylib 0x93f12000 - 0x93f17ff6 libmathCommon.A.dylib ??? (???) /usr/lib/system/libmathCommon.A.dylib 0x94139000 - 0x941ceff7 com.apple.framework.IOKit 1.5.2 (???) <ced0a498252f76a2d2ba9f2a0ae02160> /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit 0x96f79000 - 0x970c1ff3 libicucore.A.dylib ??? (???) <07d0cefd48d11d5d5b1817c198013f0b> /usr/lib/libicucore.A.dylib 0xfffec000 - 0xfffeffff libobjc.A.dylib ??? (???) /usr/lib/libobjc.A.dylib 0xffff8000 - 0xffff9703 libSystem.B.dylib ??? (???) /usr/lib/libSystem.B.dylib And here's the otool -l: Load command 0 cmd LC_SEGMENT cmdsize 600 segname vmaddr 0x00000000 vmsize 0x00076718 fileoff 852 filesize 484956 maxprot 0x00000007 initprot 0x00000003 nsects 8 flags 0x0 Section sectname __text segname __TEXT addr 0x00000000 size 0x00071994 offset 852 align 2^4 (16) reloff 485808 nreloc 29244 flags 0x00000000 reserved1 0 reserved2 0 Section sectname __cstring segname __TEXT addr 0x00071994 size 0x0000138c offset 466152 align 2^2 (4) reloff 0 nreloc 0 flags 0x00000002 reserved1 0 reserved2 0 Section sectname __const segname __TEXT addr 0x00072d20 size 0x00003128 offset 471156 align 2^3 (8) reloff 719760 nreloc 399 flags 0x00000000 reserved1 0 reserved2 0 Section sectname __constructor segname __TEXT addr 0x00075e48 size 0x00000004 offset 483740 align 2^2 (4) reloff 722952 nreloc 1 flags 0x00000000 reserved1 0 reserved2 0 Section sectname __destructor segname __TEXT addr 0x00075e4c size 0x00000004 offset 483744 align 2^2 (4) reloff 722960 nreloc 1 flags 0x00000000 reserved1 0 reserved2 0 Section sectname __data segname __DATA addr 0x00075e50 size 0x0000080c offset 483748 align 2^2 (4) reloff 722968 nreloc 110 flags 0x00000000 reserved1 0 reserved2 0 Section sectname __bss segname __DATA addr 0x0007665c size 0x00000080 offset 0 align 2^2 (4) reloff 0 nreloc 0 flags 0x00000001 reserved1 0 reserved2 0 Section sectname __common segname __DATA addr 0x000766dc size 0x0000003c offset 0 align 2^2 (4) reloff 0 nreloc 0 flags 0x00000001 reserved1 0 reserved2 0 Load command 1 cmd LC_SYMTAB cmdsize 24 symoff 723848 nsyms 503 stroff 729884 strsize 18432 Load command 2 cmd LC_UNIXTHREAD cmdsize 176 flavor PPC_THREAD_STATE count PPC_THREAD_STATE_COUNT r0 0x00000000 r1 0x00000000 r2 0x00000000 r3 0x00000000 r4 0x00000000 r5 0x00000000 r6 0x00000000 r7 0x00000000 r8 0x00000000 r9 0x00000000 r10 0x00000000 r11 0x00000000 r12 0x00000000 r13 0x00000000 r14 0x00000000 r15 0x00000000 r16 0x00000000 r17 0x00000000 r18 0x00000000 r19 0x00000000 r20 0x00000000 r21 0x00000000 r22 0x00000000 r23 0x00000000 r24 0x00000000 r25 0x00000000 r26 0x00000000 r27 0x00000000 r28 0x00000000 r29 0x00000000 r30 0x00000000 r31 0x00000000 cr 0x00000000 xer 0x00000000 lr 0x00000000 ctr 0x00000000 mq 0x00000000 vrsave 0x00000000 srr0 0x00000000 srr1 0x00000000 The panic trace is hard to obtain, since the panic occurs *very* early. The kernel extension is IOKit OSBundleRequired=true so, it's loaded pretty immediately after boot. Firewire debugging is not possible because the Firewire driver doesn't seem to load in time (at least it won't let me attach), and the machine has no IP address. QA took a picture and I can attach it, but having debugged this same issue before, I'm fairly certain it's not very useful. The last time I had this issue, I had to have DTS resolve it, and it turned out to be a problem with the stripping in our kernel extension. The panic log was exactly the same that time, so I double checked the stripping and even turned it off this time. Here's messages from the list that seem to support that theory: http://lists.apple.com/archives/Darwin-drivers/2005/Feb/msg00069.html http://lists.apple.com/archives/darwin-drivers/2002/Sep/msg00013.html Thanks all, Ryan On Thursday, January 07, 2010, at 03:18PM, "Shantonu Sen" <ssen@apple.com> wrote:
You still haven't really given enough information, like the kextutil/kextload text output, or the backtrace in gdb (in userspace), or a sample kernel extension/recipe.
Apple supports kexts that deploy across this range of OSes. We have sample code and WWDC sessions about it.
I agree with Brian and I think you're wrong about the Mach-O header. The various tools would look at the fat header and gravitate to the ppc/ppc7400 slice. In fact, maybe that's the problem. Are you building with -mmacosx-version-min=10.4?
Shantonu Sen ssen@apple.com
Sent from my Mac Pro
On Jan 7, 2010, at 3:10 PM, Ryan McGann wrote:
* this isn't magic. You have a bus error because of code in your kext Well yes, but not really. The bus error is in *kextload*, not my code. In fact, my kext isn't even loaded. That's the problem.
* ppc machines completely ignore x86_64 architecture. The presence or absence of such code in your kext is not relevant. Well, again not really. Once the kext is loaded that's true, but kextload (and libsa) both look at the Mach header of the kernel extension, and do some sanity checking. Because IOKit in 10.5 does not recognize the 64-bit architecture in the Mach header, it chokes on 64-bit kernel extensions when using -t with a bogus error message ("Executable does not contain kernel code"). This is a documented problem that you can find online from a lot of people, but it's a bogus error message, and therefore it's neither here nor there.
* you should use two machine debugging to diagnose this. You can use an intel machine to connect to your ppc panic; just specify the -arch keyword when invoking gdb Sorry, I'm kind of assuming previous experience that I've had with this. The panic is basically a red herring as well. The panic is the same as the kextload issue; the in-kernel linker is experiencing the same bus error that kextload experiences in userspace. Two machine debugging won't tell me anything because (a) our kernel extension is not in the backtrace, it's all in the kernel linker and (b) I know what the problem is—the kernel extension is somehow malformed—because kextload can't load the kext either.
I'm just curious if anybody else has seen the same crash in kextload with a similar setup, and if they found a workaround.
Ryan
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/ssen%40apple.com
This email sent to ssen@apple.com
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com