[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110426160300.GA14478@fibrous.localdomain>
Date: Tue, 26 Apr 2011 12:03:00 -0400
From: Stephen Wilson <wilsons@...rt.ca>
To: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
Cc: Hugh Dickins <hughd@...gle.com>, bookjovi@...il.com,
Andrew Morton <akpm@...ux-foundation.org>,
Al Viro <viro@...iv.linux.org.uk>,
David Rientjes <rientjes@...gle.com>,
Stephen Wilson <wilsons@...rt.ca>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] proc: put check_mem_permission before __get_free_page
in mem_read
On Tue, Apr 26, 2011 at 02:12:46PM +0900, KOSAKI Motohiro wrote:
> From 74f827ce74e1c4f846905e940edfa5f639b5a2ce Mon Sep 17 00:00:00 2001
> From: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
> Date: Tue, 26 Apr 2011 13:57:02 +0900
> Subject: [PATCH] [PATCH] proc: put check_mem_permission after __get_free_page in mem_write
>
> It should be better if put check_mem_permission after __get_free_page
> in mem_write, to be same as function mem_read.
>
> Hugh Dickins explained the reason.
>
> check_mem_permission gets a reference to the mm. If we __get_free_page
> after check_mem_permission, imagine what happens if the system is out
> of memory, and the mm we're looking at is selected for killing by the
> OOM killer: while we wait in __get_free_page for more memory, no memory
> is freed from the selected mm because it cannot reach exit_mmap while
> we hold that reference.
>
>
> Reported-by: Jovi Zhang <bookjovi@...il.com>
> Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
> Cc: Hugh Dickins <hughd@...gle.com>
> Cc: Stephen Wilson <wilsons@...rt.ca>
I completely missed the oom case as well. This certainly appears to be
the best solution.
Reviewed-by: Stephen Wilson <wilsons@...rt.ca>
--
steve
--
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