* + memcg-avoid-overflow-caused-by-page_align.patch added to -mm tree
@ 2013-08-07 20:36 akpm
0 siblings, 0 replies; only message in thread
From: akpm @ 2013-08-07 20:36 UTC (permalink / raw)
To: mm-commits, nishimura, mhocko, jeff.liu, h.huangqiang, handai.szj
Subject: + memcg-avoid-overflow-caused-by-page_align.patch added to -mm tree
To: handai.szj@taobao.com,h.huangqiang@huawei.com,jeff.liu@oracle.com,mhocko@suse.cz,nishimura@mxp.nes.nec.co.jp
From: akpm@linux-foundation.org
Date: Wed, 07 Aug 2013 13:36:04 -0700
The patch titled
Subject: memcg: avoid overflow caused by PAGE_ALIGN
has been added to the -mm tree. Its filename is
memcg-avoid-overflow-caused-by-page_align.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/memcg-avoid-overflow-caused-by-page_align.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/memcg-avoid-overflow-caused-by-page_align.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
The -mm tree is included into linux-next and is updated
there every 3-4 working days
------------------------------------------------------
From: Sha Zhengju <handai.szj@taobao.com>
Subject: memcg: avoid overflow caused by PAGE_ALIGN
Since PAGE_ALIGN is aligning up(the next page boundary), so after
PAGE_ALIGN, the value might be overflow, such as write the MAX value to
*.limit_in_bytes.
$ cat /cgroup/memory/memory.limit_in_bytes
18446744073709551615
# echo 18446744073709551615 > /cgroup/memory/memory.limit_in_bytes
bash: echo: write error: Invalid argument
Some user programs might depend on such behaviours(like libcg, we read the
value in snapshot, then use the value to reset cgroup later), and that
will cause confusion. So we need to fix it.
Signed-off-by: Sha Zhengju <handai.szj@taobao.com>
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Acked-by: Michal Hocko <mhocko@suse.cz>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: Jeff Liu <jeff.liu@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
kernel/res_counter.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff -puN kernel/res_counter.c~memcg-avoid-overflow-caused-by-page_align kernel/res_counter.c
--- a/kernel/res_counter.c~memcg-avoid-overflow-caused-by-page_align
+++ a/kernel/res_counter.c
@@ -195,6 +195,10 @@ int res_counter_memparse_write_strategy(
if (*end != '\0')
return -EINVAL;
- *res = PAGE_ALIGN(*res);
+ if (PAGE_ALIGN(*res) >= *res)
+ *res = PAGE_ALIGN(*res);
+ else
+ *res = RES_COUNTER_MAX;
+
return 0;
}
_
Patches currently in -mm which might be from handai.szj@taobao.com are
memcg-correct-resource_max-to-ullong_max.patch
memcg-rename-resource_max-to-res_counter_max.patch
memcg-avoid-overflow-caused-by-page_align.patch
memcg-reduce-function-dereference.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2013-08-07 20:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-07 20:36 + memcg-avoid-overflow-caused-by-page_align.patch added to -mm tree akpm
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.