tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

compat linux futex locking problem


While testing some threaded apps under amd64 NTPL linux emulation, i
discovered a locking problem with our futex implementation.

In most cases, futex_get() is called from linux_sys_futex() without
lock held, but there is one extra call in futex_wake() where the futex
lock is already hold ... leading to a panic.

I'm not sure about the correct way to fix it (i'm not a locking
specialist) and wanted to ask.

In the mean time, i checked the corresponding code in FreeBSD which
added an extra argument to futex_get to record if the lock is already
hold. But that does not seems right to me, especially because
futex_get() can sleep for quite some time due to a call to
kmem_zalloc(x, KM_SLEEP).

Any hint/advice ?

Nicolas Joly

Biological Software and Databanks.
Institut Pasteur, Paris.

Home | Main Index | Thread Index | Old Index