Kernel panic with 64bit Snow Leopard and sendAsyncNotification
site_archiver@lists.apple.com Delivered-To: Darwin-kernel@lists.apple.com Thread-index: AclmznNcsBPNqTjSTaSfJPWbJNhn9w== Thread-topic: Kernel panic with 64bit Snow Leopard and sendAsyncNotification I'm trying to bring to work the kextension + application(32bit, compiled on SDK10.4) on 64 bit Snow Leopard and have permanent Kernel Panic when my kextension does sendAsyncNotification to application. The panic (it seems so) occurs in ipc_object_copyin_from_kernel -> ip_lock(port) -> mutex_lock(...) The code looks usual (in the end of the mail).. Anyway, my thoughts that user mode application should not be able to send the kernel to panic, so the mach_port should be checked somewhere in kernel, so it seems to be a problem somewhere in 10.6, doesn't it? Or may be it is I that missing something.. I know, that recent sources do the callbacks using the IOConnectCallAsyncMethod, but I don't see the reason why this code causes panics. Could someone please point me to directions to look for? (32-bit 10.6 works ok) Thanks in advance! --- Dmitry Skorodumov PS: Below goes the application and extension --- Application: io_connect_t conn; // initialized somewhere IONotificationPortRef nport; // nport = IONotificationPortCreate(kIOMasterPortDefault) typedef void (*notify_func)(void *ref, IOReturn r); int init() { notify_func func; // initialized to point to my callback // ... mach_port_t port = IONotificationPortGetMachPort(nport) if ( IOConnectSetNotificationPort(conn, 0/*type*/, port, some_ctx) != KERN_SUCCESS) return -1; if ( IOConnectMethodScalarIScalarO(conn, kMethodSetCallback, 1, 0, func) != KERN_SUCCESS ) return -1; return 0; } --- Extension: static struct notification_s { mach_port_t port; unsigned conn; notify_func callback; OSAsyncReference async; } notify; // is zeroed somewhere IOReturn Xxx_UserClient::registerNotificationPort( mach_port_t port, UInt32 type, UInt32 conn) { notify.port = port; notify.conn = conn; } IOReturn XXX_PrlnetUserClient::iomsetcb( notify_func callback) { if (!this->notify.port || !callback) return kIOReturnError; setAsyncReference( notify.async, notify.port, (void *)callback, (void *) notify.conn); } And to fire the callback, XXX_PrlnetUserClient::Xxx_Fire() { if (!notify.port ) return; this->sendAsyncResult( notify.async, kIOReturnSuccess, NULL/*args*/, 0/*nargs*/); } --- The end _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com
participants (1)
-
Dmitry Skorodumov