From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965490AbbBDKsq (ORCPT ); Wed, 4 Feb 2015 05:48:46 -0500 Received: from casper.infradead.org ([85.118.1.10]:42114 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933347AbbBDKsp (ORCPT ); Wed, 4 Feb 2015 05:48:45 -0500 Date: Wed, 4 Feb 2015 11:48:43 +0100 From: Peter Zijlstra To: Oleg Nesterov Cc: Darren Hart , Thomas Gleixner , Jerome Marchand , Larry Woodman , Mateusz Guzik , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/1] futex: check PF_KTHREAD rather than !p->mm to filter out kthreads Message-ID: <20150204104843.GD2896@worktop.programming.kicks-ass.net> References: <20150202140515.GA26398@redhat.com> <20150202140536.GA26406@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150202140536.GA26406@redhat.com> User-Agent: Mutt/1.5.22.1 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 02, 2015 at 03:05:36PM +0100, Oleg Nesterov wrote: > attach_to_pi_owner() checks p->mm to prevent attaching to kthreads and > this looks doubly wrong: > > 1. It should actually check PF_KTHREAD, kthread can do use_mm(). > > 2. If this task is not kthread and it is actually the lock owner we can > wrongly return -EPERM instead of -ESRCH or retry-if-EAGAIN. > > And note that this wrong EPERM is the likely case unless the exiting > task is (auto)reaped quickly, we check ->mm before PF_EXITING. > > Signed-off-by: Oleg Nesterov Acked-by: Peter Zijlstra (Intel)