Messages in this thread Patch in this message | | | Date | Mon, 29 May 2023 14:22:56 +0200 | From | Oleg Nesterov <> | Subject | Re: [PATCH v9] kernel/fork: beware of __put_task_struct calling context |
| |
On 05/17, Wander Lairson Costa wrote: > > On Wed, May 17, 2023 at 12:26 PM Oleg Nesterov <oleg@redhat.com> wrote: > > > > LGTM but we still need to understand the possible problems with CONFIG_PROVE_RAW_LOCK_NESTING ... > > > > Again, I'll try to investigate when I have time although I am not sure I can really help. > > > > Perhaps you too can try to do this ? ;) > > > > FWIW, I tested this patch with CONFIG_PROVE_LOCK_NESTING in RT and > stock kernels. No splat happened.
Strange... FYI, I am running the kernel with this patch
diff --git a/kernel/sys.c b/kernel/sys.c index 339fee3eff6a..3169cceddf3b 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -2412,6 +2412,17 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3, error = 0; switch (option) { + case 666: { + static DEFINE_SPINLOCK(l); + static DEFINE_RAW_SPINLOCK(r); + + raw_spin_lock(&r); + spin_lock(&l); + spin_unlock(&l); + raw_spin_unlock(&r); + + break; + } case PR_SET_PDEATHSIG: if (!valid_signal(arg2)) { error = -EINVAL;
applied (because I am too lazy to compile a module ;) and
# perl -e 'syscall 157,666'
triggers the lockdep bug
============================= [ BUG: Invalid wait context ] 6.4.0-rc2-00018-g4d6d4c7f541d-dirty #1176 Not tainted ----------------------------- perl/35 is trying to lock: ffffffff81c4cc18 (l){....}-{3:3}, at: __do_sys_prctl+0x21b/0x87b other info that might help us debug this: context-{5:5} ...
as expected.
Looks like your testing was wrong... Or maybe you missed another lockdep problem ? Did you check dmesg? Perhaps lockdep detected another bug,say, even at boot time ? In this case debug_locks_off() sets debug_locks = 0 and this disables lockdep. Oleg.
| |