Re: Kernel panic with 64bit Snow Leopard and sendAsyncNotification
site_archiver@lists.apple.com Delivered-To: Darwin-kernel@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=0V7T9gPhbeqfz0slpQxV5RkDs6qCEtgyVaQ4/b8k2Rg=; b=GWsx9iZGAU5vC3dq22tJwZSwAzc5t6HKdZZ/vkqRGbh+CUof3M1Pd2o3mqxLwQqFzB Ljq5xWz+pgenL+oilbxe/yH5q2Gt23K1XOGMJXJH0rtIDD9fWO/hkJN0zT3jKFW1ss3J nEZoxfDqOzStcxcbM/zMp0ZprO7JoGk6KRFOU= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=Vj/Kp6iyB0d7ReXq6XonFnR8qnasJjXsAkU8Ys8gzNVeKlEYZqCShlcXeXBhocBv7s 9bPZwbYSFI9m2nPiASUdxXInoRgeC0JU+xpLbT3WOD4eIs7B0iyedeFJSMXDlhRS0ive 1pS3yNHgMgdQH6yjjgEMLacvH+JP+Vnbzdgz0= you should definitely alloc a pointer to your struct On Thu, Dec 25, 2008 at 12:22 PM, Dmitry Skorodumov <sdmitry@parallels.com> wrote:
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/openspecies%40gmail.com
This email sent to openspecies@gmail.com
-- -mmw _______________________________________________ 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)
-
mm w