lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Wed, 26 May 2010 21:06:00 -0700 (PDT) From: David Miller <davem@...emloft.net> To: anton@...ba.org Cc: eric.dumazet@...il.com, netdev@...r.kernel.org Subject: Re: Warning in net/ipv4/af_inet.c:154 From: Anton Blanchard <anton@...ba.org> Date: Thu, 27 May 2010 13:56:17 +1000 > I'm somewhat confused by the two stage locking in the socket lock > (ie sk_lock.slock and sk_lock.owned). > > What state should the socket lock be in for serialising updates of > sk_forward_alloc? In some cases we appear to update it with sk_lock.slock = > unlocked, sk_lock.owned = 1: If sh_lock.owned=1 the user has grabbed exclusive sleepable lock on the socket, it does this via something approximating: retry: spin_lock(&sk_lock.slock); was_locked = sk_lock.owned; if (!was_locked) sk_lock.owned = 1; spin_unlock(&sk_lock.slock); if (was_locked) { sleep_on(condition(sk_lock.owned)); goto retry; } This allows user context code to sleep with exclusive access to the socket. Code that cannot sleep takes the spinlock, and queues the work if the owner field if non-zero. Else, it keeps the spinlock held and does the work. In either case, socket modifications are thus done completely protected from other contexts. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists