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: <9de0c0d4-15ac-bb7f-755b-849433da5ba4@suse.cz>
Date:   Fri, 2 Oct 2020 10:51:27 +0200
From:   Vlastimil Babka <vbabka@...e.cz>
To:     Roman Gushchin <guro@...com>,
        Linus Torvalds <torvalds@...ux-foundation.org>
Cc:     Bastian Bittorf <bb@....de>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Shakeel Butt <shakeelb@...gle.com>
Subject: Re: Linux 5.9-rc7 / VmallocTotal wrongly reported

On 10/1/20 10:39 PM, Roman Gushchin wrote:
> On Thu, Oct 01, 2020 at 12:58:36PM -0700, Linus Torvalds wrote:
>> On Thu, Oct 1, 2020 at 12:56 PM Roman Gushchin <guro@...com> wrote:
>> >
>> > Bastian, can you, please, share your config?
>> 
>> Bastian actually did that in the original email, but that was only
>> sent to me and Andrew in private.
>> 
>> Here's that config replicated for your pleasure,
> 
> Thank you!
> 
>> 
>> #
>> # Processor type and features
>> #
>> # CONFIG_ZONE_DMA is not set
>> # CONFIG_SMP is not set
> 
> Yes, here is the deal.
> 
> The SMP-version of __mod_node_page_state() converts a passed value from bytes
> to pages, but the non-SMP doesn't.
> 
> Thanks!
> 
> 
> --
> 
> From 3d0233b37340c78012b991d3570b92f91cf5ebd2 Mon Sep 17 00:00:00 2001
> From: Roman Gushchin <guro@...com>
> Date: Thu, 1 Oct 2020 13:07:49 -0700
> Subject: [PATCH] mm: memcg/slab: fix slab statistics in !SMP configuration
> 
> Since ea426c2a7de8 ("mm: memcg: prepare for byte-sized vmstat items")
> the write side of slab counters accepts a value in bytes and converts
> it to pages. It happens in __mod_node_page_state().
> 
> However a non-SMP version of __mod_node_page_state() doesn't perform
> this conversion. It leads to incorrect (unrealistically high) slab
> counters values. Fix this by adding a similar conversion to the
> non-SMP version of __mod_node_page_state().
> 
> Signed-off-by: Roman Gushchin <guro@...com>
> Reported-by: Bastian Bittorf <bb@....de>
> Fixes: ea426c2a7de8 ("mm: memcg: prepare for byte-sized vmstat items")

Acked-by: Vlastimil Babka <vbabka@...e.cz>

For consistency we could also duplicate the
"VM_WARN_ON_ONCE(vmstat_item_in_bytes(item));" in !SMP variants of
__inc_node_state() and __dec_node_state(), but that's not urgent, and perhaps
SMP configs are enough to catch any bugs introduced in the future in this area...

> ---
>  include/linux/vmstat.h | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
> index d5431c1bf6e5..322dcbfcc933 100644
> --- a/include/linux/vmstat.h
> +++ b/include/linux/vmstat.h
> @@ -312,6 +312,11 @@ static inline void __mod_zone_page_state(struct zone *zone,
>  static inline void __mod_node_page_state(struct pglist_data *pgdat,
>  			enum node_stat_item item, int delta)
>  {
> +	if (vmstat_item_in_bytes(item)) {
> +		VM_WARN_ON_ONCE(delta & (PAGE_SIZE - 1));
> +		delta >>= PAGE_SHIFT;
> +	}
> +
>  	node_page_state_add(delta, pgdat, item);
>  }
>  
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ