Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp1215420pxb; Thu, 14 Apr 2022 00:36:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGwHFlYR3ZfVykNEkRrU3DIZg60N+JjZokpJxXjyyk+o8ajOp5V6nUm9Rr38U0ctjll0pa X-Received: by 2002:a17:906:18b2:b0:6d0:ee54:1add with SMTP id c18-20020a17090618b200b006d0ee541addmr1223627ejf.499.1649921799134; Thu, 14 Apr 2022 00:36:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649921799; cv=none; d=google.com; s=arc-20160816; b=shOh+KYJEfJXYcxravci6uHILhLd4IcaaHo+A6hthyR1lvaXZg5kZuk0Dj6BGvCvi6 YTFR5S6Bgq3VRFDjwqFz4H7XdUPcuhmQnuJLW1M/QqFVlVGPddyvMr5L+thtTrQw9rbg QJj9DnDE6WKvevl4oUKU+x9/z9mqgvq5C0pHOgm5UVkb84NbCd/YQZBPmqkZteu3AUzK PGYac/tO3B36OiZq1BFJzRpfYcyYn9U5Ebnbj2cDN7CkhQQx5fZZiuwTYAmCh4Dti/HK l9aHNM6WSbdPA5R+PfPsWx+l0Q2xOqJUI+gq9PnhQ4P2YU/+n9ueXzG50s2AoEU6BRDK Xr/Q== 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=X4mDClISUBAr0O67B/LksnVAGP1eJFmEICVY8cBIZy0=; b=1BFrZsrsY4Di1MhDNANC2xoFiPOiZr9viD6ogmj1/5tr1LvtrL2MfzKX1quVZTkYGz hHvtQ/ByFRWQ2DFV0hNJn1hgRh6l9qpdHL7qdveVMx8VkYk4O49CXVHm+k2TQazYJLDJ nVECY9K+yf5eepVOxFKNwg0A+91Uj40T0lxvm+RjFNpa2ms+nTaliXX61sl6eQDJHqHx unf8z1PTsO++tDoNV4KEBWdD9nGxxzjizJbdFuRep6m8/NO/ZUAtYOLvqbzBIUJlBcCk h/qfvo4zetozRuIIk9m23HxSr5/47FFopFkSKHgMdv9ypOO/iXDUJs4+erBsQGwTjvPo f1Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OZZr7GPf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s3-20020a056402520300b00418eca85fb2si3162389edd.130.2022.04.14.00.36.13; Thu, 14 Apr 2022 00:36:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OZZr7GPf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235700AbiDMN11 (ORCPT + 99 others); Wed, 13 Apr 2022 09:27:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235728AbiDMN1Z (ORCPT ); Wed, 13 Apr 2022 09:27:25 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0338152B12 for ; Wed, 13 Apr 2022 06:25:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649856302; 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=X4mDClISUBAr0O67B/LksnVAGP1eJFmEICVY8cBIZy0=; b=OZZr7GPfKId2rWhIeC2ddMbr3gXcZlRfYLtNkMWQgXbFl5kLT66toRlGoXAXSDWx/4NKPm eUdskKSJ9isRyB0rf8+2JEZ6YS8glU/YS0u5VWb1zPyNKggfxG+aVrVeVj/G0qfuRsgG/G tIhaVMLnxIwlWaEnE1aKGPFacbgXrxc= 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-108-JssMX-eJPV6qodjEdwpUeg-1; Wed, 13 Apr 2022 09:24:58 -0400 X-MC-Unique: JssMX-eJPV6qodjEdwpUeg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3A93D1066559; Wed, 13 Apr 2022 13:24:57 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.40.193.165]) by smtp.corp.redhat.com (Postfix) with SMTP id 0A2D0404776F; Wed, 13 Apr 2022 13:24:53 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Wed, 13 Apr 2022 15:24:56 +0200 (CEST) Date: Wed, 13 Apr 2022 15:24:52 +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: <20220413132451.GA27281@redhat.com> References: <20220412114421.691372568@infradead.org> <20220412114853.842942162@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220412114853.842942162@infradead.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham 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 Hi Peter, I like 1-2 but I need to read them (and other patches) again, a couple of nits right now. On 04/12, Peter Zijlstra wrote: > > +static int __ptrace_freeze_cond(struct task_struct *p) > +{ > + if (!task_is_traced(p)) > + return -ESRCH; if (!task_is_traced(p) || p->parent != current) return -ESRCH; we should not spin/sleep if it is traced by another task > +static int __ptrace_freeze(struct task_struct *p, void *arg) > +{ > + int ret; > + > + ret = __ptrace_freeze_cond(p); > + if (ret) > + return ret; > + > + /* > + * Task scheduled between __ptrace_pre_freeze() and here, not our task > + * anymore. > + */ > + if (*(unsigned long *)arg != p->nvcsw) > + return -ESRCH; > + > + if (looks_like_a_spurious_pid(p)) > + return -ESRCH; Oh, I do not think __ptrace_freeze() should check for spurious pid... looks_like_a_spurious_pid() should be called once in ptrace_check_attach() before task_call_func(__ptrace_freeze). Oleg.