Re: [PATCH v10 7/9] proc: move hidepid values to uapi as they are user interface to mount

From: Kees Cook
Date: Sat Mar 28 2020 - 16:41:11 EST


On Fri, Mar 27, 2020 at 06:23:29PM +0100, Alexey Gladkov wrote:
> Suggested-by: Alexey Dobriyan <adobriyan@xxxxxxxxx>
> Reviewed-by: Alexey Dobriyan <adobriyan@xxxxxxxxx>
> Signed-off-by: Alexey Gladkov <gladkov.alexey@xxxxxxxxx>
> ---
> include/linux/proc_fs.h | 9 +--------
> include/uapi/linux/proc_fs.h | 13 +++++++++++++
> 2 files changed, 14 insertions(+), 8 deletions(-)
> create mode 100644 include/uapi/linux/proc_fs.h
>
> diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
> index afd38cae2339..d259817ec913 100644
> --- a/include/linux/proc_fs.h
> +++ b/include/linux/proc_fs.h
> @@ -7,6 +7,7 @@
>
> #include <linux/types.h>
> #include <linux/fs.h>
> +#include <uapi/linux/proc_fs.h>
>
> struct proc_dir_entry;
> struct seq_file;
> @@ -27,14 +28,6 @@ struct proc_ops {
> unsigned long (*proc_get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
> };
>
> -/* definitions for hide_pid field */
> -enum {
> - HIDEPID_OFF = 0,
> - HIDEPID_NO_ACCESS = 1,
> - HIDEPID_INVISIBLE = 2,
> - HIDEPID_NOT_PTRACEABLE = 4, /* Limit pids to only ptraceable pids */
> -};
> -
> /* definitions for proc mount option pidonly */
> enum {
> PROC_PIDONLY_OFF = 0,
> diff --git a/include/uapi/linux/proc_fs.h b/include/uapi/linux/proc_fs.h
> new file mode 100644
> index 000000000000..dc6d717aa6ec
> --- /dev/null
> +++ b/include/uapi/linux/proc_fs.h
> @@ -0,0 +1,13 @@
> +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
> +#ifndef _UAPI_PROC_FS_H
> +#define _UAPI_PROC_FS_H
> +
> +/* definitions for hide_pid field */
> +enum {
> + HIDEPID_OFF = 0,
> + HIDEPID_NO_ACCESS = 1,
> + HIDEPID_INVISIBLE = 2,
> + HIDEPID_NOT_PTRACEABLE = 4,
> +};
> +
> +#endif
> --
> 2.25.2
>

Should the numeric values still be UAPI if there is string parsing now?

--
Kees Cook