From: Eduard Zateev <hackerowskiy@gmail.com>
To: dhowells@redhat.com, jarkko@kernel.org, paul@paul-moore.com,
jmorris@namei.org, serge@hallyn.com
Cc: keyrings@vger.kernel.org, linux-security-module@vger.kernel.org,
linux-kernel@vger.kernel.org,
syzbot+c15de43f1e7fffbb7b9b@syzkaller.appspotmail.com,
syzkaller-bugs@googlegroups.com,
Eduard Zateev <hackerowskiy@gmail.com>
Subject: [PATCH] keys: use long workqueue for garbage collection
Date: Sat, 24 Oct 2026 06:29:44 +0200 [thread overview]
Message-ID: <20261024042944.52493-1-hackerowskiy@gmail.com> (raw)
The key garbage collector can wait for RCU grace periods. This can occupy a
normal events worker for a long time and contribute to workqueue lockups.
Queue key GC on system_long_wq because its work may wait for long periods.
Reported-by: syzbot+c15de43f1e7fffbb7b9b@syzkaller.appspotmail.com
Link: https://syzkaller.appspot.com/bug?extid=c15de43f1e7fffbb7b9b
Signed-off-by: Eduard Zateev <hackerowskiy@gmail.com>
---
security/keys/gc.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/security/keys/gc.c b/security/keys/gc.c
index eda445f815d..b174b8c511b 100644
--- a/security/keys/gc.c
+++ b/security/keys/gc.c
@@ -19,6 +19,7 @@ unsigned key_gc_delay = 5 * 60;
* Reaper for unused keys.
*/
static void key_garbage_collector(struct work_struct *work);
+/* Key GC may wait for RCU grace periods, so queue it on system_long_wq. */
DECLARE_WORK(key_gc_work, key_garbage_collector);
/*
@@ -57,7 +58,7 @@ void key_schedule_gc(time64_t gc_at)
if (gc_at <= now || test_bit(KEY_GC_REAP_KEYTYPE, &key_gc_flags)) {
kdebug("IMMEDIATE");
- schedule_work(&key_gc_work);
+ queue_work(system_long_wq, &key_gc_work);
} else if (gc_at < key_gc_next_run) {
kdebug("DEFERRED");
key_gc_next_run = gc_at;
@@ -85,7 +86,7 @@ void key_set_expiry(struct key *key, time64_t expiry)
void key_schedule_gc_links(void)
{
set_bit(KEY_GC_KEY_EXPIRED, &key_gc_flags);
- schedule_work(&key_gc_work);
+ queue_work(system_long_wq, &key_gc_work);
}
/*
@@ -119,7 +120,7 @@ void key_gc_keytype(struct key_type *ktype)
set_bit(KEY_GC_REAP_KEYTYPE, &key_gc_flags);
kdebug("schedule");
- schedule_work(&key_gc_work);
+ queue_work(system_long_wq, &key_gc_work);
kdebug("sleep");
wait_on_bit(&key_gc_flags, KEY_GC_REAPING_KEYTYPE,
@@ -322,7 +323,7 @@ static void key_garbage_collector(struct work_struct *work)
}
if (gc_state & KEY_GC_REAP_AGAIN)
- schedule_work(&key_gc_work);
+ queue_work(system_long_wq, &key_gc_work);
kleave(" [end %x]", gc_state);
return;
--
2.55.0
next reply other threads:[~2026-10-24 4:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-24 4:29 Eduard Zateev [this message]
2026-10-24 5:20 ` Jarkko Sakkinen
2026-10-24 5:37 ` Jarkko Sakkinen
2026-10-24 5:43 ` Jarkko Sakkinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261024042944.52493-1-hackerowskiy@gmail.com \
--to=hackerowskiy@gmail.com \
--cc=dhowells@redhat.com \
--cc=jarkko@kernel.org \
--cc=jmorris@namei.org \
--cc=keyrings@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=paul@paul-moore.com \
--cc=serge@hallyn.com \
--cc=syzbot+c15de43f1e7fffbb7b9b@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®