Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2564184iob; Fri, 6 May 2022 05:54:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyP7TGDjct+yVz/PTXQKM2dcsy6NHpDYeiNO1U6O2XOBLgkuMtwJa3QTJC5JVLTSrSRyFPc X-Received: by 2002:a17:90b:1b01:b0:1dc:46ed:90de with SMTP id nu1-20020a17090b1b0100b001dc46ed90demr12292770pjb.107.1651841642077; Fri, 06 May 2022 05:54:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651841642; cv=none; d=google.com; s=arc-20160816; b=wAGOiaNweFobqMTYnTFjv6h9edVrqWliNDJ3+iFaIcDfkeOYveDG5knfGjmbgGEdBL uMQxqJVkZddocoHDVvvyJ2VxNqJDnlj9LtnQe7AT6BypnJcDFdOrH6zB0+ZUpU4yC21c +xalQFJfzVDc6kDotyAyeSEuRuaXO5mZshzLHmbf6UC3Tc6tnKLt09SqEFBCbdXFxx3c fX2NJ79F6L1Gy5jReo1IDYVGAA55UyTHnFBGnlbM6sjGx/TxQsmQ9RAj5MiD2cqe+7T1 RzLn4q7tQ6Sj8N7JXLWIuPvt/kUlDL8/9wOnFqtjCyUOsWmwZ7TVYCvxpQRFNdPneQKQ vx8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:cc:to:from; bh=sQwAgo7A5Cxr0+r/iAjMAOQChNbXZktdfyQSt6Dn6qI=; b=VYdiQ6S1HSDzNC4x+A1rIaGG5EYCYeChjamsbX9hbA5gwwGQ4V6UjRyPp8s81PPmU/ gJSQ10DHEXNfg5T43UHQeS2srW+F8lr22skxiTYX5hO2kqrbM76cxTHkYoVxJyGLa7os xchz7fZ2X7v8AtH7dxaUfBL4zesa5YO9Ui0FZ781sNmzPfhC1EuMQX5Akzb1QK+iUT4d PzEEOd1tjHPbDlOe0bjto5qeUnpat2egHJFlupyGDau/DzaVdoQO/1H50xQJmx2zkvlA he2CIC6TIIpwDp+Yv/rUumPVLmWhO8teRb/AHZ0tlF2/DxELGGOUMamSHB26dikXa+Xu l9cA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=xmission.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a1-20020a654181000000b003c14249f5a1si4338617pgq.410.2022.05.06.05.53.45; Fri, 06 May 2022 05:54:02 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=xmission.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384608AbiEESjG (ORCPT + 99 others); Thu, 5 May 2022 14:39:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383324AbiEEShG (ORCPT ); Thu, 5 May 2022 14:37:06 -0400 Received: from out03.mta.xmission.com (out03.mta.xmission.com [166.70.13.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D4A55EBF8; Thu, 5 May 2022 11:27:48 -0700 (PDT) Received: from in01.mta.xmission.com ([166.70.13.51]:59798) by out03.mta.xmission.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1nmgCZ-00GUxW-Dg; Thu, 05 May 2022 12:27:47 -0600 Received: from ip68-227-174-4.om.om.cox.net ([68.227.174.4]:37118 helo=localhost.localdomain) by in01.mta.xmission.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1nmgCY-002BtP-GM; Thu, 05 May 2022 12:27:46 -0600 From: "Eric W. Biederman" To: linux-kernel@vger.kernel.org Cc: rjw@rjwysocki.net, Oleg Nesterov , 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, "Eric W. Biederman" Date: Thu, 5 May 2022 13:26:44 -0500 Message-Id: <20220505182645.497868-11-ebiederm@xmission.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <87a6bv6dl6.fsf_-_@email.froward.int.ebiederm.org> References: <87a6bv6dl6.fsf_-_@email.froward.int.ebiederm.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-XM-SPF: eid=1nmgCY-002BtP-GM;;;mid=<20220505182645.497868-11-ebiederm@xmission.com>;;;hst=in01.mta.xmission.com;;;ip=68.227.174.4;;;frm=ebiederm@xmission.com;;;spf=softfail X-XM-AID: U2FsdGVkX19mfYRFEKHNjppp0QYV22OU7oTvpzaGpb8= X-SA-Exim-Connect-IP: 68.227.174.4 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Virus: No X-Spam-DCC: XMission; sa03 1397; Body=1 Fuz1=1 Fuz2=60 X-Spam-Combo: ***;linux-kernel@vger.kernel.org X-Spam-Relay-Country: X-Spam-Timing: total 307 ms - load_scoreonly_sql: 0.04 (0.0%), signal_user_changed: 4.8 (1.6%), b_tie_ro: 3.2 (1.1%), parse: 1.14 (0.4%), extract_message_metadata: 10 (3.3%), get_uri_detail_list: 1.36 (0.4%), tests_pri_-1000: 11 (3.6%), tests_pri_-950: 0.97 (0.3%), tests_pri_-900: 0.85 (0.3%), tests_pri_-90: 59 (19.2%), check_bayes: 58 (18.7%), b_tokenize: 5 (1.8%), b_tok_get_all: 6 (2.0%), b_comp_prob: 1.53 (0.5%), b_tok_touch_all: 41 (13.4%), b_finish: 0.84 (0.3%), tests_pri_0: 207 (67.2%), check_dkim_signature: 0.38 (0.1%), check_dkim_adsp: 2.8 (0.9%), poll_dns_idle: 1.38 (0.4%), tests_pri_10: 2.6 (0.9%), tests_pri_500: 7 (2.4%), rewrite_mail: 0.00 (0.0%) Subject: [PATCH v4 11/12] ptrace: Always take siglock in ptrace_resume X-SA-Exim-Version: 4.2.1 (built Sat, 08 Feb 2020 21:53:50 +0000) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Make code analysis simpler and future changes easier by always taking siglock in ptrace_resume. Signed-off-by: "Eric W. Biederman" --- kernel/ptrace.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/kernel/ptrace.c b/kernel/ptrace.c index 83ed28262708..36a5b7a00d2f 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c @@ -837,8 +837,6 @@ static long ptrace_get_rseq_configuration(struct task_struct *task, static int ptrace_resume(struct task_struct *child, long request, unsigned long data) { - bool need_siglock; - if (!valid_signal(data)) return -EIO; @@ -874,18 +872,11 @@ static int ptrace_resume(struct task_struct *child, long request, * Note that we need siglock even if ->exit_code == data and/or this * status was not reported yet, the new status must not be cleared by * wait_task_stopped() after resume. - * - * If data == 0 we do not care if wait_task_stopped() reports the old - * status and clears the code too; this can't race with the tracee, it - * takes siglock after resume. */ - need_siglock = data && !thread_group_empty(current); - if (need_siglock) - spin_lock_irq(&child->sighand->siglock); + spin_lock_irq(&child->sighand->siglock); child->exit_code = data; wake_up_state(child, __TASK_TRACED); - if (need_siglock) - spin_unlock_irq(&child->sighand->siglock); + spin_unlock_irq(&child->sighand->siglock); return 0; } -- 2.35.3