Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2614064pxb; Sun, 31 Oct 2021 20:44:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzIhpQIbZt7tC926KtVbzHd8gJArfwPiOksCOCINKkEve3JYPjJi+7wTy3WmfJ8yFqZM3qW X-Received: by 2002:a17:906:2d51:: with SMTP id e17mr33201489eji.132.1635738292123; Sun, 31 Oct 2021 20:44:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635738292; cv=none; d=google.com; s=arc-20160816; b=Bunp3apIPUF6pKfkN5QsZq0BxaxSq5Ldb9jFgRdzpV7M4KUbrPUg8kB5aBX66jDXwt WLzcGjGGEl6/aWu19n47ywDD1t1A25qVwgMf2S40H/9XSnkHiuEBMHzMrOD0t3EHZSFQ PKYac3+qwBFE7chw9xiaW6cggZnsR478/Yq+R10zWTguiq1ME20XelHV1Q9fFMyCJ3+2 +wZR8y1qZkv87iOsSVDBVBbBXcHWEHXKT1gVLjvIVBBrgPRq4ydkv21i1a1CMKT2Y3x2 iEudpqN+mDlADiSrRj82Iqi00UnzcWdGlTO6fCfWXJRICReQxjWBZaj4JPwYg2fj/U6g TAcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qJkJaIGphShFQXkRYHBKnvd7e3QDBTULp9qNkGUUZ1w=; b=jwK89qCSq3JD6Bosl+a1tFxUICIFQmRAWI5rT3l9sIG3mo+M1yF89rhsNXouQ8lK5L +0mJ+WAGn9PpcRBhZome7ZwJIzJ3IcOaBXZPiuGGVzd8LHuL2AiBDsVef57o0fwzadoU u5PwNr1QJqoVEZx3YnnMFdUCkxaxirefMHIbuEmRC+1eMa8Ipoc6AxphWH8LKf4IYaqY P28Em7vbJyERh/nJlQRRk1eMn3jhBmvg93Wc4Aj/J2sPL2SLOYKPI5gMeY/HggNsQYxa n47bnc1mhbHJxl1FpNIh0mcUwcuATnFgJvdmSbkQpYj7J06MmsF+iB5BhlEC8n9Aiovr 8Orw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kylehuey.com header.s=google header.b=k6qGHfdY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c11si24074303edx.502.2021.10.31.20.44.26; Sun, 31 Oct 2021 20:44:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kylehuey.com header.s=google header.b=k6qGHfdY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230320AbhKADpL (ORCPT + 99 others); Sun, 31 Oct 2021 23:45:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230281AbhKADpH (ORCPT ); Sun, 31 Oct 2021 23:45:07 -0400 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC515C061746 for ; Sun, 31 Oct 2021 20:42:34 -0700 (PDT) Received: by mail-pl1-x632.google.com with SMTP id t11so10688249plq.11 for ; Sun, 31 Oct 2021 20:42:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kylehuey.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qJkJaIGphShFQXkRYHBKnvd7e3QDBTULp9qNkGUUZ1w=; b=k6qGHfdYxl7a8/J640Mxj1QM8KE2+KVfUHUsn66oEhwOIN8HQqsqAyVal4k5KG6JfF C3gMHEBeK3Dlg4Sx+g2KA1035IgoUErWh/sOtpWlhbaeJHHuuwHFwrnRe/lgG0FnSTVT a53c26FOhi3cOWusbtCVl3T8d1St/XrQm8a66Ukf5san9FNyOfSL4FxOZRBeZOii6W6Y uPV6fama2Afpp7sQAYD6yV2qLp4ZWAmhY/yrMRJfIYQCv5L4FwDW9JyowIu1oBkto+iN SnuEmZ/YDXZDoD0SUaK17wZxurJ6uZguiKWoSD2WnFQ9KiMkxkvf9eujD2ViYeaBo6zk q5pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qJkJaIGphShFQXkRYHBKnvd7e3QDBTULp9qNkGUUZ1w=; b=DfT/+9D5/SIC0aoTo8P38gLzDwPUTxW7ntzbM2KZAtBtSsZrrlnp5oyIgZdO3QZ+SE 4ok1pcQIZiraOlOpWPSfRaSRogS4jzZOgoz1QftGBJ9f+DxMa9ktupzf6TgeltJvSwru 6cIJsHKR1ldGgFIuLRDxcocdP2hrjXQaeHOAI7AEx/XoCrVMJD/0xfilRUzo5OT1u2U1 VwNMrDGOk88lU9WVc9dK3MB5yO0WLExsr1N1WP7xbFm6ECf1oDJ2bbHXop8SmSPfLDHK GrojGcuVKTURD3lwvIISIRQxXrkMY0tqfhqcNMdJoss4R7g3PbJ2sNSUW4JCIhcK5r5w GcRA== X-Gm-Message-State: AOAM533u7jCuAiFcIDVNNFGUaRG6YPrCxXeyMqdnh8AXzGjyLYd2jVzX 52sRcoOSnU4mCaKKVNS9D9gmNQ== X-Received: by 2002:a17:902:b7cb:b0:141:b33a:9589 with SMTP id v11-20020a170902b7cb00b00141b33a9589mr15538170plz.9.1635738154364; Sun, 31 Oct 2021 20:42:34 -0700 (PDT) Received: from minbar.home.kylehuey.com (c-71-198-251-229.hsd1.ca.comcast.net. [71.198.251.229]) by smtp.gmail.com with ESMTPSA id x9sm11270588pga.28.2021.10.31.20.42.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Oct 2021 20:42:33 -0700 (PDT) From: Kyle Huey X-Google-Original-From: Kyle Huey To: "Eric W. Biederman" , Jens Axboe , Peter Zijlstra , Marco Elver , Oleg Nesterov , Thomas Gleixner , Peter Collingbourne , Alexey Gladkov Cc: Robert O'Callahan , =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= , linux-kernel@vger.kernel.org Subject: [PATCH 1/2] signal: factor out SIGKILL generation in get_signal Date: Sun, 31 Oct 2021 20:41:46 -0700 Message-Id: <20211101034147.6203-2-khuey@kylehuey.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211101034147.6203-1-khuey@kylehuey.com> References: <20211101034147.6203-1-khuey@kylehuey.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In preparation for adding a second case that will invoke the same code, factor out this branch. Fix label formatting while we're nearby too. Signed-off-by: Kyle Huey Reported-by: Marko Mäkelä --- kernel/signal.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/kernel/signal.c b/kernel/signal.c index 487bf4f5dadf..4d26ee5c662a 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -2690,12 +2690,7 @@ bool get_signal(struct ksignal *ksig) /* Has this task already been marked for death? */ if (signal_group_exit(signal)) { - ksig->info.si_signo = signr = SIGKILL; - sigdelset(¤t->pending.signal, SIGKILL); - trace_signal_deliver(SIGKILL, SEND_SIG_NOINFO, - &sighand->action[SIGKILL - 1]); - recalc_sigpending(); - goto fatal; + goto kill; } for (;;) { @@ -2816,7 +2811,16 @@ bool get_signal(struct ksignal *ksig) continue; } - fatal: + goto fatal; + +kill: + ksig->info.si_signo = signr = SIGKILL; + sigdelset(¤t->pending.signal, SIGKILL); + trace_signal_deliver(SIGKILL, SEND_SIG_NOINFO, + &sighand->action[SIGKILL - 1]); + recalc_sigpending(); + +fatal: spin_unlock_irq(&sighand->siglock); if (unlikely(cgroup_task_frozen(current))) cgroup_leave_frozen(true); -- 2.33.1