lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 14 May 2021 20:24:24 -0500
From:   "Serge E. Hallyn" <serge@...lyn.com>
To:     Giuseppe Scrivano <gscrivan@...hat.com>
Cc:     linux-kernel@...r.kernel.org, serge@...lyn.com, dwalsh@...hat.com,
        christian.brauner@...ntu.com, ebiederm@...ssion.com
Subject: Re: [RFC PATCH 3/3] proc: hide unknown groups in status

On Mon, May 10, 2021 at 03:00:11PM +0200, Giuseppe Scrivano wrote:
> when the "shadow" mode is enabled for the user namespace, do not copy
> to userspace the groups that are not mapped.
> 
> Signed-off-by: Giuseppe Scrivano <gscrivan@...hat.com>

Reviewed-by: Serge Hallyn <serge@...lyn.com>

> ---
>  fs/proc/array.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/proc/array.c b/fs/proc/array.c
> index 7ec59171f197..81dc733773d4 100644
> --- a/fs/proc/array.c
> +++ b/fs/proc/array.c
> @@ -202,9 +202,17 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns,
>  
>  	seq_puts(m, "\nGroups:\t");
>  	group_info = cred->group_info;
> -	for (g = 0; g < group_info->ngroups; g++)
> +	for (g = 0; g < group_info->ngroups; g++) {
> +		gid_t gid = from_kgid(user_ns, group_info->gid[g]);
> +
> +		if (gid == (gid_t)-1) {
> +			if (user_ns->flags & USERNS_SETGROUPS_SHADOW)
> +				continue;
> +			gid = overflowgid;
> +		}
>  		seq_put_decimal_ull(m, g ? " " : "",
> -				from_kgid_munged(user_ns, group_info->gid[g]));
> +				gid);
> +	}
>  	put_cred(cred);
>  	/* Trailing space shouldn't have been added in the first place. */
>  	seq_putc(m, ' ');
> -- 
> 2.31.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ