Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp806360pxb; Fri, 22 Apr 2022 11:32:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwMcTJ3qN4RJCsbJUVHhj8w6m43ozKrZE0v6Jd03hZi6XaAqBa0SBoi0gp9NEZoi8NTU+27 X-Received: by 2002:a17:903:2091:b0:15c:b49b:664d with SMTP id d17-20020a170903209100b0015cb49b664dmr2361196plc.151.1650652340355; Fri, 22 Apr 2022 11:32:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650652340; cv=none; d=google.com; s=arc-20160816; b=smyRLVuJoHtL8vclYt34qbz2cuAWZ9petQKMefm9W67sbkpW+Jc+NYF0qhJDd4mq60 d1pcjxp4utQv+oQpbA7Vn17YVRs64sBIdoiHEgMHaXf6paFmnHZaksPGqFy0HM251DSb eiONT9MzjYXzLD9KfQF/Giz4TwuM67rWo2wNxiMbAnFOhBqo+umicRNcT9pqCjYPh6nM 8N9ReG2Uw3lDDtPR1I/37XjQkbyQDs7wjNPSVBbH3spxEm0OwetD1Z6TGdW3Ux6riw7l VPqwnRZ+dWW7irjpERU9nmMuMFGb6UFM9j30O0QzmGqFBYv//I9058STudtSPpKsi65f xAVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=BOeDwm19QZU5bj1yBihjhswrckaR7N4xxWK6qgyPxIA=; b=DGKCNhByTAk7K80PYuUrm69f9mm+Rna1fsbu5Zr7nJth3cianeQM5KLuUgSF+ue08o vs90g96e/B7CwgV4F/KsmUTZANnpO7pa1XfTjC2bacn+iydtRaq09rCphlUL6CDBrryV KXYj3M0jxxa5Oh4Rqn79+FlwMNaZxIYMTjy1jjVIqMlGG73y8LnGUOyuPumBGlS9H8dS tLOc2bTcJMVmNU5mIbLT7NOjeAG5m9VfxbrIS7jx6xe3Uu/PO9WXhpm+1yt8Eb8hYLlp PSljcpowyTbQUCn+/wu1EkLaSQE8jUHqPJVhMh1y00j6W2odjjL8So1E3Cr+KxRkem7M Wf8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZCgurH65; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id l8-20020a170902f68800b001561bf8defdsi9818759plg.592.2022.04.22.11.32.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 11:32:20 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZCgurH65; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 13E54C0D06; Fri, 22 Apr 2022 11:00:55 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346962AbiDRRWw (ORCPT + 99 others); Mon, 18 Apr 2022 13:22:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346991AbiDRRWh (ORCPT ); Mon, 18 Apr 2022 13:22:37 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D9A1911A34 for ; Mon, 18 Apr 2022 10:19:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650302396; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=BOeDwm19QZU5bj1yBihjhswrckaR7N4xxWK6qgyPxIA=; b=ZCgurH657/diQCpZwxz0p2PUXks1fuUjzV2vVjVWeptahCfhdy45efJLaxS2FZGIkK134G vyltAow0XPHCRmntnDKI8DELFmFentnefEuMyYPnWw4K0HFOMpeZOZfxuT6kCgJwsRXAu4 ZfpW1y0dacuBarmtuzvRt49sqNgCA0Y= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-437-7tjVyLDfNhGYyJThbh6otQ-1; Mon, 18 Apr 2022 13:19:52 -0400 X-MC-Unique: 7tjVyLDfNhGYyJThbh6otQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4AC56811E78; Mon, 18 Apr 2022 17:19:46 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.40.192.13]) by smtp.corp.redhat.com (Postfix) with SMTP id 34F3840FD37C; Mon, 18 Apr 2022 17:19:43 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Mon, 18 Apr 2022 19:19:45 +0200 (CEST) Date: Mon, 18 Apr 2022 19:19:42 +0200 From: Oleg Nesterov To: Peter Zijlstra 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: <20220418171941.GB16199@redhat.com> References: <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> <20220418170104.GA16199@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220418170104.GA16199@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=unavailable 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 04/18, Oleg Nesterov wrote: > > static int ptrace_check_attach(struct task_struct *child, bool ignore_state) > { ... > + if (!traced) > + return -ESRCH; > + > + WARN_ON(READ_ONCE(child->__state) == __TASK_TRACED); > + if (ignore_state) > + return 0; > + > + if (!task_is_traced(child)) > + return -ESRCH; This is the new check V1 didn't have, we need it to unsure that check_attach can't miss the change in child->jobctl and call wait_task_inactive() before the child marks itself as "traced" and clears JOBCTL_TRACED_XXX. Oleg.