Re: socket creation synchronization
site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Thread-index: AcX54xG2UG/762XWEdqu1wANk3fXlAAFAmUE Thread-topic: socket creation synchronization User-agent: Microsoft-Entourage/11.2.1.051004 Hello, I'm calling this: socket_t so; sock_socket(PF_SYSTEM, SOCK_DGRAM, SYSPROTO_CONTROL, NULL, NULL, &so); This should be fine. It works almost all the time. ;-) In my stack trace shows sock_socket calling socreate, which calls pffindproto. struct protosw * pffindproto(family, protocol, type) int family, protocol, type; { register struct protosw *pr; lck_mtx_assert(domain_proto_mtx, LCK_MTX_ASSERT_NOTOWNED); lck_mtx_lock(domain_proto_mtx); pr = pffindproto_locked(family, protocol, type); lck_mtx_unlock(domain_proto_mtx); return (pr); } I die on the lck_mtx_assert, xnu-792.6.22/bsd/kern/uipc_domain.c:367. I'm still in the generic socket handling code at this point. The fact that I'm creating a SYSPROTO_CONTROL socket shouldn't matter. I think a userland socket may be holding the domain_proto_mtx lock. A remote employee is the only one that cause the crash consistently, I've been relying on his panic.log. A two-machine debug remains elusive. Thanks, vitale Subject: Re: socket creation synchronization From: Josh Graessley <email@hidden> Date: Mon, 5 Dec 2005 15:15:52 -0800 Delivered-to: email@hidden Delivered-to: email@hidden What type of socket are you creating? What gets passed in so sock_socket for domain, type and protocol? Adding to the list of protocols by registering a new protosw or domain structure is not supported. The locking model has not been documented. -josh On 12/5/05 4:30 PM, "Christopher Vitale" <cvitale@trustednetworktech.com> wrote:
Hello List,
I have a question about socket creation in 10.4.3.
You can arrive at socreate by calling the kpi sock_socket, or from the userland syscall socket. Regardless, socreate calls pffindproto or pffindtype. These domain functions both assert that nobody else is holding a certain lock. How is this guaranteed? There isn't even a funnel associated with the socket syscall in syscalls.master. I looked around the source for a while but nothing jumped out at me.
I'm interested because I've got a kext that creates a connection via sock_socket. When I call sock_socket while other (userland) sockets are being created I'll occasionally die a horrible death on the pffindproto lock assert. I'll only create a single connection for the life of the kext. Does socket creation in the kernel bypass synchronization at a higher level?
Also, the socket I create is a system socket to another kext. Is this an appropriate way for kexts to share information? I take the necessary precautions like not allowing the server kext to unload while connected, forcing the client kext to disconnect when unloaded, etc.
Thanks,
vitale
_______________________________________________ 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/cvitale%40trustednetwor... ech.com
This email sent to cvitale@trustednetworktech.com
_______________________________________________ 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)
-
Christopher Vitale