lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0b9b1239-8514-4a8d-b991-73f371a6aebf@intel.com>
Date: Mon, 7 Apr 2025 11:08:08 -0700
From: Reinette Chatre <reinette.chatre@...el.com>
To: James Morse <james.morse@....com>, <x86@...nel.org>,
	<linux-kernel@...r.kernel.org>
CC: Tony Luck <tony.luck@...el.com>, Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>, Dave Hansen
	<dave.hansen@...ux.intel.com>, <babu.moger@....com>, "Sebastian Andrzej
 Siewior" <bigeasy@...utronix.de>
Subject: Re: [PATCH] x86/resctrl: Fix rdtgroup_mkdir()'s unlocked use of
 kernfs_node::name

Hi James,

On 4/7/25 5:46 AM, James Morse wrote:
> Since commit 741c10b096bc ("kernfs: Use RCU to access kernfs_node::name."),
> a helper rdt_kn_name() that checks that rdtgroup_mutex is held has been
> used for all accesses to the kernfs node name.
> 
> rdtgroup_mkdir() uses the name to determine if a valid monitor group is
> being created by checking the parent name is "mon_groups". This is done
> without holding rdtgroup_mutex, and now triggers the following warning:
> | WARNING: suspicious RCU usage
> | 6.15.0-rc1 #4465 Tainted: G            E
> | -----------------------------
> | arch/x86/kernel/cpu/resctrl/internal.h:408 suspicious rcu_dereference_check() usage!
> [...]
> | Call Trace:
> |  <TASK>
> |  dump_stack_lvl+0x6c/0xa0
> |  lockdep_rcu_suspicious.cold+0x4e/0x96
> |  is_mon_groups+0xba/0xd0
> |  rdtgroup_mkdir+0x118/0x1970
> |  kernfs_iop_mkdir+0xfa/0x1a0
> |  vfs_mkdir+0x456/0x760
> |  do_mkdirat+0x257/0x310
> |  __x64_sys_mkdir+0xd4/0x120
> |  do_syscall_64+0x6d/0x150
> |  entry_SYSCALL_64_after_hwframe+0x76/0x7e
> 
> Creating a control or monitor group calls mkdir_rdt_prepare(), which uses
> rdtgroup_kn_lock_live() to take the rdtgroup_mutex.
> 
> To avoid taking and dropping the lock, move the check for the monitor group
> name and position into mkdir_rdt_prepare() so that it occurs under
> rdtgroup_mutex. Hoist is_mon_groups() earlier in the file.
> 
> CC: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
> Fixes: 741c10b096bc ("kernfs: Use RCU to access kernfs_node::name.")
> Signed-off-by: James Morse <james.morse@....com>
> ---

Thank you very much.

Reviewed-by: Reinette Chatre <reinette.chatre@...el.com>

Reinette


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ