Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934500AbcJXM1u (ORCPT ); Mon, 24 Oct 2016 08:27:50 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:43522 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757658AbcJXM1t (ORCPT ); Mon, 24 Oct 2016 08:27:49 -0400 Date: Mon, 24 Oct 2016 14:27:48 +0200 From: Peter Zijlstra To: Oleg Nesterov Cc: "Ni, BaoleX" , "mingo@redhat.com" , "acme@kernel.org" , "linux-kernel@vger.kernel.org" , "alexander.shishkin@linux.intel.com" , "Liu, Chuansheng" Subject: Re: hit a KASan bug related to Perf during stress test Message-ID: <20161024122748.GO3102@twins.programming.kicks-ass.net> References: <318B87A793BE164187D8851D6CE09D64371C8811@shsmsx102.ccr.corp.intel.com> <20161024095341.GF3102@twins.programming.kicks-ass.net> <20161024111526.GA13509@redhat.com> <20161024121155.GK3102@twins.programming.kicks-ass.net> <20161024122123.GB17007@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161024122123.GB17007@redhat.com> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 538 Lines: 12 On Mon, Oct 24, 2016 at 02:21:23PM +0200, Oleg Nesterov wrote: > > Should we do the same for perf_event_tid() and report -1 as the pid/tid > > in the !alive case? -1 should be an obvious invalid pid since we limit > > the pid-space to less than 32 bits. > > task_pid_nr_ns() is always safe, it calls __task_pid_nr_ns(). But yes, > it can return zero if called after exit_notify() and/or release_task(). > > And while zero is not a valid pid too, I guess it can be confused with > the idle thread's "pid" ? Right, 0 is the idle thread.