I am having trouble getting one of the two non-hardware kernel extensions
I maintain to load on OSX 10.6.x. Both of the kexts load on OSX 10.5.x.
Both kexts are built the same way, similar Info.plist, same dependencies.
After various dead ends, I ended up building a simple test kext using
Xcode 3.2.2 that exhibits the load problem. The test kext can be compiled
with or without 100 empty void(void) functions. With the 100 empty
functions the kext fails validation check by kextutil. Without the 100
empty functions it passes validation. This behavior is similar to the
broken production kext, where if I rip out enough seemingly irrelevent
code it eventually starts to load. The failure with the test does not
explain why my second working production kext loads fine even though it
has many more symbols than the test kext.
The test kext source is at the end of the e-mail. I built and tested the
kext using a boilerplate new generic kext project named "kext" generated
by xcode 3.2.2 on a 10.6.3 system running the 32 bit kernel. I changed
none of the project settings, just edited the generated kext.c and
Info.plist files. Commenting out the "#define F_100" line in kext.c
should yield a broken kext. Both versions of the kext load on 10.5.8 .
(build project)
(copy build/Debug/kext.kext to /System/Library/Extensions/kext.kext/ w/ proper permissions)
host-116-122:kext joe$ sudo kextutil -n -v 6 /System/Library/Extensions/kext.kext
Kext user-space log filter changed from 0xff2 to 0xfff.
Kext kernel-space log filter changed from 0xff2 to 0xfff.
Kext library architecture set to i386.
No kernel file specified; using running kernel for linking.
Kext library recording diagnostics for: validation authentication dependencies warnings.
/System/Library/Extensions/kext.kext is invalid; can't resolve dependencies.
/System/Library/Extensions/kext.kext is invalid; can't resolve dependencies.
/System/Library/Extensions/kext.kext has problems:
Validation Failures:
Executable file doesn't contain kernel extension code (no kmod_info symbol or bad Mach-O layout).
(comment out #define F_100 line in kext.c)
(build project)
(copy build/Debug/kext.kext to /System/Library/Extensions/kext.kext/ w/ proper permissions)
host-116-122:kext joe$ sudo kextutil -n -v 6 /System/Library/Extensions/kext.kext
Kext user-space log filter changed from 0xff2 to 0xfff.
Kext kernel-space log filter changed from 0xff2 to 0xfff.
Kext library architecture set to i386.
No kernel file specified; using running kernel for linking.
Kext library recording diagnostics for: validation authentication dependencies warnings.
(kernel) Received 'Get Kernel Link State' request from user space.
(kernel) Returning kernel link state.
/System/Library/Extensions/kext.kext appears to be loadable (including linkage for on-disk libraries).
host-116-122:kext joe$
Be sure and use the debug build so the compiler does not optimize
away the empty functions.
Any help would be appreciated.
Joe L.
--- start kext.c ---
#include <mach/mach_types.h>
// comment/uncomment following line
#define F_100
#ifdef F_100
static void f00(void) { }
static void f01(void) { }
static void f02(void) { }
static void f03(void) { }
static void f04(void) { }
static void f05(void) { }
static void f06(void) { }
static void f07(void) { }
static void f08(void) { }
static void f09(void) { }
static void f10(void) { }
static void f11(void) { }
static void f12(void) { }
static void f13(void) { }
static void f14(void) { }
static void f15(void) { }
static void f16(void) { }
static void f17(void) { }
static void f18(void) { }
static void f19(void) { }
static void f20(void) { }
static void f21(void) { }
static void f22(void) { }
static void f23(void) { }
static void f24(void) { }
static void f25(void) { }
static void f26(void) { }
static void f27(void) { }
static void f28(void) { }
static void f29(void) { }
static void f30(void) { }
static void f31(void) { }
static void f32(void) { }
static void f33(void) { }
static void f34(void) { }
static void f35(void) { }
static void f36(void) { }
static void f37(void) { }
static void f38(void) { }
static void f39(void) { }
static void f40(void) { }
static void f41(void) { }
static void f42(void) { }
static void f43(void) { }
static void f44(void) { }
static void f45(void) { }
static void f46(void) { }
static void f47(void) { }
static void f48(void) { }
static void f49(void) { }
static void f50(void) { }
static void f51(void) { }
static void f52(void) { }
static void f53(void) { }
static void f54(void) { }
static void f55(void) { }
static void f56(void) { }
static void f57(void) { }
static void f58(void) { }
static void f59(void) { }
static void f60(void) { }
static void f61(void) { }
static void f62(void) { }
static void f63(void) { }
static void f64(void) { }
static void f65(void) { }
static void f66(void) { }
static void f67(void) { }
static void f68(void) { }
static void f69(void) { }
static void f70(void) { }
static void f71(void) { }
static void f72(void) { }
static void f73(void) { }
static void f74(void) { }
static void f75(void) { }
static void f76(void) { }
static void f77(void) { }
static void f78(void) { }
static void f79(void) { }
static void f80(void) { }
static void f81(void) { }
static void f82(void) { }
static void f83(void) { }
static void f84(void) { }
static void f85(void) { }
static void f86(void) { }
static void f87(void) { }
static void f88(void) { }
static void f89(void) { }
static void f90(void) { }
static void f91(void) { }
static void f92(void) { }
static void f93(void) { }
static void f94(void) { }
static void f95(void) { }
static void f96(void) { }
static void f97(void) { }
static void f98(void) { }
static void f99(void) { }
static void f0(void) { f00(); f01(); f02(); f03(); f04(); f05(); f06(); f07(); f08(); f09(); }
static void f1(void) { f10(); f11(); f12(); f13(); f14(); f15(); f16(); f17(); f18(); f19(); }
static void f2(void) { f20(); f21(); f22(); f23(); f24(); f25(); f26(); f27(); f28(); f29(); }
static void f3(void) { f30(); f31(); f32(); f33(); f34(); f35(); f36(); f37(); f38(); f39(); }
static void f4(void) { f40(); f41(); f42(); f43(); f44(); f45(); f46(); f47(); f48(); f49(); }
static void f5(void) { f50(); f51(); f52(); f53(); f54(); f55(); f56(); f57(); f58(); f59(); }
static void f6(void) { f60(); f61(); f62(); f63(); f64(); f65(); f66(); f67(); f68(); f69(); }
static void f7(void) { f70(); f71(); f72(); f73(); f74(); f75(); f76(); f77(); f78(); f79(); }
static void f8(void) { f80(); f81(); f82(); f83(); f84(); f85(); f86(); f87(); f88(); f89(); }
static void f9(void) { f90(); f91(); f92(); f93(); f94(); f95(); f96(); f97(); f98(); f99(); }
#endif
kern_return_t kext_start (kmod_info_t * ki, void * d) {
#ifdef F_100
f0(); f1(); f2(); f3(); f4(); f5(); f6(); f7(); f8(); f9();
#endif
return KERN_SUCCESS;
}
kern_return_t kext_stop (kmod_info_t * ki, void * d) {
return KERN_SUCCESS;
}
--- end kext.c ---
--- start Info.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>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>com.yourcompany.kext.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>KEXT</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>OSBundleLibraries</key>
<dict>
<key>com.apple.kpi.bsd</key>
<string>9.0.0</string>
<key>com.apple.kpi.libkern</key>
<string>9.0.0</string>
</dict>
</dict>
</plist>
--- end Info.plist ---
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden