Re: [syzbot] Re: [keyrings?] [lsm?] [ext4?] possible deadlock in keyring_clear (2)

From: syzbot
Date: Fri Sep 27 2024 - 05:27:27 EST


For archival purposes, forwarding an incoming command email to
linux-kernel@xxxxxxxxxxxxxxx.

***

Subject: Re: [keyrings?] [lsm?] [ext4?] possible deadlock in keyring_clear (2)
Author: lizhi.xu@xxxxxxxxxxxxx

tmp no use nofs

#syz test

diff --git a/init/main.c b/init/main.c
index c4778edae797..7e08a69fc432 100644
--- a/init/main.c
+++ b/init/main.c
@@ -1261,12 +1261,15 @@ int __init_or_module do_one_initcall(initcall_t fn)
int count = preempt_count();
char msgbuf[64];
int ret;
+ unsigned int nofs_flag;

if (initcall_blacklisted(fn))
return -EPERM;

do_trace_initcall_start(fn);
+ nofs_flag = memalloc_nofs_save();
ret = fn();
+ memalloc_nofs_restore(nofs_flag);
do_trace_initcall_finish(fn, ret);

msgbuf[0] = 0;