Received: by 2002:ab2:784b:0:b0:1fd:adc2:8405 with SMTP id m11csp488435lqp; Mon, 10 Jun 2024 09:53:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVL5PalBAj6rvmJrel9+1gtWbtMLHsl5Cv4HV5c8/UW9k7TGXo2U7KuwTDaOT+W4w0kagTLmkuT8XdvOM6kI4swte/LVhnJ9w3TNQ/dvg== X-Google-Smtp-Source: AGHT+IELMi4baMTycJG7RT7UfyOEGVN6+n/bwx8qfA+gZNud4PNM4n4eMcl/La/0O/uLZXymDpzs X-Received: by 2002:a05:6a20:a111:b0:1b7:577c:7187 with SMTP id adf61e73a8af0-1b7577c737bmr3305913637.5.1718038415524; Mon, 10 Jun 2024 09:53:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718038415; cv=pass; d=google.com; s=arc-20160816; b=G53FzE3FT44RrmrRs7rrri5a+b4VzC3Eq2eoLShc062cvp/T6OYqFsEJvJCWnjhu6d Bd8+jOBCIG+g/8GMZc6Uk9/SKXBMr+2Zqcns93k3TCqphy4DHpLmWE4chEbRUt+Kji7k KkOzxC5PGgwnvyPh+LNBCzyEpsMrUg0/Z7ZrgBVizozEq5nK3Ik1pCWFS4uYq5oV/hma +Oi/xhFAOcH8aMX1qjFV1UZIctLjUpzqI4HnbxY8+JNa8qev9C/RJtcu6flVhoj3Sqou phbSyesiRKrJZhlud5D9DXwl+1a8ZphuxePhgYxG49qfHlPpaEgZO1Gxylsex5FwefKr 2frw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=date:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:subject:cc:to:from:dkim-signature :dkim-signature:message-id; bh=gS0GunzjJF0mIhSZ9sJXDkEdhMOznUExWpmLyjVDd8s=; fh=joBs/8L+orz77ylyCy6wqNwwi35f7sYhLR+/TQjQjhI=; b=DGt5Adf6rAnnLhBEKue878lu10g6CmazZO3WDvXt5G9v9IcA7g9VxUbzKGZdmsS6JY C/0717WC2f7G8zV508qiQeSFrgzIYGgxv/67qQAEwCxnEshGMsw6TmLxfAhm/mzWVaMK y3EkgyHz1Uh60LLLaVXrRtBAfnkbR/QCp3U8nQ+QgZIm1nUbvNaC8u/HLhBwNSnW4YRn siKWNMUPkTAfrSsiwNIKVHpPnSemD+QvpFgDJniDuDjS6iRk0g/B7itHOV8CkNA7xuep bNg5dmX4ULO70AfB0gyRMszEXffY8xrRXV9eYHmcqVlmmK0gbNvnQARHVYCMuIjTOG7y 0TcA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=mn5OaB9j; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-208608-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208608-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6e4e910dea6si5267146a12.299.2024.06.10.09.53.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 09:53:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-208608-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=mn5OaB9j; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-208608-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208608-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E31762853E2 for ; Mon, 10 Jun 2024 16:52:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 18E1F158D80; Mon, 10 Jun 2024 16:43:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="mn5OaB9j"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="svGWzVt6" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9A57814BFA8 for ; Mon, 10 Jun 2024 16:43:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718037784; cv=none; b=cosgcgF1+mkohjdlW4X22rivZh88JUcCB894+QZcgFYyOAHh2fgCdqBYBU7Rzk/xYaHCD+ayABxiklYn4GVuCXTvi9YKVarR2mETsX8mc10P7xCkSHmqshQYXUqrbeKVw25tbJiENVspnr4gJ5ySq0Pf8EKhfUvPnNq1GqgnL/c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718037784; c=relaxed/simple; bh=H8C4ae3qB9pJTAhYrEUW6UIkzelbDNrIyM/SxoxcYVc=; h=Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type:Date; b=SUUQrcJSFG20K7+dcUwS9dG6+l+6X4QCVgRL6C6L4hdKIcwgrbh4gbhQNh6xqxsbcJPIdDvo1P8dILq/IHs2VJ5AaYSqzv0YSs/2nwKo+6XVeTwtrnYWd4wtiYIuvVXiV5mwHM1oD3+qyPqEKv2iREs1Hr2YKuXpUQtOrNvzVFs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=mn5OaB9j; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=svGWzVt6; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Message-ID: <20240610164028.229525528@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1718037779; 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=gS0GunzjJF0mIhSZ9sJXDkEdhMOznUExWpmLyjVDd8s=; b=mn5OaB9jNhYxLm1Au5SbSFz5ZyINHHxzpUiGgwO6OdfcH8IBQdAppwEsFgcrBMEFKyT/mA RQ2v6owkyy7aLKZ67oiGDZFaND2/itsh3f0LhYNSY8uPRlYwKev9EzjLya3QujgG4htD2H 35yWiEDazTU1GLHYgfjhIbYRFEDtxlV5LPIC43j41gYhahKFtF28lK8L2hLU/TyrcRBFEo iSFUfiyM+syMKuqRztx1chIZcfJ5TT7axJPz4lsq1qeVKkmLJctuLxmi7JMgFxmnUihu5j O0027ooHX7eLjssrt0zIz6zKhQBLVBg48aNu2wcxSZUHl3fd7WsUtOyiEaGyfQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1718037779; 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=gS0GunzjJF0mIhSZ9sJXDkEdhMOznUExWpmLyjVDd8s=; b=svGWzVt61HHvsJX/ltwLCdXT7FAwt0UwNpn1mdG/sMyZr8bl9UxXIOCSDZ/K/p8dRvtGUT HMEsNKZwJr9afNBA== From: Thomas Gleixner To: LKML Cc: Anna-Maria Behnsen , Frederic Weisbecker , John Stultz , Peter Zijlstra , Ingo Molnar , Stephen Boyd , Eric Biederman , Oleg Nesterov Subject: [patch V3 44/51] signal: Add task argument to flush_sigqueue_mask() References: <20240610163452.591699700@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Date: Mon, 10 Jun 2024 18:42:59 +0200 (CEST) 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 @@ -724,11 +724,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; @@ -866,18 +865,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; @@ -4155,8 +4154,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); @@ -4223,9 +4222,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); } }