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, 30 Oct 2019 13:40:36 -0700
From:   Shakeel Butt <shakeelb@...gle.com>
To:     Roman Gushchin <guro@...com>
Cc:     Linux MM <linux-mm@...ck.org>, Michal Hocko <mhocko@...nel.org>,
        Johannes Weiner <hannes@...xchg.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Kernel Team <kernel-team@...com>,
        Vladimir Davydov <vdavydov.dev@...il.com>
Subject: Re: [PATCH] mm: slab: make page_cgroup_ino() to recognize
 non-compound slab pages properly

On Fri, Oct 25, 2019 at 4:28 PM Roman Gushchin <guro@...com> wrote:
>
> page_cgroup_ino() doesn't return a valid memcg pointer for non-compund

non-compound

> slab pages, because it depends on PgHead AND PgSlab flags to be set
> to determine the memory cgroup from the kmem_cache.
> It's correct for compound pages, but not for generic small pages. Those
> don't have PgHead set, so it ends up returning zero.
>
> Fix this by replacing the condition to PageSlab() && !PageTail().
>
> Before this patch:
> [root@...alhost ~]# ./page-types -c /sys/fs/cgroup/user.slice/user-0.slice/user@...ervice/ | grep slab
> 0x0000000000000080              38        0  _______S___________________________________        slab
>
> After this patch:
> [root@...alhost ~]# ./page-types -c /sys/fs/cgroup/user.slice/user-0.slice/user@...ervice/ | grep slab
> 0x0000000000000080             147        0  _______S___________________________________        slab
>
> Fixes: 4d96ba353075 ("mm: memcg/slab: stop setting page->mem_cgroup pointer for slab pages")
> Signed-off-by: Roman Gushchin <guro@...com>

Reviewed-by: Shakeel Butt <shakeelb@...gle.com>

> Cc: Vladimir Davydov <vdavydov.dev@...il.com>
> Cc: Shakeel Butt <shakeelb@...gle.com>
> ---
>  mm/memcontrol.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index ea085877c548..00b4188b1bed 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -476,7 +476,7 @@ ino_t page_cgroup_ino(struct page *page)
>         unsigned long ino = 0;
>
>         rcu_read_lock();
> -       if (PageHead(page) && PageSlab(page))
> +       if (PageSlab(page) && !PageTail(page))
>                 memcg = memcg_from_slab_page(page);
>         else
>                 memcg = READ_ONCE(page->mem_cgroup);
> --
> 2.17.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ