Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp517260iob; Thu, 28 Apr 2022 07:23:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwLcOUXSGDiawWFBkCXb6Takrr0Ai6nEMON7PjgVQCEQmH89dKfYZbQ1ZrqOOfjF7Q8XM38 X-Received: by 2002:a2e:80d5:0:b0:24f:616:1990 with SMTP id r21-20020a2e80d5000000b0024f06161990mr17047243ljg.17.1651155822046; Thu, 28 Apr 2022 07:23:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651155822; cv=none; d=google.com; s=arc-20160816; b=p0I+3JbGp6XTvG/H/fPEKRO1hvQGqnfwxW+R/fZ7Vvsg8p/LQQSTOU0I/iSVqvQZI2 +tFcuvOOCQauJKqX2iSLGKg8fuPvmFIgX6dGfpFvD/Mu1tisCa3bMf/ehCdKCI7lSZFg QW3P46RgrKvPob4QoETAICaOuLw33uxAwpNQWUIjef1ey6RXJGbx4c1EPfYKbh0eQF5+ iAhSfZX7d9iVgdbWM6KDVlARwGgNUW8ClmVadO/WXp9opIN+G2WKTsRZvlfDhFvhSLp6 0wbn/f2QaV/D7Ix/qpn/inXiebV5f0tnCnkWRx5NjOYYN1S7M5+BR0l5Lo7xoImWqXCQ 4ogQ== 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=39bYJZ1yrDJNMDn/aX063F9Jn6M2z3AydqcJ0Ax4Cek=; b=IFb1x5QuKfYt8YrXrioctTF4CvPtkGI9LlUx86gNW7Sx0tCdW3M54iSQa4zXr5lf3l MI6rUKusDZRvCHkSwK7kaMZDgpe77BwBM0qZDq2L3KwbxdDEeKjH94WpxDDtzCG+nxHz 9jlrMsm8qewMQtJx0zu8dGI81i0B8XUWY21EsKspqOG5slK9OFth1wRASbiAn0qXpqEm 4MH/RC33P1tIpyXFFZWinv9zrE+JmDuZYLt9ttP1lM+3u48FQVLSk8N1fejAtFZAswZC Me/8uP1yt3jveYNbP1bdq2fDLrxKfszG98N6A3qGtE0ekZHYxpUNR7McB0heS9cm4QAD LtXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=AU4Hc6WJ; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p4-20020a2e9ac4000000b0024dbfdfa131si4880854ljj.107.2022.04.28.07.22.49; Thu, 28 Apr 2022 07:23:42 -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=@infradead.org header.s=desiato.20200630 header.b=AU4Hc6WJ; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234867AbiD1Kaz (ORCPT + 99 others); Thu, 28 Apr 2022 06:30:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234813AbiD1Kaw (ORCPT ); Thu, 28 Apr 2022 06:30:52 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CFF649C8F; Thu, 28 Apr 2022 03:27:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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=39bYJZ1yrDJNMDn/aX063F9Jn6M2z3AydqcJ0Ax4Cek=; b=AU4Hc6WJRxDBT3Z2XgPMH/3xIB SqLp057cjQGHsuq13Z3QFhOkjs/KT6Sysa6d1iHl4AFa3vraX171VHKNyZaLCM8ti5zIARL7uYI8h UZ9WYH2uJFwhB+hNzzablZd4hW6I0goAz7YAhVYpnz1KRO/Q+WRFQBDL1+uZgxXu8K6iGE7iFIr+v ptBV34hak3xJFDheSShKtWVbUD3bMz3tXZh12L2DG/gUJhl9fqQkv+ETxKbXzhXXgX1w+vHOaBXBH oDSu6U+fYtGgeslHhOFd26Ftei/YhhGVXuwTucMlVSz+5xsNLNIAPvhIAcMGV3yU2Kg/SOJ61LwTj 6qMNOCqg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nk1Mf-009Jtp-WB; Thu, 28 Apr 2022 10:27:14 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id C99A830031D; Thu, 28 Apr 2022 12:27:11 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id B45312029F872; Thu, 28 Apr 2022 12:27:11 +0200 (CEST) Date: Thu, 28 Apr 2022 12:27:11 +0200 From: Peter Zijlstra To: "Eric W. Biederman" Cc: linux-kernel@vger.kernel.org, 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, Richard Weinberger , Anton Ivanov , Johannes Berg , linux-um@lists.infradead.org, Chris Zankel , Max Filippov , inux-xtensa@linux-xtensa.org, Kees Cook , Jann Horn Subject: Re: [PATCH 1/9] signal: Rename send_signal send_signal_locked Message-ID: References: <878rrrh32q.fsf_-_@email.froward.int.ebiederm.org> <20220426225211.308418-1-ebiederm@xmission.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220426225211.308418-1-ebiederm@xmission.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE 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 On Tue, Apr 26, 2022 at 05:52:03PM -0500, Eric W. Biederman wrote: > Rename send_signal send_signal_locked and make to make > it usable outside of signal.c. > > Signed-off-by: "Eric W. Biederman" > --- > include/linux/signal.h | 2 ++ > kernel/signal.c | 24 ++++++++++++------------ > 2 files changed, 14 insertions(+), 12 deletions(-) > > diff --git a/include/linux/signal.h b/include/linux/signal.h > index a6db6f2ae113..55605bdf5ce9 100644 > --- a/include/linux/signal.h > +++ b/include/linux/signal.h > @@ -283,6 +283,8 @@ extern int do_send_sig_info(int sig, struct kernel_siginfo *info, > extern int group_send_sig_info(int sig, struct kernel_siginfo *info, > struct task_struct *p, enum pid_type type); > extern int __group_send_sig_info(int, struct kernel_siginfo *, struct task_struct *); > +extern int send_signal_locked(int sig, struct kernel_siginfo *info, > + struct task_struct *p, enum pid_type type); > extern int sigprocmask(int, sigset_t *, sigset_t *); > extern void set_current_blocked(sigset_t *); > extern void __set_current_blocked(const sigset_t *); > diff --git a/kernel/signal.c b/kernel/signal.c > index 30cd1ca43bcd..b0403197b0ad 100644 > --- a/kernel/signal.c > +++ b/kernel/signal.c > @@ -1071,8 +1071,8 @@ static inline bool legacy_queue(struct sigpending *signals, int sig) > return (sig < SIGRTMIN) && sigismember(&signals->signal, sig); > } > > -static int __send_signal(int sig, struct kernel_siginfo *info, struct task_struct *t, > - enum pid_type type, bool force) > +static int __send_signal_locked(int sig, struct kernel_siginfo *info, > + struct task_struct *t, enum pid_type type, bool force) > { > struct sigpending *pending; > struct sigqueue *q; While there, could you please replace that assert_spin_locked() with lockdep_assert_held(&t->sighand->siglock) ? The distinction being that assert_spin_locked() checks if the lock is held *by*anyone* whereas lockdep_assert_held() asserts the current context holds the lock. Also, the check goes away if you build without lockdep.