Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp242053iob; Mon, 2 May 2022 18:15:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzGojcwhZvdjGZIVUTlMVoZH5seFHZNnLIOVc3JRr+UngBe6MQxG3JrUq2mqk0C0uRqAq3 X-Received: by 2002:a17:90b:4a92:b0:1dc:52a9:6387 with SMTP id lp18-20020a17090b4a9200b001dc52a96387mr2064316pjb.41.1651540549007; Mon, 02 May 2022 18:15:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651540549; cv=none; d=google.com; s=arc-20160816; b=o4kJAU6EMwkX7E15br508aItvyE//x6x2FlRYJMzc1CvdA3tgYt/reXM2zOJpeiO/H tcJ+boWD0b158QfBIIhbOBvWDhCTeYttQdGfV3ghYQ6/OeurC0R5DVhL7mWe1R5qFm/I oABFXAhhiY0JKxx0FoYKwNH3GuOiSzonTsYw8Xm9ZaBw0BWrXBP12+wVFxgVQhduRQ2e Zh9y+lZ37pdhX91WPFqWSIXIdRAwQQXVLYz/5n9fpuxz2CNbIQkjAby5c4tE1KsJMn4G l6uZv4rdWI3XBFlj1JKzAR60P6KOjSb7UrLx/cyPWt0Hkd8NxLxxePVjfOPyBdcv1eU5 aDxA== 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=wVoPR7+BaUM00iEkwlBxjF0xXPgmMZX2vpPWycEtV78=; b=dBO2wwpAdd8LEw4wH9upbIZJ7krVtZObxo0s/0eS51q88QCfCwidjtzg0qmmmlNGlx WB68B0ERZEr+vLqSQ/h4zesufQQBUKCbJfFGdHzCYgSew4TfJfYkqZ4IZMROK4d7tkC3 tISBz3w2k5MZ21iJ9UmIohY0vR31s4sgkXeLlPjVSYdbt20lJUsIgrEQoHqefuVQEjvI cbRKlBTqYSiCQ0MP4sk7pGRV9lp4GHxizEQ+BxuYCaARIjbPvAIJWHaoaq2ZjinTuOPU t5suyFeMSazhh84UasaNdA5yT7l5aqLWJAtKpe7v7nzJeqbyVHgi82gONLQ2/0Kpj2QB vd6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=c4nzDu6R; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id g20-20020a056a00079400b0050df434f381si2785373pfu.39.2022.05.02.18.15.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 18:15:48 -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=@redhat.com header.s=mimecast20190719 header.b=c4nzDu6R; 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; 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 1075F3A18C; Mon, 2 May 2022 17:55:49 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238109AbiEBOlm (ORCPT + 99 others); Mon, 2 May 2022 10:41:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237898AbiEBOlg (ORCPT ); Mon, 2 May 2022 10:41:36 -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 1E5E212620 for ; Mon, 2 May 2022 07:38:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651502287; 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=wVoPR7+BaUM00iEkwlBxjF0xXPgmMZX2vpPWycEtV78=; b=c4nzDu6RKXJ+l12VxDYsxfPyjlT70JPw1gUqzy/HCdWGNFO/Dvb3r0zVwJPSvMU0QDM8oX Shh9jxfgMZjrVHQOoaHCINAynYglCrs6VXIAaDMZ/5s5pVxGj0PdHYFE7R362T7Y1x7Cxe oGm3xNLyOINVDrAnW07gXwQEjI+GxPI= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-152-MmWCcKafP32gX5GLYtBFzw-1; Mon, 02 May 2022 10:37:59 -0400 X-MC-Unique: MmWCcKafP32gX5GLYtBFzw-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 3E91C3806707; Mon, 2 May 2022 14:37:58 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.40.192.34]) by smtp.corp.redhat.com (Postfix) with SMTP id DBB8540869CE; Mon, 2 May 2022 14:37:52 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Mon, 2 May 2022 16:37:57 +0200 (CEST) Date: Mon, 2 May 2022 16:37:51 +0200 From: Oleg Nesterov To: "Eric W. Biederman" Cc: linux-kernel@vger.kernel.org, rjw@rjwysocki.net, mingo@kernel.org, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, mgorman@suse.de, bigeasy@linutronix.de, Will Deacon , tj@kernel.org, linux-pm@vger.kernel.org, Peter Zijlstra , Richard Weinberger , Anton Ivanov , Johannes Berg , linux-um@lists.infradead.org, Chris Zankel , Max Filippov , linux-xtensa@linux-xtensa.org, Kees Cook , Jann Horn , linux-ia64@vger.kernel.org, stable@vger.kernel.org, Al Viro Subject: Re: [PATCH v2 06/12] ptrace: Reimplement PTRACE_KILL by always sending SIGKILL Message-ID: <20220502143750.GC17276@redhat.com> References: <87k0b7v9yk.fsf_-_@email.froward.int.ebiederm.org> <20220429214837.386518-6-ebiederm@xmission.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220429214837.386518-6-ebiederm@xmission.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.6 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,T_SCC_BODY_TEXT_LINE 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/29, Eric W. Biederman wrote: > > Call send_sig_info in PTRACE_KILL instead of ptrace_resume. Calling > ptrace_resume is not safe to call if the task has not been stopped > with ptrace_freeze_traced. Oh, I was never, never able to understand why do we have PTRACE_KILL and what should it actually do. I suggested many times to simply remove it but OK, we probably can't do this. > --- a/kernel/ptrace.c > +++ b/kernel/ptrace.c > @@ -1238,7 +1238,7 @@ int ptrace_request(struct task_struct *child, long request, > case PTRACE_KILL: > if (child->exit_state) /* already dead */ > return 0; > - return ptrace_resume(child, request, SIGKILL); > + return send_sig_info(SIGKILL, SEND_SIG_NOINFO, child); Note that currently ptrace(PTRACE_KILL) can never fail (yes, yes, it is unsafe), but send_sig_info() can. If we do not remove PTRACE_KILL, then I'd suggest case PTRACE_KILL: if (!child->exit_state) send_sig_info(SIGKILL); return 0; to make this change a bit more compatible. Also, please remove the note about PTRACE_KILL in set_task_blockstep(). Oleg.