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:   Wed, 3 Mar 2021 15:02:47 +0100
From:   Michal Hocko <mhocko@...e.com>
To:     Muchun Song <songmuchun@...edance.com>
Cc:     Roman Gushchin <guro@...com>, Johannes Weiner <hannes@...xchg.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Shakeel Butt <shakeelb@...gle.com>,
        LKML <linux-kernel@...r.kernel.org>,
        Linux Memory Management List <linux-mm@...ck.org>
Subject: Re: [External] Re: [PATCH v2] mm: memcontrol: fix kernel stack
 account

On Wed 03-03-21 21:27:24, Muchun Song wrote:
> On Wed, Mar 3, 2021 at 6:25 PM Michal Hocko <mhocko@...e.com> wrote:
> >
> > On Wed 03-03-21 17:39:56, Muchun Song wrote:
> > > For simplification 991e7673859e ("mm: memcontrol: account kernel stack
> > > per node") has changed the per zone vmalloc backed stack pages
> > > accounting to per node. By doing that we have lost a certain precision
> > > because those pages might live in different NUMA nodes. In the end
> > > NR_KERNEL_STACK_KB exported to the userspace might be over estimated on
> > > some nodes while underestimated on others.
> > >
> > > This doesn't impose any real problem to correctnes of the kernel
> > > behavior as the counter is not used for any internal processing but it
> > > can cause some confusion to the userspace.
> >
> > You have skipped over one part of the changelog I have proposed and that
> > is to provide an actual data.
> 
> Because this is a problem I found by looking at the code, not a real world
> problem. I do not have any actual data. :-(

As I've mentioned several times already, this is all fine but it should
be made explicit in the changelog. There might be people spending their
time to evaluate this code to find out whether this is something that
somebody depend on.

[...]
> > > -     /* All stack pages are in the same node. */
> > > -     if (vm)
> > > -             mod_lruvec_page_state(vm->pages[0], NR_KERNEL_STACK_KB,
> > > -                                   account * (THREAD_SIZE / 1024));
> > > -     else
> > > +             BUG_ON(vm->nr_pages != THREAD_SIZE / PAGE_SIZE);
> >
> > I do not think we need this BUG_ON. What kind of purpose does it serve?
> 
> vm->nr_pages should be always equal to THREAD_SIZE / PAGE_SIZE
> if the system is not corrupted.

BUG_ON is not an annotation for "this shouldn't happen". Even if the
system was corrupted and nr_pages wouldn't match then this is not a
reason to crash the kernel right away.

In general there should be a very _strong_ reason to add a BUG_ON.

-- 
Michal Hocko
SUSE Labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ