public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: "Mathias Krause" <minipli@grsecurity.net>,
	"Masami Hiramatsu" <mhiramat@kernel.org>,
	"Mathieu Desnoyers" <mathieu.desnoyers@efficios.com>,
	"Ajay Kaher" <ajay.kaher@broadcom.com>,
	linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Ilkka Naulapää" <digirigawa@gmail.com>,
	"Brad Spengler" <spender@grsecurity.net>
Subject: Re: [PATCH 2/2] tracefs: Don't overlay 'struct inode'
Date: Wed, 7 Aug 2024 14:44:53 +0100	[thread overview]
Message-ID: <20240807134453.GZ5334@ZenIV> (raw)
In-Reply-To: <20240807093545.4ec51d61@gandalf.local.home>

On Wed, Aug 07, 2024 at 09:35:45AM -0400, Steven Rostedt wrote:

> Perhaps:
> 
> diff --git a/fs/tracefs/internal.h b/fs/tracefs/internal.h
> index f704d8348357..ab6d6c3d835d 100644
> --- a/fs/tracefs/internal.h
> +++ b/fs/tracefs/internal.h
> @@ -10,12 +10,12 @@ enum {
>  };
>  
>  struct tracefs_inode {
> +	struct inode            vfs_inode;
> +	/* The below gets initialized with memset_after(ti, 0, vfs_inode) */
>  	union {
> -		struct inode            vfs_inode;
> +		struct list_head	list;
>  		struct rcu_head		rcu;
>  	};
> -	/* The below gets initialized with memset_after(ti, 0, vfs_inode) */
> -	struct list_head	list;
>  	unsigned long           flags;
>  	void                    *private;
>  };

	Your current variant gives you an RCU-delayed call of
tracefs_free_inode(), which schedules an RCU-delayed call of
tracefs_free_inode_rcu().

	Do you really need that double RCU delay to start with?
Because if you do not, just do that list_del_rcu() in ->destroy_inode()
(which is called without an RCU delay) and have kmem_cache_free()
in ->free_inode() (which is called *with* RCU delay started after
the call of ->destroy_inode()).

  reply	other threads:[~2024-08-07 13:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-07 11:51 [PATCH 0/2] tracefs: inode alloc/free related fixes Mathias Krause
2024-08-07 11:51 ` [PATCH 1/2] tracefs: Fix inode allocation Mathias Krause
2024-08-07 11:51 ` [PATCH 2/2] tracefs: Don't overlay 'struct inode' Mathias Krause
2024-08-07 13:35   ` Steven Rostedt
2024-08-07 13:44     ` Al Viro [this message]
2024-08-07 15:49       ` Steven Rostedt
2024-08-07 20:27         ` Mathias Krause
2024-08-07 20:24       ` Mathias Krause
2024-08-07 20:19     ` Mathias Krause
2024-08-07 13:34 ` [PATCH 0/2] tracefs: inode alloc/free related fixes Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240807134453.GZ5334@ZenIV \
    --to=viro@zeniv.linux.org.uk \
    --cc=ajay.kaher@broadcom.com \
    --cc=digirigawa@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=minipli@grsecurity.net \
    --cc=rostedt@goodmis.org \
    --cc=spender@grsecurity.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox