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] [day] [month] [year] [list]
Date:   Sun, 20 Feb 2022 11:40:01 +0000
From:   Matthew Wilcox <willy@...radead.org>
To:     tangmeng <tangmeng@...ontech.com>
Cc:     viro@...iv.linux.org.uk, akpm@...ux-foundation.org,
        mcgrof@...nel.org, keescook@...omium.org, yzaikin@...gle.com,
        linux-mm@...ck.org, linux-kernel@...r.kernel.org,
        linux-fsdevel@...r.kernel.org, nizhen@...ontech.com,
        zhanglianjie@...ontech.com, nixiaoming@...wei.com
Subject: Re: [PATCH 10/11] fs/drop_caches: move drop_caches sysctls to its
 own file

On Sun, Feb 20, 2022 at 02:06:26PM +0800, tangmeng wrote:
> diff --git a/fs/drop_caches.c b/fs/drop_caches.c
> @@ -75,3 +75,25 @@ int drop_caches_sysctl_handler(struct ctl_table *table, int write,
>  	}
>  	return 0;
>  }
> +
> +#ifdef CONFIG_SYSCTL

fs/Makefile has:
obj-$(CONFIG_SYSCTL)            += drop_caches.o

so we don't need this ifdef.

> +static struct ctl_table vm_drop_caches_table[] = {
> +	{
> +		.procname       = "drop_caches",
> +		.data           = &sysctl_drop_caches,
> +		.maxlen         = sizeof(int),
> +		.mode           = 0200,
> +		.proc_handler   = drop_caches_sysctl_handler,
> +		.extra1         = SYSCTL_ONE,
> +		.extra2         = SYSCTL_FOUR,
> +	},
> +	{ }
> +};

Something which slightly concerns me about this sysctl splitup (which
is obviously the right thing to do) is that ctl_table is quite large
(64 bytes per entry) and every array is terminated with an empty one.
In this example, we've gone from 64 bytes to 128 bytes.

Would we be better off having a register_sysctl_one() which
registers exactly one ctl_table, rather than an array?  And/or a
register_sysctl_array() which takes an ARRAY_SIZE() of its argument
instead of looking for the NULL terminator?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ