Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757797Ab2BXQsd (ORCPT ); Fri, 24 Feb 2012 11:48:33 -0500 Received: from e7.ny.us.ibm.com ([32.97.182.137]:55650 "EHLO e7.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752235Ab2BXQsc (ORCPT ); Fri, 24 Feb 2012 11:48:32 -0500 Message-ID: <4F47BF56.6010602@linux.vnet.ibm.com> Date: Fri, 24 Feb 2012 08:48:22 -0800 From: Dave Hansen User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.27) Gecko/20120216 Lightning/1.0b2 Thunderbird/3.1.19 MIME-Version: 1.0 To: Christoph Lameter CC: "Eric W. Biederman" , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [RFC][PATCH] fix move/migrate_pages() race on task struct References: <20120223180740.C4EC4156@kernel> <4F468F09.5050200@linux.vnet.ibm.com> <4F469BC7.50705@linux.vnet.ibm.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12022416-5806-0000-0000-000012DCE21D Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1048 Lines: 23 On 02/24/2012 07:20 AM, Christoph Lameter wrote: > Subject: migration: Do not do rcu_read_unlock until the last time we need the task_struct pointer > > Migration functions perform the rcu_read_unlock too early. As a result the > task pointed to may change. Bugs were introduced when adding security checks > because rcu_unlock/lock sequences were inserted. Plus the security checks > and do_move_pages used the task_struct pointer after rcu_unlock. > > Fix those issues by removing the unlock/lock sequences and moving the > rcu_read_unlock after the last use of the task struct pointer. > > Signed-off-by: Christoph Lameter It doesn't fix the code duplication, but it definitely does fix the bug I was originally trying to address. Acked-by: Dave Hansen -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/