All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: Djalal Harouni <tixxdz@gmail.com>
Cc: Kees Cook <keescook@chromium.org>,
	Alexey Gladkov <gladkov.alexey@gmail.com>,
	Andy Lutomirski <luto@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-hardening@lists.openwall.com,
	linux-security-module@vger.kernel.org, linux-api@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Akinobu Mita <akinobu.mita@gmail.com>,
	me@tobin.cc, Oleg Nesterov <oleg@redhat.com>,
	Jeff Layton <jlayton@poochiereds.net>,
	Ingo Molnar <mingo@kernel.org>,
	ebiederm@xmission.com,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Daniel Micay <danielmicay@gmail.com>,
	Jonathan Corbet <corbet@lwn.net>,
	bfields@fieldses.org, Stephen Rothwell <sfr@canb.auug.org.au>,
	solar@openwall.com
Subject: Re: [PATCH RFC v3 3/7] proc: add helpers to set and get proc hidepid and gid mount options
Date: Fri, 10 Nov 2017 12:36:48 +0200	[thread overview]
Message-ID: <CACVxJT_cC1BZvfVxhNfa45zwUzO6=b6qef61XbnMaRLQmYtchg@mail.gmail.com> (raw)
In-Reply-To: <1510244046-3256-4-git-send-email-tixxdz@gmail.com>

On 11/9/17, Djalal Harouni <tixxdz@gmail.com> wrote:
> --- a/fs/proc/base.c
> +++ b/fs/proc/base.c

> -static bool has_pid_permissions(struct pid_namespace *pid,
> +static bool has_pid_permissions(struct proc_fs_info *fs_info,

More "const".

> diff --git a/fs/proc/inode.c b/fs/proc/inode.c
> index 9abc370..bdd808d 100644
> --- a/fs/proc/inode.c
> +++ b/fs/proc/inode.c
> @@ -476,11 +476,12 @@ struct inode *proc_get_inode(struct super_block *sb,
> struct proc_dir_entry *de)
>  int proc_fill_super(struct super_block *s, void *data, int silent)
>  {
>  	struct proc_fs_info *fs_info = proc_sb(s);
> -	struct pid_namespace *ns = get_pid_ns(fs_info->pid_ns);
>  	struct inode *root_inode;
>  	int ret;
>
> -	if (!proc_parse_options(data, ns))
> +	get_pid_ns(fs_info->pid_ns);
> +
> +	if (!proc_parse_options(data, fs_info))
>  		return -EINVAL;
>
>  	/* User space would break if executables or devices appear on proc */
> diff --git a/fs/proc/internal.h b/fs/proc/internal.h
> index 4a67188..10bc7be 100644
> --- a/fs/proc/internal.h
> +++ b/fs/proc/internal.h
> @@ -240,7 +240,7 @@ static inline void proc_tty_init(void) {}
>   * root.c
>   */
>  extern struct proc_dir_entry proc_root;
> -extern int proc_parse_options(char *options, struct pid_namespace *pid);
> +extern int proc_parse_options(char *options, struct proc_fs_info
> *fs_info);

"extern" can be dropped if you're touching prototype anyway.



> +static inline int proc_fs_hide_pid(struct proc_fs_info *fs_info)
> +{
> +	return fs_info->pid_ns->hide_pid;
> +}
> +
> +static inline kgid_t proc_fs_pid_gid(struct proc_fs_info *fs_info)
> +{
> +	return fs_info->pid_ns->pid_gid;
> +}

More "const".

> @@ -59,6 +81,24 @@ static inline void proc_flush_task(struct task_struct
> *task)
>  {
>  }
>
> +static inline void proc_fs_set_hide_pid(struct proc_fs_info *fs_info, int
> hide_pid)
> +{
> +}
> +
> +static inline void proc_fs_set_pid_gid(struct proc_info_fs *fs_info, kgid_t
> gid)
> +{
> +}
> +
> +static inline int proc_fs_hide_pid(struct proc_fs_info *fs_info)
> +{
> +	return 0;
> +}
> +
> +extern kgid_t proc_fs_pid_gid(struct proc_fs_info *fs_info)

ehh?

> +{
> +	return GLOBAL_ROOT_GID;
> +}

WARNING: multiple messages have this Message-ID (diff)
From: Alexey Dobriyan <adobriyan@gmail.com>
To: Djalal Harouni <tixxdz@gmail.com>
Cc: Kees Cook <keescook@chromium.org>,
	Alexey Gladkov <gladkov.alexey@gmail.com>,
	Andy Lutomirski <luto@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-hardening@lists.openwall.com,
	linux-security-module@vger.kernel.org, linux-api@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Akinobu Mita <akinobu.mita@gmail.com>,
	me@tobin.cc, Oleg Nesterov <oleg@redhat.com>,
	Jeff Layton <jlayton@poochiereds.net>,
	Ingo Molnar <mingo@kernel.org>,
	ebiederm@xmission.com,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Daniel Micay <danielmicay@gmail.com>,
	Jonathan Corbet <corbet@lwn.net>,
	bfields@fieldses.org, Stephen Rothwell <sfr@canb.auug.org.>
Subject: Re: [PATCH RFC v3 3/7] proc: add helpers to set and get proc hidepid and gid mount options
Date: Fri, 10 Nov 2017 12:36:48 +0200	[thread overview]
Message-ID: <CACVxJT_cC1BZvfVxhNfa45zwUzO6=b6qef61XbnMaRLQmYtchg@mail.gmail.com> (raw)
In-Reply-To: <1510244046-3256-4-git-send-email-tixxdz@gmail.com>

On 11/9/17, Djalal Harouni <tixxdz@gmail.com> wrote:
> --- a/fs/proc/base.c
> +++ b/fs/proc/base.c

> -static bool has_pid_permissions(struct pid_namespace *pid,
> +static bool has_pid_permissions(struct proc_fs_info *fs_info,

More "const".

> diff --git a/fs/proc/inode.c b/fs/proc/inode.c
> index 9abc370..bdd808d 100644
> --- a/fs/proc/inode.c
> +++ b/fs/proc/inode.c
> @@ -476,11 +476,12 @@ struct inode *proc_get_inode(struct super_block *sb,
> struct proc_dir_entry *de)
>  int proc_fill_super(struct super_block *s, void *data, int silent)
>  {
>  	struct proc_fs_info *fs_info = proc_sb(s);
> -	struct pid_namespace *ns = get_pid_ns(fs_info->pid_ns);
>  	struct inode *root_inode;
>  	int ret;
>
> -	if (!proc_parse_options(data, ns))
> +	get_pid_ns(fs_info->pid_ns);
> +
> +	if (!proc_parse_options(data, fs_info))
>  		return -EINVAL;
>
>  	/* User space would break if executables or devices appear on proc */
> diff --git a/fs/proc/internal.h b/fs/proc/internal.h
> index 4a67188..10bc7be 100644
> --- a/fs/proc/internal.h
> +++ b/fs/proc/internal.h
> @@ -240,7 +240,7 @@ static inline void proc_tty_init(void) {}
>   * root.c
>   */
>  extern struct proc_dir_entry proc_root;
> -extern int proc_parse_options(char *options, struct pid_namespace *pid);
> +extern int proc_parse_options(char *options, struct proc_fs_info
> *fs_info);

"extern" can be dropped if you're touching prototype anyway.



> +static inline int proc_fs_hide_pid(struct proc_fs_info *fs_info)
> +{
> +	return fs_info->pid_ns->hide_pid;
> +}
> +
> +static inline kgid_t proc_fs_pid_gid(struct proc_fs_info *fs_info)
> +{
> +	return fs_info->pid_ns->pid_gid;
> +}

More "const".

> @@ -59,6 +81,24 @@ static inline void proc_flush_task(struct task_struct
> *task)
>  {
>  }
>
> +static inline void proc_fs_set_hide_pid(struct proc_fs_info *fs_info, int
> hide_pid)
> +{
> +}
> +
> +static inline void proc_fs_set_pid_gid(struct proc_info_fs *fs_info, kgid_t
> gid)
> +{
> +}
> +
> +static inline int proc_fs_hide_pid(struct proc_fs_info *fs_info)
> +{
> +	return 0;
> +}
> +
> +extern kgid_t proc_fs_pid_gid(struct proc_fs_info *fs_info)

ehh?

> +{
> +	return GLOBAL_ROOT_GID;
> +}

WARNING: multiple messages have this Message-ID (diff)
From: adobriyan@gmail.com (Alexey Dobriyan)
To: linux-security-module@vger.kernel.org
Subject: [PATCH RFC v3 3/7] proc: add helpers to set and get proc hidepid and gid mount options
Date: Fri, 10 Nov 2017 12:36:48 +0200	[thread overview]
Message-ID: <CACVxJT_cC1BZvfVxhNfa45zwUzO6=b6qef61XbnMaRLQmYtchg@mail.gmail.com> (raw)
In-Reply-To: <1510244046-3256-4-git-send-email-tixxdz@gmail.com>

On 11/9/17, Djalal Harouni <tixxdz@gmail.com> wrote:
> --- a/fs/proc/base.c
> +++ b/fs/proc/base.c

> -static bool has_pid_permissions(struct pid_namespace *pid,
> +static bool has_pid_permissions(struct proc_fs_info *fs_info,

More "const".

> diff --git a/fs/proc/inode.c b/fs/proc/inode.c
> index 9abc370..bdd808d 100644
> --- a/fs/proc/inode.c
> +++ b/fs/proc/inode.c
> @@ -476,11 +476,12 @@ struct inode *proc_get_inode(struct super_block *sb,
> struct proc_dir_entry *de)
>  int proc_fill_super(struct super_block *s, void *data, int silent)
>  {
>  	struct proc_fs_info *fs_info = proc_sb(s);
> -	struct pid_namespace *ns = get_pid_ns(fs_info->pid_ns);
>  	struct inode *root_inode;
>  	int ret;
>
> -	if (!proc_parse_options(data, ns))
> +	get_pid_ns(fs_info->pid_ns);
> +
> +	if (!proc_parse_options(data, fs_info))
>  		return -EINVAL;
>
>  	/* User space would break if executables or devices appear on proc */
> diff --git a/fs/proc/internal.h b/fs/proc/internal.h
> index 4a67188..10bc7be 100644
> --- a/fs/proc/internal.h
> +++ b/fs/proc/internal.h
> @@ -240,7 +240,7 @@ static inline void proc_tty_init(void) {}
>   * root.c
>   */
>  extern struct proc_dir_entry proc_root;
> -extern int proc_parse_options(char *options, struct pid_namespace *pid);
> +extern int proc_parse_options(char *options, struct proc_fs_info
> *fs_info);

"extern" can be dropped if you're touching prototype anyway.



> +static inline int proc_fs_hide_pid(struct proc_fs_info *fs_info)
> +{
> +	return fs_info->pid_ns->hide_pid;
> +}
> +
> +static inline kgid_t proc_fs_pid_gid(struct proc_fs_info *fs_info)
> +{
> +	return fs_info->pid_ns->pid_gid;
> +}

More "const".

> @@ -59,6 +81,24 @@ static inline void proc_flush_task(struct task_struct
> *task)
>  {
>  }
>
> +static inline void proc_fs_set_hide_pid(struct proc_fs_info *fs_info, int
> hide_pid)
> +{
> +}
> +
> +static inline void proc_fs_set_pid_gid(struct proc_info_fs *fs_info, kgid_t
> gid)
> +{
> +}
> +
> +static inline int proc_fs_hide_pid(struct proc_fs_info *fs_info)
> +{
> +	return 0;
> +}
> +
> +extern kgid_t proc_fs_pid_gid(struct proc_fs_info *fs_info)

ehh?

> +{
> +	return GLOBAL_ROOT_GID;
> +}
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Alexey Dobriyan <adobriyan@gmail.com>
To: Djalal Harouni <tixxdz@gmail.com>
Cc: Kees Cook <keescook@chromium.org>,
	Alexey Gladkov <gladkov.alexey@gmail.com>,
	Andy Lutomirski <luto@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-hardening@lists.openwall.com,
	linux-security-module@vger.kernel.org, linux-api@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Akinobu Mita <akinobu.mita@gmail.com>,
	me@tobin.cc, Oleg Nesterov <oleg@redhat.com>,
	Jeff Layton <jlayton@poochiereds.net>,
	Ingo Molnar <mingo@kernel.org>,
	ebiederm@xmission.com,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Daniel Micay <danielmicay@gmail.com>,
	Jonathan Corbet <corbet@lwn.net>,
	bfields@fieldses.org, Stephen Rothwell <sfr@canb.auug.org.au>,
	solar@openwall.com
Subject: [kernel-hardening] Re: [PATCH RFC v3 3/7] proc: add helpers to set and get proc hidepid and gid mount options
Date: Fri, 10 Nov 2017 12:36:48 +0200	[thread overview]
Message-ID: <CACVxJT_cC1BZvfVxhNfa45zwUzO6=b6qef61XbnMaRLQmYtchg@mail.gmail.com> (raw)
In-Reply-To: <1510244046-3256-4-git-send-email-tixxdz@gmail.com>

On 11/9/17, Djalal Harouni <tixxdz@gmail.com> wrote:
> --- a/fs/proc/base.c
> +++ b/fs/proc/base.c

> -static bool has_pid_permissions(struct pid_namespace *pid,
> +static bool has_pid_permissions(struct proc_fs_info *fs_info,

More "const".

> diff --git a/fs/proc/inode.c b/fs/proc/inode.c
> index 9abc370..bdd808d 100644
> --- a/fs/proc/inode.c
> +++ b/fs/proc/inode.c
> @@ -476,11 +476,12 @@ struct inode *proc_get_inode(struct super_block *sb,
> struct proc_dir_entry *de)
>  int proc_fill_super(struct super_block *s, void *data, int silent)
>  {
>  	struct proc_fs_info *fs_info = proc_sb(s);
> -	struct pid_namespace *ns = get_pid_ns(fs_info->pid_ns);
>  	struct inode *root_inode;
>  	int ret;
>
> -	if (!proc_parse_options(data, ns))
> +	get_pid_ns(fs_info->pid_ns);
> +
> +	if (!proc_parse_options(data, fs_info))
>  		return -EINVAL;
>
>  	/* User space would break if executables or devices appear on proc */
> diff --git a/fs/proc/internal.h b/fs/proc/internal.h
> index 4a67188..10bc7be 100644
> --- a/fs/proc/internal.h
> +++ b/fs/proc/internal.h
> @@ -240,7 +240,7 @@ static inline void proc_tty_init(void) {}
>   * root.c
>   */
>  extern struct proc_dir_entry proc_root;
> -extern int proc_parse_options(char *options, struct pid_namespace *pid);
> +extern int proc_parse_options(char *options, struct proc_fs_info
> *fs_info);

"extern" can be dropped if you're touching prototype anyway.



> +static inline int proc_fs_hide_pid(struct proc_fs_info *fs_info)
> +{
> +	return fs_info->pid_ns->hide_pid;
> +}
> +
> +static inline kgid_t proc_fs_pid_gid(struct proc_fs_info *fs_info)
> +{
> +	return fs_info->pid_ns->pid_gid;
> +}

More "const".

> @@ -59,6 +81,24 @@ static inline void proc_flush_task(struct task_struct
> *task)
>  {
>  }
>
> +static inline void proc_fs_set_hide_pid(struct proc_fs_info *fs_info, int
> hide_pid)
> +{
> +}
> +
> +static inline void proc_fs_set_pid_gid(struct proc_info_fs *fs_info, kgid_t
> gid)
> +{
> +}
> +
> +static inline int proc_fs_hide_pid(struct proc_fs_info *fs_info)
> +{
> +	return 0;
> +}
> +
> +extern kgid_t proc_fs_pid_gid(struct proc_fs_info *fs_info)

ehh?

> +{
> +	return GLOBAL_ROOT_GID;
> +}

  reply	other threads:[~2017-11-10 10:36 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-09 16:13 [PATCH RFC v3 0/7] proc: modernize proc to support multiple private instances Djalal Harouni
2017-11-09 16:13 ` [kernel-hardening] " Djalal Harouni
2017-11-09 16:13 ` Djalal Harouni
2017-11-09 16:14 ` [PATCH RFC v3 1/7] proc: add proc_fs_info struct to store proc information Djalal Harouni
2017-11-09 16:14   ` [kernel-hardening] " Djalal Harouni
2017-11-09 16:14   ` Djalal Harouni
2017-11-10 10:26   ` Alexey Dobriyan
2017-11-10 10:26     ` [kernel-hardening] " Alexey Dobriyan
2017-11-10 10:26     ` Alexey Dobriyan
2017-11-10 10:26     ` Alexey Dobriyan
2017-11-10 10:32     ` Djalal Harouni
2017-11-10 10:32       ` [kernel-hardening] " Djalal Harouni
2017-11-10 10:32       ` Djalal Harouni
2017-11-10 10:32       ` Djalal Harouni
2017-11-09 16:14 ` [PATCH RFC v3 2/7] proc: move /proc/{self|thread-self} dentries to proc_fs_info Djalal Harouni
2017-11-09 16:14   ` [kernel-hardening] " Djalal Harouni
2017-11-09 16:14   ` Djalal Harouni
2017-11-10 10:31   ` Alexey Dobriyan
2017-11-10 10:31     ` [kernel-hardening] " Alexey Dobriyan
2017-11-10 10:31     ` Alexey Dobriyan
2017-11-10 10:31     ` Alexey Dobriyan
2017-11-10 10:45     ` Djalal Harouni
2017-11-10 10:45       ` [kernel-hardening] " Djalal Harouni
2017-11-10 10:45       ` Djalal Harouni
2017-11-10 10:45       ` Djalal Harouni
2017-11-09 16:14 ` [PATCH RFC v3 3/7] proc: add helpers to set and get proc hidepid and gid mount options Djalal Harouni
2017-11-09 16:14   ` [kernel-hardening] " Djalal Harouni
2017-11-09 16:14   ` Djalal Harouni
2017-11-10 10:36   ` Alexey Dobriyan [this message]
2017-11-10 10:36     ` [kernel-hardening] " Alexey Dobriyan
2017-11-10 10:36     ` Alexey Dobriyan
2017-11-10 10:36     ` Alexey Dobriyan
2017-11-10 10:41     ` Djalal Harouni
2017-11-10 10:41       ` [kernel-hardening] " Djalal Harouni
2017-11-10 10:41       ` Djalal Harouni
2017-11-10 10:41       ` Djalal Harouni
2017-11-09 16:14 ` [PATCH RFC v3 4/7] proc: support mounting private procfs instances inside same pid namespace Djalal Harouni
2017-11-09 16:14   ` [kernel-hardening] " Djalal Harouni
2017-11-09 16:14   ` Djalal Harouni
2017-11-10  2:53   ` James Morris
2017-11-10  2:53     ` [kernel-hardening] " James Morris
2017-11-10  2:53     ` James Morris
2017-11-10  2:53     ` James Morris
2017-11-10 10:33     ` Djalal Harouni
2017-11-10 10:33       ` [kernel-hardening] " Djalal Harouni
2017-11-10 10:33       ` Djalal Harouni
2017-11-10 10:33       ` Djalal Harouni
2017-11-09 16:14 ` [PATCH RFC v3 5/7] proc: move hidepid definitions to proc files Djalal Harouni
2017-11-09 16:14   ` [kernel-hardening] " Djalal Harouni
2017-11-09 16:14   ` Djalal Harouni
2017-11-09 16:14 ` [PATCH RFC v3 6/7] proc: support new 'pids=all|ptraceable' mount option Djalal Harouni
2017-11-09 16:14   ` [kernel-hardening] " Djalal Harouni
2017-11-09 16:14   ` Djalal Harouni
2017-11-10  2:38   ` Andy Lutomirski
2017-11-10  2:38     ` [kernel-hardening] " Andy Lutomirski
2017-11-10  2:38     ` Andy Lutomirski
2017-11-10  2:38     ` Andy Lutomirski
2017-11-10  2:38     ` Andy Lutomirski
2017-11-10 10:38     ` Djalal Harouni
2017-11-10 10:38       ` [kernel-hardening] " Djalal Harouni
2017-11-10 10:38       ` Djalal Harouni
2017-11-10 10:38       ` Djalal Harouni
2017-11-10 10:38       ` Djalal Harouni
2017-11-10  2:56   ` James Morris
2017-11-10  2:56     ` [kernel-hardening] " James Morris
2017-11-10  2:56     ` James Morris
2017-11-10  2:56     ` James Morris
2017-11-09 16:14 ` [PATCH RFC v3 7/7] proc: flush dcache entries from all procfs instances Djalal Harouni
2017-11-09 16:14   ` [kernel-hardening] " Djalal Harouni
2017-11-09 16:14   ` Djalal Harouni
2017-11-09 16:14   ` Djalal Harouni

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='CACVxJT_cC1BZvfVxhNfa45zwUzO6=b6qef61XbnMaRLQmYtchg@mail.gmail.com' \
    --to=adobriyan@gmail.com \
    --cc=akinobu.mita@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=bfields@fieldses.org \
    --cc=corbet@lwn.net \
    --cc=danielmicay@gmail.com \
    --cc=ebiederm@xmission.com \
    --cc=gladkov.alexey@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jlayton@poochiereds.net \
    --cc=keescook@chromium.org \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=me@tobin.cc \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=sfr@canb.auug.org.au \
    --cc=solar@openwall.com \
    --cc=tixxdz@gmail.com \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.