On Thu, Oct 03, 2024 at 11:13:54AM GMT, Christian Brauner wrote: > 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@xxxxxxxxxx> > > Cc: Christian Brauner <brauner@xxxxxxxxxx> > > Cc: Amir Goldstein <amir73il@xxxxxxxxx> > > Signed-off-by: Andrii Nakryiko <andrii@xxxxxxxxxx> > > --- > > Reviewed-by: Christian Brauner <brauner@xxxxxxxxxx> Fwiw, I have another patch series for files that I'm testing that will require me to switch FMODE_BACKING to a SLAB_TYPSAFE_BY_RCU cache. That shouldn't matter for your use-case though.