Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4157486pxf; Tue, 30 Mar 2021 00:10:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmR+k+JwZHjG1mSM/qXasKBshT6Qm4XJ9E5Ek7tHQZR9UCam67sAt4sD+OkRmIkc0XSRX1 X-Received: by 2002:aa7:d588:: with SMTP id r8mr31889542edq.88.1617088211916; Tue, 30 Mar 2021 00:10:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617088211; cv=none; d=google.com; s=arc-20160816; b=WszL6sHrSba1hrk6+9D7BRTZX7bQXhxsWY7SaD+n+iZou8qiatX1TxJHucSF4ovo7h YDymNbUcu0XJJD/vVKKDn8qUTGzgs1UC7k9JLA6107Z7smLs4ZmVfRIS2KACCwqjqdy/ TFKStyHv5mkDeqCT2ZLJ2AckjL3kn6Ko4XFqjJqMJETzc5dZL+R11r/dG1LoURee0VOR asHOnUdMOwVch1m8vqXTbl5JJoJV4tj+MRYENQXTx3AmSKSjuOerZ8HDFdisMwsf7djI Z13wZLoyxquUrFVe+OvKFTyXf3zSgCsiz3C4YACxtF8SxnPtYRGEuIQe39P3mD5S2DdO Xpew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=X166VgoQn02EMb3f8ykwCC49d3dYou3bLIcu1kP5us0=; b=ydAemh/P1x1trhm1jjev0/tEXgGYSvYbDtLKkcXKRGOTXGgx/w6i2x6BBFiC3M6Dnh wgYu62B3dxPssdTNyWuUJePOdtP/if+wwz9qC9N7KsT1F5aApwSci694kx1LbflIVEwG eiIo4xe7Fk33iF4Xr0DPm+f6Ps9k7LMTxGU2oifD8AfCP+woSKt7FZxg62IqsdnpyOmp +6NvWAF7PtnVY/Ez6JOPvYOSd6e2jCTOAseoDIt4F8Spwe+uqsQznVBodrS2PQpRufNX slnYKYWx7RJb9NnQjjrsOQg2u2sH8VLu9uljdXNELKmF249EBI1BgfuPb4rAfgb7k1Hn Clyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=mEIz6zmn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r22si14613246edy.138.2021.03.30.00.09.49; Tue, 30 Mar 2021 00:10:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=mEIz6zmn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231244AbhC3HIJ (ORCPT + 99 others); Tue, 30 Mar 2021 03:08:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230316AbhC3HIB (ORCPT ); Tue, 30 Mar 2021 03:08:01 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB916C061762; Tue, 30 Mar 2021 00:07:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=X166VgoQn02EMb3f8ykwCC49d3dYou3bLIcu1kP5us0=; b=mEIz6zmnoSAw3j1Qd+Moj7BPqA o1FPHvH8HA4uTXQgWju4LxdFzthKOCG4xQqrL5iK/DtsvNE48oHsIcpR4rDrTiLBm3iiBRrTlZTBN CC8MY7tkotNFjxLmxv93ek4JzPSVR8fsaIhcAiUNmewBwq2a5sb9LM+WhRuum7nv4oxK/QaW/WVyX PlfPdvhdFBiscnR/2IR8k05yLYzcxvS1h5uzsDwpA+Tr+RKs2MYbGuJT5frmJkmdcb0PPABLW7sem +RW8E4axAPeY1QUxI69MN73T2kthyGMY+UiChulnX3Ic4YzdxLYFtMSFNCb/eT2TnJD6dbNbkURhT GNOoFsZQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lR8Qa-002ddk-BT; Tue, 30 Mar 2021 07:04:56 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id F3363307001; Tue, 30 Mar 2021 09:04:36 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id BBF922B960A7F; Tue, 30 Mar 2021 09:04:36 +0200 (CEST) Date: Tue, 30 Mar 2021 09:04:36 +0200 From: Peter Zijlstra To: Marco Elver Cc: Oleg Nesterov , Alexander Shishkin , Arnaldo Carvalho de Melo , Ingo Molnar , Jiri Olsa , Mark Rutland , Namhyung Kim , Thomas Gleixner , Alexander Potapenko , Al Viro , Arnd Bergmann , Christian Brauner , Dmitry Vyukov , Jann Horn , Jens Axboe , Matt Morehouse , Peter Collingbourne , Ian Rogers , kasan-dev , linux-arch , linux-fsdevel , LKML , the arch/x86 maintainers , "open list:KERNEL SELFTEST FRAMEWORK" , Jiri Olsa Subject: Re: [PATCH v3 06/11] perf: Add support for SIGTRAP on perf events Message-ID: References: <20210324112503.623833-1-elver@google.com> <20210324112503.623833-7-elver@google.com> <20210329142705.GA24849@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 29, 2021 at 04:32:18PM +0200, Marco Elver wrote: > On Mon, 29 Mar 2021 at 16:27, Oleg Nesterov wrote: > > On 03/29, Peter Zijlstra wrote: > > > > > > On Thu, Mar 25, 2021 at 09:14:39AM +0100, Marco Elver wrote: > > > > @@ -6395,6 +6395,13 @@ static void perf_sigtrap(struct perf_event *event) > > > > { > > > > struct kernel_siginfo info; > > > > > > > > + /* > > > > + * This irq_work can race with an exiting task; bail out if sighand has > > > > + * already been released in release_task(). > > > > + */ > > > > + if (!current->sighand) > > > > + return; > > > > This is racy. If "current" has already passed exit_notify(), current->parent > > can do release_task() and destroy current->sighand right after the check. > > > > > Urgh.. I'm not entirely sure that check is correct, but I always forget > > > the rules with signal. It could be we ought to be testing PF_EXISTING > > > instead. > > > > Agreed, PF_EXISTING check makes more sense in any case, the exiting task > > can't receive the signal anyway. > > Thanks for confirming. I'll switch to just checking PF_EXITING > (PF_EXISTING does not exist :-)). Indeed! Typing be hard :-)