Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp950043pxb; Fri, 22 Apr 2022 15:08:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSSF1p4K8YVyjLknVkMlPbjLeo5/mHcvXZAWW0hgJAnAVIRT/9ScjFMwKnap3DyvetTYD8 X-Received: by 2002:a17:902:d542:b0:159:51d:f72f with SMTP id z2-20020a170902d54200b00159051df72fmr6642994plf.95.1650665284449; Fri, 22 Apr 2022 15:08:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650665284; cv=none; d=google.com; s=arc-20160816; b=f0SqQa8sCSdpkvxPVnS06vECzfxOhW3betYHP2+kthmLIfIAqBi0JgCnY4QgwugJxj Wah6OAL2kcIiO+4tEMxUnSTUGKXtsF3ztmiAshPTqoFNZPahYWtRlWfe+Md5nLp/fdjZ jiRyv8psvrTGt9d5W+iuHWp/BZNziJMOvxQ85G1Xdsn4RoR+4uxgmizSkv9XsyrwDN04 r9mjqfVwcJC5dIjqsiPX1enK4OeAGCCzPZct2BDfHXWLnqHX5oA4lIqNTDLnAFba2yKu doLyQbM3CuMO6a3RZmi7k2XRynwATwVgUyAZCXB1JmwPw1kTAL0xLWjGHof7ncUaH1Mb 7gsg== 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=BwqMSjcged9Et6HKR9YVRBXhbJxx6UdXObdCdZiFoRo=; b=qeNyy7aAFNzqtRhJZugLMe3BZ4ElnRE/3k48cVlkukZd3Mgbx8JjO9oalKu4HopyQ6 fG28FBbg6FduSHJHqK0o5J3ALVNeY7VR+//wgWvtWhOm7LJfoaKeazLi8JhLD+itlxa7 cJQT9YbXIOm4KmomXQ4zqULR6oR0X5A8ojNazvv9bFKrhc7iqCedJPIvT4DxDbzXxaPM dpU07mrqndlP+Z9sH3MqNQ7H3q3UR9+9Aib40Zp3gvhf2U+/JUyt6/av77w4zBUbLYbJ oyw2S6D6S6aqrhmxTCktvbq3qqcAPM8tEHrqb3PGcP6Gq5+HiT9MwdAjkgID9uGb1zp6 CtVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=C0p4jlnG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id d193-20020a6368ca000000b0039daa5ed093si8532540pgc.821.2022.04.22.15.08.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 15:08:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=C0p4jlnG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6648B27AA87; Fri, 22 Apr 2022 13:14:06 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377582AbiDTKXS (ORCPT + 99 others); Wed, 20 Apr 2022 06:23:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377530AbiDTKXQ (ORCPT ); Wed, 20 Apr 2022 06:23:16 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E63D91D0F3; Wed, 20 Apr 2022 03:20:28 -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=BwqMSjcged9Et6HKR9YVRBXhbJxx6UdXObdCdZiFoRo=; b=C0p4jlnGWYx/e27oLwxPPQFEMm e7rWh6ntsVOMdBtax8OA5valvqJ5lTOfqQRY4PVkTCkNE1FEMQQN97yo5AFtoSgahTMjSxzHLRZTJ PN/GqxXAt6NZCVVrdiNjSc3qVlTE+Y2kQvVIuaLtNxewRjg7Rm8n1X7ZJkdz1ffT60HBdFKL2xg3i kaP2D6xkcaizTyvSPabAw9D8RHEd0dVwAC/0pQpbI1Tg+tZx8p0I0MMKgb7md3Fqv0BPdPHqnY002 oHZLtn3pHeoE0j9JqyZ/6eMH5rebf80mKS6Hh2FJgn+GLVC5NcB9V0e3/l5nVExCm5iRx747CjzDc tHCjUpGg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nh7RQ-003zLF-C8; Wed, 20 Apr 2022 10:20:08 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id 21AA79861A4; Wed, 20 Apr 2022 12:20:06 +0200 (CEST) Date: Wed, 20 Apr 2022 12:20:06 +0200 From: Peter Zijlstra To: Oleg Nesterov Cc: rjw@rjwysocki.net, mingo@kernel.org, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, mgorman@suse.de, ebiederm@xmission.com, bigeasy@linutronix.de, Will Deacon , linux-kernel@vger.kernel.org, tj@kernel.org, linux-pm@vger.kernel.org Subject: Re: [PATCH 2/5] sched,ptrace: Fix ptrace_check_attach() vs PREEMPT_RT Message-ID: <20220420102006.GD2731@worktop.programming.kicks-ass.net> References: <20220413132451.GA27281@redhat.com> <20220413185704.GA30360@redhat.com> <20220413185909.GB30360@redhat.com> <20220413192053.GY2731@worktop.programming.kicks-ass.net> <20220413195612.GC2762@worktop.programming.kicks-ass.net> <20220414115410.GA32752@redhat.com> <20220414183433.GC32752@redhat.com> <20220415101644.GA10421@redhat.com> <20220415105755.GA15217@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220415105755.GA15217@redhat.com> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 15, 2022 at 12:57:56PM +0200, Oleg Nesterov wrote: > On 04/15, Oleg Nesterov wrote: > > > > OK, so far it seems that this patch needs a couple of simple fixes you > > pointed out, but before I send V2: > > > > - do you agree we can avoid JOBCTL_TRACED_FROZEN in 1-2 ? > > > > - will you agree if I change ptrace_freeze_traced() to rely > > on __state == TASK_TRACED rather than task_is_traced() ? > > > > Forgot to say, I think 1/5 needs some changes in any case... > > ptrace_resume() does wake_up_state(child, __TASK_TRACED) but doesn't > clear JOBCTL_TRACED. The "else" branch in ptrace_stop() leaks this flag > too. Perhaps I missed something, I'll reread 1/5 again, but the main > question to me is whether 1-2 actually need the JOBCTL_TRACED_FROZEN flag. Ok, getting back to this. So I did the change to ptrace_resume(), but I'm not entirely sure I understand the issue with the else branch of ptrace_stop(). My understanding is that if we hit that else branch, we've raced wth __ptrace_unlink(), and that will have done: if (... || task_is_traced(child)) ptrace_signal_wake_up(child, true); Which will have done that wakeup and cleared both __state and jobctl.