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=-5.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 F01E4C433DB for ; Thu, 4 Feb 2021 13:47:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B902864DF6 for ; Thu, 4 Feb 2021 13:47:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236479AbhBDNrV (ORCPT ); Thu, 4 Feb 2021 08:47:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236452AbhBDNqd (ORCPT ); Thu, 4 Feb 2021 08:46:33 -0500 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F6E9C061573 for ; Thu, 4 Feb 2021 05:45:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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=rrb7GIsALulMLgBpvfMJZt8+pR64np3LnHjQDkWTEbg=; b=ZB5GwrNmgI54ZMhy7qADcO5Cqe pc2TmFfQLSnkqU1glto/94KgR/G3d3mRniKzXkzPeoyRA5ldwMlnvn3n6LDam++0CFlr7T2ovZcnu Kjo2MGXvA5aR6SIaKa8YwUvsiFi1lNljVBGEXDam4TDBYmII7uBhtb0oY3iSNL0xs9+uNwX8gC+ro FoZXo9W31kiLLOaSXJ7Da+E3kcrVv55vPMqpluufijq5k/C6fozVECaZkgDQdHHaTZ9zObMw5snJh 3gBeifdOkJolEQGsB4XxG4EOpd/mKpIIJzkemPPfS9kdyLGhV8ZZe1KHXWkhE5vQcnI9TBHhOjL6J zjUwB3FA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1l7ex4-0007c4-Bp; Thu, 04 Feb 2021 13:45:42 +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 DB36230066E; Thu, 4 Feb 2021 14:45:40 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id A86D72C12E8F6; Thu, 4 Feb 2021 14:45:40 +0100 (CET) Date: Thu, 4 Feb 2021 14:45:40 +0100 From: Peter Zijlstra To: Dmitry Vyukov Cc: Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Will Deacon , LKML , Matt Morehouse Subject: Re: Process-wide watchpoints Message-ID: References: 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 Thu, Feb 04, 2021 at 02:35:36PM +0100, Dmitry Vyukov wrote: > On Thu, Feb 4, 2021 at 2:10 PM Peter Zijlstra wrote: > > > > On Thu, Feb 04, 2021 at 01:53:59PM +0100, Dmitry Vyukov wrote: > > > Humm... I was thinking of perf_event_open(pid == 0). > > > It does not make sense to send SIGTRAP in a remote process, because it > > > does not necessarily cooperate with us. > > > > > > But is there any problem with clone w/o CLONE_THREAD? Assuming the > > > current process has setup the signal handler, the child will have the > > > same handler and the same code/address space. So delivery of SIGTRAP > > > should work the same way in the child. > > > > Nothing should be doing CLONE_VM without CLONE_THREAD. Yes, it's > > possible, but if you do so, you get to keep the pieces IMO. > > > > Current libc either does a full clone (fork) or pthread_create, > > pthread_create does CLONE_THREAD. > > I meant a different thing. > I meant that we could restrict synchronous SIGTRAP for (1) > perf_event_open(pid != 0) and (2) disable it after exec. Ah, I figured a generic means to inherit across a process, but not a process tree might be useful. I don't much like magical/implied constraints. > What is the issue here for clone without CLONE_THREAD? It's an abomination that's possible and an endless cause of trouble :/