[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240201030205.GT2087318@ZenIV>
Date: Thu, 1 Feb 2024 03:02:05 +0000
From: Al Viro <viro@...iv.linux.org.uk>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org,
Linus Torvalds <torvalds@...ux-foundation.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Christian Brauner <brauner@...nel.org>,
Ajay Kaher <ajay.kaher@...adcom.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org
Subject: Re: [PATCH v2 4/7] tracefs: dentry lookup crapectomy
On Wed, Jan 31, 2024 at 09:26:42PM -0500, Steven Rostedt wrote:
> > Huh? Just return NULL and be done with that - you'll get an
> > unhashed negative dentry and let the caller turn that into
> > -ENOENT...
>
> We had a problem here with just returning NULL. It leaves the negative
> dentry around and doesn't get refreshed.
Why would that dentry stick around? And how would anyone find
it, anyway, when it's not hashed?
> I did this:
>
> # cd /sys/kernel/tracing
> # ls events/kprobes/sched/
> ls: cannot access 'events/kprobes/sched/': No such file or directory
> # echo 'p:sched schedule' >> kprobe_events
> # ls events/kprobes/sched/
> ls: cannot access 'events/kprobes/sched/': No such file or directory
>
> When it should have been:
>
> # ls events/kprobes/sched/
> enable filter format hist hist_debug id inject trigger
>
> Leaving the negative dentry there will have it fail when the directory
> exists the next time.
Then you have something very deeply fucked up. NULL or ERR_PTR(-ENOENT)
from ->lookup() in the last component of open() would do exactly the
same thing: dput() whatever had been passed to ->lookup() and fail
open(2) with -ENOENT.
Powered by blists - more mailing lists