linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] tracefs: Annotate tracefs_ops with __ro_after_init
@ 2018-07-25 17:19 Zubin Mithra
  2018-07-25 18:00 ` Kees Cook
  0 siblings, 1 reply; 4+ messages in thread
From: Zubin Mithra @ 2018-07-25 17:19 UTC (permalink / raw)
  To: rostedt, linux-kernel; +Cc: keescook, groeck, zsm

tracefs_ops is initialized inside tracefs_create_instance_dir and not
modified after. tracefs_create_instance_dir allows for initialization
only once, and is called from create_trace_instances(marked __init),
which is called from tracer_init_tracefs(marked __init). Also, mark
tracefs_create_instance_dir as __init.

Signed-off-by: Zubin Mithra <zsm@chromium.org>
---
 fs/tracefs/inode.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
index bea8ad876bf9..7098c49f3693 100644
--- a/fs/tracefs/inode.c
+++ b/fs/tracefs/inode.c
@@ -53,7 +53,7 @@ static const struct file_operations tracefs_file_operations = {
 static struct tracefs_dir_ops {
 	int (*mkdir)(const char *name);
 	int (*rmdir)(const char *name);
-} tracefs_ops;
+} tracefs_ops __ro_after_init;
 
 static char *get_dname(struct dentry *dentry)
 {
@@ -478,7 +478,8 @@ struct dentry *tracefs_create_dir(const char *name, struct dentry *parent)
  *
  * Returns the dentry of the instances directory.
  */
-struct dentry *tracefs_create_instance_dir(const char *name, struct dentry *parent,
+__init struct dentry *tracefs_create_instance_dir(const char *name,
+					  struct dentry *parent,
 					  int (*mkdir)(const char *name),
 					  int (*rmdir)(const char *name))
 {
-- 
2.18.0.233.g985f88cf7e-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] tracefs: Annotate tracefs_ops with __ro_after_init
  2018-07-25 17:19 [PATCH v2] tracefs: Annotate tracefs_ops with __ro_after_init Zubin Mithra
@ 2018-07-25 18:00 ` Kees Cook
  2018-07-31  0:25   ` Kees Cook
  0 siblings, 1 reply; 4+ messages in thread
From: Kees Cook @ 2018-07-25 18:00 UTC (permalink / raw)
  To: Zubin Mithra; +Cc: Steven Rostedt, LKML, Guenter Roeck

On Wed, Jul 25, 2018 at 10:19 AM, Zubin Mithra <zsm@chromium.org> wrote:
> tracefs_ops is initialized inside tracefs_create_instance_dir and not
> modified after. tracefs_create_instance_dir allows for initialization
> only once, and is called from create_trace_instances(marked __init),
> which is called from tracer_init_tracefs(marked __init). Also, mark
> tracefs_create_instance_dir as __init.
>
> Signed-off-by: Zubin Mithra <zsm@chromium.org>

Reviewed-by: Kees Cook <keescook@chromium.org>

-Kees

> ---
>  fs/tracefs/inode.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
> index bea8ad876bf9..7098c49f3693 100644
> --- a/fs/tracefs/inode.c
> +++ b/fs/tracefs/inode.c
> @@ -53,7 +53,7 @@ static const struct file_operations tracefs_file_operations = {
>  static struct tracefs_dir_ops {
>         int (*mkdir)(const char *name);
>         int (*rmdir)(const char *name);
> -} tracefs_ops;
> +} tracefs_ops __ro_after_init;
>
>  static char *get_dname(struct dentry *dentry)
>  {
> @@ -478,7 +478,8 @@ struct dentry *tracefs_create_dir(const char *name, struct dentry *parent)
>   *
>   * Returns the dentry of the instances directory.
>   */
> -struct dentry *tracefs_create_instance_dir(const char *name, struct dentry *parent,
> +__init struct dentry *tracefs_create_instance_dir(const char *name,
> +                                         struct dentry *parent,
>                                           int (*mkdir)(const char *name),
>                                           int (*rmdir)(const char *name))
>  {
> --
> 2.18.0.233.g985f88cf7e-goog
>



-- 
Kees Cook
Pixel Security

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] tracefs: Annotate tracefs_ops with __ro_after_init
  2018-07-25 18:00 ` Kees Cook
@ 2018-07-31  0:25   ` Kees Cook
  2018-07-31 15:31     ` Steven Rostedt
  0 siblings, 1 reply; 4+ messages in thread
From: Kees Cook @ 2018-07-31  0:25 UTC (permalink / raw)
  To: Zubin Mithra; +Cc: Steven Rostedt, LKML, Guenter Roeck

On Wed, Jul 25, 2018 at 11:00 AM, Kees Cook <keescook@chromium.org> wrote:
> On Wed, Jul 25, 2018 at 10:19 AM, Zubin Mithra <zsm@chromium.org> wrote:
>> tracefs_ops is initialized inside tracefs_create_instance_dir and not
>> modified after. tracefs_create_instance_dir allows for initialization
>> only once, and is called from create_trace_instances(marked __init),
>> which is called from tracer_init_tracefs(marked __init). Also, mark
>> tracefs_create_instance_dir as __init.
>>
>> Signed-off-by: Zubin Mithra <zsm@chromium.org>
>
> Reviewed-by: Kees Cook <keescook@chromium.org>

Steve, do you have a tree for this or should we rope akpm in? :)

-Kees

-- 
Kees Cook
Pixel Security

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] tracefs: Annotate tracefs_ops with __ro_after_init
  2018-07-31  0:25   ` Kees Cook
@ 2018-07-31 15:31     ` Steven Rostedt
  0 siblings, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2018-07-31 15:31 UTC (permalink / raw)
  To: Kees Cook; +Cc: Zubin Mithra, LKML, Guenter Roeck

On Mon, 30 Jul 2018 17:25:06 -0700
Kees Cook <keescook@chromium.org> wrote:

> On Wed, Jul 25, 2018 at 11:00 AM, Kees Cook <keescook@chromium.org> wrote:
> > On Wed, Jul 25, 2018 at 10:19 AM, Zubin Mithra <zsm@chromium.org> wrote:  
> >> tracefs_ops is initialized inside tracefs_create_instance_dir and not
> >> modified after. tracefs_create_instance_dir allows for initialization
> >> only once, and is called from create_trace_instances(marked __init),
> >> which is called from tracer_init_tracefs(marked __init). Also, mark
> >> tracefs_create_instance_dir as __init.
> >>
> >> Signed-off-by: Zubin Mithra <zsm@chromium.org>  
> >
> > Reviewed-by: Kees Cook <keescook@chromium.org>  
> 
> Steve, do you have a tree for this or should we rope akpm in? :)
>

I'll pull it in. I'm currently working on a bunch of small patches for
the merge window now anyway.

Thanks!

-- Steve

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-07-31 15:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-25 17:19 [PATCH v2] tracefs: Annotate tracefs_ops with __ro_after_init Zubin Mithra
2018-07-25 18:00 ` Kees Cook
2018-07-31  0:25   ` Kees Cook
2018-07-31 15:31     ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).