Re: [PATCH] eventfs: Have inodes have unique inode numbers

From: Linus Torvalds
Date: Sun Jan 28 2024 - 23:01:55 EST


On Sun, 28 Jan 2024 at 19:40, Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
>
> [ 106.258400] BUG: KASAN: slab-use-after-free in tracing_open_file_tr+0x3a/0x120
> [ 106.261228] Read of size 8 at addr ffff8881136f27b8 by task cat/868

Are you refcounting the pointers that you have in the dentries (and
inodes)? Like we talked about you needing to do?

Every time you assign a pointer to d_fsdata, you need to kref_get() it.

You try to work around the tracefs weaknesses by trying to clean up
the dentry data, but it's WRONG.

You should refcount the data properly, so that you don't NEED to clean it out.

Linus