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]
Message-ID: <aDhSdyzMD_e80zn5@tiehlicka>
Date: Thu, 29 May 2025 14:26:31 +0200
From: Michal Hocko <mhocko@...e.com>
To: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
	David Hildenbrand <david@...hat.com>, lorenzo.stoakes@...cle.com,
	Liam.Howlett@...cle.com, vbabka@...e.cz, rppt@...nel.org,
	surenb@...gle.com, linux-mm@...ck.org, linux-kernel@...r.kernel.org,
	Konstantin Khlebnikov <koct9i@...il.com>
Subject: Re: [PATCH] mm: Strictly check vmstat_text array size

On Thu 29-05-25 14:05:41, Kirill A. Shutemov wrote:
> The /proc/vmstat displays counters from various sources. It is easy to
> forget to add or remove a label when a new counter is added or removed.
> 
> There is a BUILD_BUG_ON() function that catches missing labels. However,
> for some reason, it ignores extra labels.
> 
> Let's make the check strict. This would help to catch issues when
> a counter is removed.
> 
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
> Cc: Konstantin Khlebnikov <koct9i@...il.com>

LGTM
Acked-by: Michal Hocko <mhocko@...e.com>

Not sure why we have gone with the current check TBH.

> ---
>  mm/vmstat.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/vmstat.c b/mm/vmstat.c
> index ae9882063d89..0903adace423 100644
> --- a/mm/vmstat.c
> +++ b/mm/vmstat.c
> @@ -1867,7 +1867,7 @@ static void *vmstat_start(struct seq_file *m, loff_t *pos)
>  	if (*pos >= NR_VMSTAT_ITEMS)
>  		return NULL;
>  
> -	BUILD_BUG_ON(ARRAY_SIZE(vmstat_text) < NR_VMSTAT_ITEMS);
> +	BUILD_BUG_ON(ARRAY_SIZE(vmstat_text) != NR_VMSTAT_ITEMS);
>  	fold_vm_numa_events();
>  	v = kmalloc_array(NR_VMSTAT_ITEMS, sizeof(unsigned long), GFP_KERNEL);
>  	m->private = v;
> -- 
> 2.47.2

-- 
Michal Hocko
SUSE Labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ