Thread (19 messages) 19 messages, 5 authors, 2024-10-09

Re: [PATCH v2 tip/perf/core 3/5] fs: add back RCU-delayed freeing of FMODE_BACKING file

From: Christian Brauner <brauner@kernel.org>
Date: 2024-10-03 09:13:53
Also in: bpf, linux-mm, lkml

On Tue, Oct 01, 2024 at 03:52:05PM GMT, Andrii Nakryiko wrote:
6cf41fcfe099 ("backing file: free directly") switched FMODE_BACKING
files to direct freeing as back then there were no use cases requiring
RCU protected access to such files.

Now, with speculative lockless VMA-to-uprobe lookup logic, we do need to
have a guarantee that struct file memory is not going to be freed from
under us during speculative check. So add back RCU-delayed freeing
logic.

We use headless kfree_rcu_mightsleep() variant, as file_free() is only
called for FMODE_BACKING files in might_sleep() context.

Suggested-by: Suren Baghdasaryan <surenb@google.com>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
Reviewed-by: Christian Brauner <brauner@kernel.org>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help