Re: [PATCH] keys: serialise instantiation against keyctl_chown_key

From: kernel test robot

Date: Thu Nov 19 2026 - 19:51:14 EST



Hello,

kernel test robot noticed "WARNING:possible_circular_locking_dependency_detected" on:

commit: a22ea46d3e3ee6e7fbea90bd9b1ff61cdcdc96c1 ("[PATCH] keys: serialise instantiation against keyctl_chown_key")
url: https://github.com/intel-lab-lkp/linux/commits/Sinan-Turunc/keys-serialise-instantiation-against-keyctl_chown_key/20261115-121740
base: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git 23c62304dde29abe92013d85910d03a77dada35d
patch link: https://lore.kernel.org/all/20261115121722.206-1-enscrpt@xxxxx/
patch subject: [PATCH] keys: serialise instantiation against keyctl_chown_key

in testcase: trinity
version: trinity-x86_64-216a8b36b-1_20261116
with following parameters:

runtime: 300s
group: group-02
nr_groups: 5


config: x86_64-randconfig-121-20251020
compiler: gcc-14
test machine: qemu-system-x86_64 -enable-kvm -cpu Haswell-noTSX,enforce -smp 4 -m 16G

(please refer to attached dmesg/kmsg for entire log/backtrace)


If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <yi1.lai@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-lkp/202611192204.aa82996f-lkp@xxxxxxxxx


[ 227.133561][ T1501] WARNING: possible circular locking dependency detected
[ 227.137692][ T1501] 7.4.0-rc2-00717-ga22ea46d3e3e #1 Not tainted
[ 227.138989][ T1501] ------------------------------------------------------
[ 227.140436][ T1501] trinity-c3/1501 is trying to acquire lock:
[ 227.141691][ T1501] ffffffff838679e0 (keyring_serialise_link_lock){+.+.}-{4:4}, at: __key_move_lock (keys/keyring.c:1305)
[ 227.143815][ T1501] [ 227.143815][ T1501] but task is already holding lock:
[ 227.143815][ T1501]
[ 227.143815][ T1501] but task is already holding lock:
[ 227.143815][ T1501]
[ 227.143815][ T1501] but task is already holding lock:
[ 227.145340][ T1501] ffff88812a091e08 (&type->lock_class/1){+.+.}-{4:4}, at: __key_move_lock (keys/keyring.c:1298)
[ 227.147290][ T1501]
[ 227.147290][ T1501] which lock already depends on the new lock.
[ 227.147290][ T1501]
[ 227.147290][ T1501] which lock already depends on the new lock.
[ 227.147290][ T1501]
[ 227.147290][ T1501] which lock already depends on the new lock.
[ 227.147290][ T1501]
[ 227.149447][ T1501]
[ 227.149447][ T1501] the existing dependency chain (in reverse order) is:
[ 227.149447][ T1501]
[ 227.149447][ T1501] the existing dependency chain (in reverse order) is:
[ 227.149447][ T1501]
[ 227.149447][ T1501] the existing dependency chain (in reverse order) is:
[ 227.151296][ T1501]
[ 227.151296][ T1501] -> #2 (&type->lock_class/1){+.+.}-{4:4}:
[ 227.151296][ T1501]
[ 227.151296][ T1501] -> #2 (&type->lock_class/1){+.+.}-{4:4}:
[ 227.151296][ T1501]
[ 227.151296][ T1501] -> #2 (&type->lock_class/1){+.+.}-{4:4}:
[ 227.152939][ T1501] validate_chain (locking/lockdep.c:3328 locking/lockdep.c:3952)
[ 227.154012][ T1501] __lock_acquire (locking/lockdep.c:5288)
[ 227.155085][ T1501] lock_acquire (trace/events/lock.h:23 (discriminator 1) locking/lockdep.c:5905 (discriminator 1))
[ 227.156219][ T1501] lock_acquire (locking/lockdep.c:5907)
[ 227.157219][ T1501] down_write_nested (locking/rwsem.c:1757 (discriminator 1))
[ 227.158300][ T1501] __key_instantiate_and_link (keys/key.c:451)
[ 227.159581][ T1501] key_instantiate_and_link (keys/key.c:549)
[ 227.160804][ T1501] keyring_alloc (keys/keyring.c:541)
[ 227.161819][ T1501] blacklist_init (blacklist.c:337)
[ 227.162888][ T1501] do_one_initcall (main.c:1419)
[ 227.163950][ T1501] do_initcalls (main.c:1481 (discriminator 1) main.c:1497 (discriminator 1))
[ 227.164975][ T1501] kernel_init_freeable (main.c:1517 main.c:1732)
[ 227.166136][ T1501] kernel_init (main.c:1622)
[ 227.167132][ T1501] ret_from_fork (x86/kernel/process.c:158)
[ 227.168163][ T1501] ret_from_fork_asm (x86/entry/entry_64.S:245)
[ 227.169265][ T1501]
[ 227.169265][ T1501] -> #1 (key_construction_mutex){+.+.}-{4:4}:
[ 227.169265][ T1501]
[ 227.169265][ T1501] -> #1 (key_construction_mutex){+.+.}-{4:4}:
[ 227.169265][ T1501]
[ 227.169265][ T1501] -> #1 (key_construction_mutex){+.+.}-{4:4}:
[ 227.170969][ T1501] validate_chain (locking/lockdep.c:3328 locking/lockdep.c:3952)
[ 227.172036][ T1501] __lock_acquire (locking/lockdep.c:5288)
[ 227.173115][ T1501] lock_acquire (trace/events/lock.h:23 (discriminator 1) locking/lockdep.c:5905 (discriminator 1))
[ 227.189495][ T1501] lock_acquire (locking/lockdep.c:5907)
[ 227.191295][ T1501] __mutex_lock (locking/mutex.c:646 locking/mutex.c:821)
[ 227.193002][ T1501] mutex_lock_nested (locking/mutex.c:874 (discriminator 1))
[ 227.194980][ T1501] __key_instantiate_and_link (keys/key.c:443)
[ 227.197215][ T1501] key_instantiate_and_link (keys/key.c:549)
[ 227.199432][ T1501] keyring_alloc (keys/keyring.c:541)
[ 227.201173][ T1501] look_up_user_keyrings (keys/process_keys.c:116)
[ 227.202572][ T1501] init_root_keyring (keys/process_keys.c:1044)
[ 227.217442][ T1501] do_one_initcall (main.c:1419)
[ 227.219309][ T1501] do_initcalls (main.c:1481 (discriminator 1) main.c:1497 (discriminator 1))
[ 227.221127][ T1501] kernel_init_freeable (main.c:1517 main.c:1732)
[ 227.223114][ T1501] kernel_init (main.c:1622)
[ 227.224834][ T1501] ret_from_fork (x86/kernel/process.c:158)
[ 227.226598][ T1501] ret_from_fork_asm (x86/entry/entry_64.S:245)
[ 227.228485][ T1501]
[ 227.228485][ T1501] -> #0 (keyring_serialise_link_lock){+.+.}-{4:4}:
[ 227.228485][ T1501]
[ 227.228485][ T1501] -> #0 (keyring_serialise_link_lock){+.+.}-{4:4}:
[ 227.228485][ T1501]
[ 227.228485][ T1501] -> #0 (keyring_serialise_link_lock){+.+.}-{4:4}:
[ 227.231311][ T1501] check_noncircular (locking/lockdep.c:2219)
[ 227.233160][ T1501] check_prev_add (locking/lockdep.c:3209)
[ 227.235032][ T1501] validate_chain (locking/lockdep.c:3328 locking/lockdep.c:3952)
[ 227.236844][ T1501] __lock_acquire (locking/lockdep.c:5288)
[ 227.238525][ T1501] lock_acquire (trace/events/lock.h:23 (discriminator 1) locking/lockdep.c:5905 (discriminator 1))
[ 227.240157][ T1501] lock_acquire (locking/lockdep.c:5907)
[ 227.241603][ T1501] __mutex_lock (locking/mutex.c:646 locking/mutex.c:821)
[ 227.242975][ T1501] mutex_lock_nested (locking/mutex.c:874 (discriminator 1))
[ 227.244070][ T1501] __key_move_lock (keys/keyring.c:1305)
[ 227.245152][ T1501] key_move (keys/keyring.c:1634)
[ 227.246096][ T1501] keyctl_keyring_move (keys/keyctl.c:618 (discriminator 3))
[ 227.247227][ T1501] __do_sys_keyctl (keys/keyctl.c:2023)
[ 227.248314][ T1501] __x64_sys_keyctl (keys/keyctl.c:1885 keys/keyctl.c:1885)
[ 227.249389][ T1501] x64_sys_call (kbuild/obj/consumer/x86_64-randconfig-121-20251020/./arch/x86/include/generated/asm/syscalls_64.h:251)
[ 227.250447][ T1501] do_syscall_64 (x86/entry/syscall_64.c:61 x86/entry/syscall_64.c:89)
[ 227.251533][ T1501] entry_SYSCALL_64_after_hwframe (x86/entry/entry_64.S:121)
[ 227.252848][ T1501]
[ 227.252848][ T1501] other info that might help us debug this:
[ 227.252848][ T1501]
[ 227.252848][ T1501] other info that might help us debug this:
[ 227.252848][ T1501]
[ 227.252848][ T1501] other info that might help us debug this:
[ 227.252848][ T1501]
[ 227.255005][ T1501] Chain exists of:
[ 227.255005][ T1501] keyring_serialise_link_lock --> key_construction_mutex --> &type->lock_class/1
[ 227.255005][ T1501]


The kernel config and materials to reproduce are available at:
https://download.01.org/0day-ci/archive/20261119/202611192204.aa82996f-lkp@xxxxxxxxx


--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki