Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp7276570rwd; Tue, 6 Jun 2023 08:32:01 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4HwDx5QL46fVCVRWs9rza9niauw3a7yV5HLhnf9GPUsZzTYmP/0IJxyE3hRLyn05ZpsEwc X-Received: by 2002:a05:6a21:6d9a:b0:114:7637:3459 with SMTP id wl26-20020a056a216d9a00b0011476373459mr117950pzb.4.1686065521679; Tue, 06 Jun 2023 08:32:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686065521; cv=none; d=google.com; s=arc-20160816; b=tFIlj9aZ2CP3bsNKXWbNWokdxCTl1+GJXJOqHZ4uPWvDf0HcRgL4qKsCIityr01g3F MeI8Huop7jZIdwXvQBnUqaeqraKhgouwQTR7hGlOiJ6VfKMVU7An4KmEyVXkZ9Xy+Mky 7cQKiTW/9T5cW4ovWERO7apV7kk7LFd4IT0R4OzmF0euvLO8477xJGIYX2i0cJMxcUww GHA0kYS7sc02FVkCJAR+/YgtQfcD9+arTWG1r49nYPJ94svkf7QMas9r5iLjY3j4hCO6 WGzV9+cQUN9p0AEVXec+CliLHF4N1F6jMAyslYBIPyv+K/fx7lsM2YMwajDxBrzfiuHn xJrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:mime-version:references:subject:cc:to:from :dkim-signature:dkim-signature:message-id; bh=jyhJ/3GMU7sDY6xXeRfAzgG/VNBQy0NUgflCvHfEUKI=; b=VMV7D7a+BAiy8y3bACL5GTBCvyGvaPyCvS3qBZbIDmEn56BEdfY0h+VV+GZ8CjLqPN jLyB3ZD3EhmsSYYC93rnagiuoBHjUOVZQ97uJddKLnS4WFDtbgT9HMRp9N4K/8kruUS1 Sr1PLnTbXqGVnQZ0262b0yGJFJx9was/oQeDmEGQsnSjyYgV/ERLLrR8FWSGMdTK+CL+ xRtsh3ms+o/XctA4j46K8xOo3cXVFi8F2eNfO6SAT5BM9O6pUOdQVRNJ0Xr/b7Ad4fzz ULXh30co7uLK6/LfFMNfe0/17uBfF8/wrNnDS++lW/mYrwc0zCEsXC0K6drUaXueJyjm ZuBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=XJilMgHM; dkim=neutral (no key) header.i=@linutronix.de; 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=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c18-20020a170902b69200b001b205a140fasi3880026pls.387.2023.06.06.08.31.49; Tue, 06 Jun 2023 08:32:01 -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=@linutronix.de header.s=2020 header.b=XJilMgHM; dkim=neutral (no key) header.i=@linutronix.de; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238366AbjFFOlj (ORCPT + 99 others); Tue, 6 Jun 2023 10:41:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238354AbjFFOk4 (ORCPT ); Tue, 6 Jun 2023 10:40:56 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A80911BD5 for ; Tue, 6 Jun 2023 07:39:11 -0700 (PDT) Message-ID: <20230606142033.172901153@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1686062299; 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: references:references; bh=jyhJ/3GMU7sDY6xXeRfAzgG/VNBQy0NUgflCvHfEUKI=; b=XJilMgHM4dy9cG9v0F6jyIRHdq6ACnil9FvydviHNHu7inyWZ/fx45hSDqAuNz94cKj0vE enpsGWuvD3DGfZjgYaBI9R5lV3TBjwSQBJSg3GiXnc0Vx2kerYmC2qYG9PtBsJpcYQr6Fk Cps1voMigj6U4UKBV49hXW8apAh3Rif3C51aPFhWeWN3QL6VHUFsRqJSDO35WHmrAs/T1B NHOAQPuPSYEhLjGCN5STeqRPp/dMAVHUq4nIFZstODIQzMNo1Tk1UE/XThfM1krMGuMf4h VNCJcelb2WbxdzWdxlwPI0NN+W0g/+bmtFU2GoqPO17U5T50yBUNo+xNRCN58g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1686062299; 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: references:references; bh=jyhJ/3GMU7sDY6xXeRfAzgG/VNBQy0NUgflCvHfEUKI=; b=RLxZMsOTpnVTE7P8NlmT+H5U2JMs2DASwAD18xvfifkr75/k6ysGl+21VdvBYKC+2+U4/e 8OuAtFyJ3UcNJkCw== From: Thomas Gleixner To: LKML Cc: Frederic Weisbecker , Anna-Maria Behnsen , John Stultz , Peter Zijlstra , Ingo Molnar , Stephen Boyd , Eric Biederman , Oleg Nesterov Subject: [patch 38/45] signal: Add task argument to flush_sigqueue_mask() References: <20230606132949.068951363@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Date: Tue, 6 Jun 2023 16:38:19 +0200 (CEST) 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_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 To prepare for handling posix timer signals on sigaction(SIG_IGN) properly, add a task argument to flush_sigqueue_mask() and fixup all call sites. This argument will be used in a later step to enqueue posix timers on an ignored list, so their signal can be requeued when SIG_IGN is lifted later on. Signed-off-by: Thomas Gleixner --- kernel/signal.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) --- a/kernel/signal.c +++ b/kernel/signal.c @@ -727,11 +727,10 @@ void signal_wake_up_state(struct task_st /* * Remove signals in mask from the pending set and queue. - * Returns 1 if any signals were found. * * All callers must be holding the siglock. */ -static void flush_sigqueue_mask(sigset_t *mask, struct sigpending *s) +static void flush_sigqueue_mask(sigset_t *mask, struct sigpending *s, struct task_struct *ptmr_tsk) { struct sigqueue *q, *n; sigset_t m; @@ -869,18 +868,18 @@ static bool prepare_signal(int sig, stru * This is a stop signal. Remove SIGCONT from all queues. */ siginitset(&flush, sigmask(SIGCONT)); - flush_sigqueue_mask(&flush, &signal->shared_pending); + flush_sigqueue_mask(&flush, &signal->shared_pending, NULL); for_each_thread(p, t) - flush_sigqueue_mask(&flush, &t->pending); + flush_sigqueue_mask(&flush, &t->pending, NULL); } else if (sig == SIGCONT) { unsigned int why; /* * Remove all stop signals from all queues, wake all threads. */ siginitset(&flush, SIG_KERNEL_STOP_MASK); - flush_sigqueue_mask(&flush, &signal->shared_pending); + flush_sigqueue_mask(&flush, &signal->shared_pending, NULL); for_each_thread(p, t) { - flush_sigqueue_mask(&flush, &t->pending); + flush_sigqueue_mask(&flush, &t->pending, NULL); task_clear_jobctl_pending(t, JOBCTL_STOP_PENDING); if (likely(!(t->ptrace & PT_SEIZED))) { t->jobctl &= ~JOBCTL_STOPPED; @@ -4097,8 +4096,8 @@ void kernel_sigaction(int sig, __sighand sigemptyset(&mask); sigaddset(&mask, sig); - flush_sigqueue_mask(&mask, ¤t->signal->shared_pending); - flush_sigqueue_mask(&mask, ¤t->pending); + flush_sigqueue_mask(&mask, ¤t->signal->shared_pending, NULL); + flush_sigqueue_mask(&mask, ¤t->pending, NULL); recalc_sigpending(); } spin_unlock_irq(¤t->sighand->siglock); @@ -4165,9 +4164,9 @@ int do_sigaction(int sig, struct k_sigac if (sig_handler_ignored(sig_handler(p, sig), sig)) { sigemptyset(&mask); sigaddset(&mask, sig); - flush_sigqueue_mask(&mask, &p->signal->shared_pending); + flush_sigqueue_mask(&mask, &p->signal->shared_pending, NULL); for_each_thread(p, t) - flush_sigqueue_mask(&mask, &t->pending); + flush_sigqueue_mask(&mask, &t->pending, NULL); } }