[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <24b66f6c-b8db-4f2d-bd46-e4417cda7ef7@suse.com>
Date: Mon, 30 Dec 2024 22:13:17 +0100
From: Petr Pavlu <petr.pavlu@...e.com>
To: Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Sami Tolvanen <samitolvanen@...gle.com>
Cc: linux-modules@...r.kernel.org, linux-kernel@...r.kernel.org,
Daniel Gomez <da.gomez@...sung.com>, Luis Chamberlain <mcgrof@...nel.org>,
"Paul E . McKenney" <paulmck@...nel.org>,
Peter Zijlstra <peterz@...radead.org>, Thomas Gleixner <tglx@...utronix.de>,
Elliot Berman <quic_eberman@...cinc.com>, Kees Cook <kees@...nel.org>,
Nathan Chancellor <nathan@...nel.org>, Steven Rostedt <rostedt@...dmis.org>,
llvm@...ts.linux.dev
Subject: Re: [PATCH v2 28/28] cfi: Use RCU while invoking __module_address().
On 12/20/24 18:41, Sebastian Andrzej Siewior wrote:
> __module_address() can be invoked within a RCU section, there is no
> requirement to have preemption disabled.
>
> I'm not sure if using rcu_read_lock() will introduce the regression that
> has been fixed in commit 14c4c8e41511a ("cfi: Use
> rcu_read_{un}lock_sched_notrace").
>
> Cc: Elliot Berman <quic_eberman@...cinc.com>
> Cc: Kees Cook <kees@...nel.org>
> Cc: Nathan Chancellor <nathan@...nel.org>
> Cc: Sami Tolvanen <samitolvanen@...gle.com>
> Cc: Steven Rostedt <rostedt@...dmis.org>
> Cc: llvm@...ts.linux.dev
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
> ---
> kernel/cfi.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/kernel/cfi.c b/kernel/cfi.c
> index 08caad7767176..c8f2b5a51b2e6 100644
> --- a/kernel/cfi.c
> +++ b/kernel/cfi.c
> @@ -71,6 +71,10 @@ static bool is_module_cfi_trap(unsigned long addr)
> struct module *mod;
> bool found = false;
>
> + /*
> + * XXX this could be RCU protected but would it introcude the regression
> + * fixed in 14c4c8e41511a ("cfi: Use rcu_read_{un}lock_sched_notrace")
> + */
> rcu_read_lock_sched_notrace();
>
> mod = __module_address(addr);
I think that since 89245600941e ("cfi: Switch to -fsanitize=kcfi"), this
can be a call to rcu_read_lock_sched(), or in your case rcu_read_lock().
The recursive case where __cfi_slowpath_diag() could end up calling
itself is no longer present, as all that logic is gone. I then don't see
another reason this should use the notrace variant.
@Sami, could you please confirm this?
--
Thanks,
Petr
Powered by blists - more mailing lists