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-next>] [day] [month] [year] [list]
Message-ID: <20190201045711.GA18302@chrisdown.name>
Date:   Thu, 31 Jan 2019 23:57:11 -0500
From:   Chris Down <chris@...isdown.name>
To:     Andrew Morton <akpm@...ux-foundation.org>
Cc:     Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>,
        Johannes Weiner <hannes@...xchg.org>,
        Tejun Heo <tj@...nel.org>, linux-kernel@...r.kernel.org,
        cgroups@...r.kernel.org, linux-mm@...ck.org
Subject: [PATCH] mm, memcg: Handle cgroup_disable=memory when getting memcg
 protection

memcg is NULL if we have CONFIG_MEMCG set, but cgroup_disable=memory on
the kernel command line.

Fixes: 8a907cdf0177ab40 ("mm, memcg: proportional memory.{low,min} reclaim")
Reported-by: Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>
Signed-off-by: Chris Down <chris@...isdown.name>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Johannes Weiner <hannes@...xchg.org>
Cc: Tejun Heo <tj@...nel.org>
Cc: linux-kernel@...r.kernel.org
Cc: cgroups@...r.kernel.org
Cc: linux-mm@...ck.org
---
 include/linux/memcontrol.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 290cfbfd60cd..49742489aa56 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -335,6 +335,9 @@ static inline bool mem_cgroup_disabled(void)
 
 static inline unsigned long mem_cgroup_protection(struct mem_cgroup *memcg)
 {
+	if (mem_cgroup_disabled())
+		return 0;
+
 	return max(READ_ONCE(memcg->memory.emin), READ_ONCE(memcg->memory.elow));
 }
 
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ