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:   Tue, 28 Jun 2022 12:45:28 +0200
From:   Jan Kara <jack@...e.cz>
To:     Guowei Du <duguoweisz@...il.com>
Cc:     jack@...e.cz, amir73il@...il.com, repnop@...gle.com,
        brauner@...nel.org, linux-fsdevel@...r.kernel.org,
        linux-kernel@...r.kernel.org, duguowei <duguowei@...omi.com>
Subject: Re: [PATCH 6/6] fanotify: add current_user_instances node

On Tue 28-06-22 18:14:13, Guowei Du wrote:
> From: duguowei <duguowei@...omi.com>
> 
> Add a node of sysctl, which is current_user_instances.
> It shows current initialized group counts of system.
> 
> Signed-off-by: duguowei <duguowei@...omi.com>

Hum, I'm not sure about a wider context here but the changelog is certainly
missing a motivation of this change - why do you need this counter? In
particular because we already do maintain (and limit) the number of
fanotify groups each user has allocated in a particular namespace...

								Honza

> ---
>  fs/notify/fanotify/fanotify_user.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
> index c2255b440df9..39674fbffc4f 100644
> --- a/fs/notify/fanotify/fanotify_user.c
> +++ b/fs/notify/fanotify/fanotify_user.c
> @@ -51,6 +51,8 @@
>  
>  /* configurable via /proc/sys/fs/fanotify/ */
>  static int fanotify_max_queued_events __read_mostly;
> +/* current initialized group count */
> +static int fanotify_user_instances __read_mostly;
>  
>  #ifdef CONFIG_SYSCTL
>  
> @@ -86,6 +88,14 @@ static struct ctl_table fanotify_table[] = {
>  		.proc_handler	= proc_dointvec_minmax,
>  		.extra1		= SYSCTL_ZERO
>  	},
> +	{
> +		.procname	= "current_user_instances",
> +		.data		= &fanotify_user_instances,
> +		.maxlen		= sizeof(int),
> +		.mode		= 0444,
> +		.proc_handler	= proc_dointvec_minmax,
> +		.extra1		= SYSCTL_ZERO
> +	},
>  	{ }
>  };
>  
> @@ -905,6 +915,8 @@ static int fanotify_release(struct inode *ignored, struct file *file)
>  	/* matches the fanotify_init->fsnotify_alloc_group */
>  	fsnotify_destroy_group(group);
>  
> +	fanotify_user_instances--;
> +
>  	return 0;
>  }
>  
> @@ -1459,6 +1471,8 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags)
>  	if (fd < 0)
>  		goto out_destroy_group;
>  
> +	fanotify_user_instances++;
> +
>  	return fd;
>  
>  out_destroy_group:
> -- 
> 2.36.1
> 
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ