mbox series

[0/2] tracefs: inode alloc/free related fixes

Message ID 20240807115143.45927-1-minipli@grsecurity.net (mailing list archive)
Headers show
Series tracefs: inode alloc/free related fixes | expand

Message

Mathias Krause Aug. 7, 2024, 11:51 a.m. UTC
Hi Steven,

We ran into yet another tracefs related bug but, fortunately, were able
to root cause it ourselves.

The problem only occurs when CONFIG_RANDSTRUCT is enabled and one gets
(un)lucky to hit a random seed that'll overlay the 'rcu' member of the
union with a list_head in 'vfs_inode' -- quite unlikely but, apparently,
we're exceptional "lucky" with our testing ;)

The first patch is more of an API correctness fix, to bring the tracefs
inode cache in line with all the other filesystems. The second patch
actually fixes the bug, which, I think, may also be the cause for what
Ilkka is seeing[1].

Please apply!

Thanks,
Mathias

[1] https://lore.kernel.org/all/CAE4VaREzY+a2PvQJYJbfh8DwB4OP7kucZG-e28H22xyWob1w_A@mail.gmail.com/

Mathias Krause (2):
  tracefs: Fix inode allocation
  tracefs: Don't overlay 'struct inode'

 fs/tracefs/inode.c    | 2 +-
 fs/tracefs/internal.h | 6 ++----
 2 files changed, 3 insertions(+), 5 deletions(-)

Comments

Steven Rostedt Aug. 7, 2024, 1:34 p.m. UTC | #1
On Wed,  7 Aug 2024 13:51:37 +0200
Mathias Krause <minipli@grsecurity.net> wrote:

> Hi Steven,
> 
> We ran into yet another tracefs related bug but, fortunately, were able
> to root cause it ourselves.
> 
> The problem only occurs when CONFIG_RANDSTRUCT is enabled and one gets
> (un)lucky to hit a random seed that'll overlay the 'rcu' member of the
> union with a list_head in 'vfs_inode' -- quite unlikely but, apparently,
> we're exceptional "lucky" with our testing ;)
> 
> The first patch is more of an API correctness fix, to bring the tracefs
> inode cache in line with all the other filesystems. The second patch
> actually fixes the bug, which, I think, may also be the cause for what
> Ilkka is seeing[1].

Ah, that would explain it, and why I never triggered it.

> 
> Please apply!

I have an update though.

-- Steve

> 
> Thanks,
> Mathias
> 
> [1] https://lore.kernel.org/all/CAE4VaREzY+a2PvQJYJbfh8DwB4OP7kucZG-e28H22xyWob1w_A@mail.gmail.com/
> 
> Mathias Krause (2):
>   tracefs: Fix inode allocation
>   tracefs: Don't overlay 'struct inode'
> 
>  fs/tracefs/inode.c    | 2 +-
>  fs/tracefs/internal.h | 6 ++----
>  2 files changed, 3 insertions(+), 5 deletions(-)
>