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:	Tue, 27 Oct 2015 09:23:31 -0700
From:	Johannes Weiner <hannes@...xchg.org>
To:	mhocko@...nel.org
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Shaohua Li <shli@...com>, Ben Hutchings <ben@...adent.org.uk>,
	Vladimir Davydov <vdavydov@...allels.com>, linux-mm@...ck.org,
	LKML <linux-kernel@...r.kernel.org>,
	Michal Hocko <mhocko@...e.com>, stable@...r.kernel.org
Subject: Re: [PATCH] memcg: Fix thresholds for 32b architectures.

On Tue, Oct 27, 2015 at 11:37:14AM +0100, mhocko@...nel.org wrote:
> From: Michal Hocko <mhocko@...e.com>
> 
> 424cdc141380 ("memcg: convert threshold to bytes") has fixed a
> regression introduced by 3e32cb2e0a12 ("mm: memcontrol: lockless page
> counters") where thresholds were silently converted to use page units
> rather than bytes when interpreting the user input.
> 
> The fix is not complete, though, as properly pointed out by Ben
> Hutchings during stable backport review. The page count is converted
> to bytes but unsigned long is used to hold the value which would
> be obviously not sufficient for 32b systems with more than 4G
> thresholds. The same applies to usage as taken from mem_cgroup_usage
> which might overflow.
> 
> Let's remove this bytes vs. pages internal tracking differences and
> handle thresholds in page units internally. Chage mem_cgroup_usage()
> to return the value in page units and revert 424cdc141380 because this
> should be sufficient for the consistent handling.
> mem_cgroup_read_u64 as the only users of mem_cgroup_usage outside of
> the threshold handling code is converted to give the proper in bytes
> result. It is doing that already for page_counter output so this is
> more consistent as well.
> 
> The value presented to the userspace is still in bytes units.
> 
> Fixes: 424cdc141380 ("memcg: convert threshold to bytes")
> Fixes: 3e32cb2e0a12 ("mm: memcontrol: lockless page counters")
> CC: stable@...r.kernel.org
> Reported-by: Ben Hutchings <ben@...adent.org.uk>
> Signed-off-by: Michal Hocko <mhocko@...e.com>

Acked-by: Johannes Weiner <hannes@...xchg.org>

> +++ b/mm/memcontrol.c
> @@ -2802,7 +2802,7 @@ static unsigned long tree_stat(struct mem_cgroup *memcg,
>  	return val;
>  }
>  
> -static inline u64 mem_cgroup_usage(struct mem_cgroup *memcg, bool swap)
> +static inline unsigned long mem_cgroup_usage(struct mem_cgroup *memcg, bool swap)
>  {
>  	u64 val;

Minor nit, but this should probably be unsigned long now.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ