From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 351BBC433C1 for ; Tue, 30 Mar 2021 07:08:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E7D5861999 for ; Tue, 30 Mar 2021 07:08:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231163AbhC3HIJ (ORCPT ); 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-fsdevel@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 :-)