Re: Runtime trouble with commit dbd952127d (seccomp: introduce writer locking)

From: Guenter Roeck
Date: Sun Aug 10 2014 - 16:51:48 EST


On 08/10/2014 12:33 PM, Oleg Nesterov wrote:
On 08/09, Kees Cook wrote:
On Sat, Aug 9, 2014 at 6:47 PM, Guenter Roeck <private@xxxxxxxxxxxx> wrote:
Hi folks,

I am having some trouble with commit dbd952127d (seccomp: introduce
writer locking) when running my qemu tests on the upstream kernel.
Eek, sorry this is causing you trouble!

With powerpc, I get the following crash.

ftrace: allocating 20093 entries in 59 pages
------------[ cut here ]------------
kernel BUG at kernel/fork.c:1108!
For your tree, does this resolve to copy_seccomp()'s

BUG_ON(!spin_is_locked(&current->sighand->siglock));

line?
This is almost off-topic, and I too do not understand whats going on...
Some progress. SMP must be disabled for the problem to be seen.

The underlying spinlock structure, specifically arch_spinlock_t, is from
include/linux/spinlock_types_up.h (not as one would innocently assume
from arch/powerpc/include/asm/spinlock_types.h).

In include/linux/spinlock_types_up.h, arch_spinlock_t is defined as

typedef struct {
/* no debug version on UP */
} arch_rwlock_t;

if spinlock debugging is disabled. With this definition, it is obviously
not possible to detect if the spinlock is locked or not. Actually, the
same file defines

#define arch_spin_is_locked(lock) ((void)(lock), 0)

so the BUG is really not at all surprising.

That means that the broken configuration is (CONFIG_DEBUG_SPINLOCK=n, CONFIG_SMP=n).
It also means that the BUG_ON checks introduced with the seccomp commit
will cause this configuration to fail hard at least for architectures where CONFIG_SMP
can be disabled, and if those architectures use include/linux/spinlock_types_up.h.

Guenter

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/