Received: by 2002:ab2:1347:0:b0:1f4:ac9d:b246 with SMTP id g7csp67360lqg; Wed, 10 Apr 2024 15:55:52 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWF5924uj4DKYcKjZFMUgav98H7s1PMyiEkBExYhNUVRdYrS2/4/1AS+Q50Rb8UTNYP7yGZM8UCrWnvps2kN3F3p8vRVElwAHk0rkKIgw== X-Google-Smtp-Source: AGHT+IGkQCXXG5DS6fC7cXqHPv8dllPqgYnGRuuXuMbidFzkooya0NxT/QPppxgR3QWm/ckoyKlO X-Received: by 2002:a50:ab5d:0:b0:56d:f488:cb0e with SMTP id t29-20020a50ab5d000000b0056df488cb0emr2540319edc.38.1712789752677; Wed, 10 Apr 2024 15:55:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712789752; cv=pass; d=google.com; s=arc-20160816; b=ieYT5RS+M16pi/b5MassRKlr40l2QPCCJ8TgIxMfxbu6sbHXEpH/q0pbCQzRmTst49 ZERmfDpA9B7I1XL7nCdzY6214cS/bjGpbhZ2VJRE5+8D8GVV/rYMxcRRcMqhJ6NwkDas 1CuYIJizNtUj6WmoO3ONT6EC6+DQMZfgphTNgkotgH7+RJLAlfIzHC5Rt4+KS4bRVm9h hKn9ejaDIFWz5LXPzxnWyBCcOSNVAYawGgcueQsFW2mrozkVlsIF9lNVPEDOsE7XlQnh xGga3zxCyU7PlZUB+Rk2MssrtCXFwXMChpY/tEr9G2XkjLdh9MK2TpR13RILsBhqUqpz Ps4A== 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=Sp6dC5HdS08E3ufwHMrcD2eYvO0LXDGgEyKCZM9dVTwUbv6ThQZmTaufBm/k3QAVrL RsKuqbzZhEr5jBPSBzT50QyBfobO8uwa/Q5d9+fyAOqGywdt+6F6mJKIStK23Goi4Uth 2oYpKEidnxGEygbuug5Ex64Z6fzVSzW+E08wDpZncl4xQTrp0LX9exHhHICtITVChqgS GGzavR6U/bEaloKJM7AO3fSn2hFnLhDFvT4SthRBBiCIl0YhUGckh62SW/2NU0f9cH3z PcCCZv6DsJ2uKZwWzrXDNauYbQtqJjHeGVMwXIotpZntK2Jbu3qhtd2WH6PSj6TNDv0G HtFQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=SIHbGenp; 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-139496-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139496-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id s11-20020a50d48b000000b0056e51f70b3csi102873edi.204.2024.04.10.15.55.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 15:55:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-139496-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=SIHbGenp; 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-139496-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139496-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 2F42C1F29330 for ; Wed, 10 Apr 2024 22:55:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 535101350D2; Wed, 10 Apr 2024 22:47:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="SIHbGenp"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="lUXOrPoD" 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 E850A13248B for ; Wed, 10 Apr 2024 22:47:29 +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=1712789251; cv=none; b=BFZkKHGkgG48gpNev/rwJTF3/L4jymuaKNPtGxiRjpuR1bRahcUejMqMbb0BMnIPag7ybpFGSk6FVjQeujlanOpcNq1OGCuLI2YteJU4UnSo3S+PBc5sZP1zYgdRyBZVgqfp1YNbKbo4QOeDlMdqHqWtwwPFrLEDegoNKJUGCJI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712789251; c=relaxed/simple; bh=H8C4ae3qB9pJTAhYrEUW6UIkzelbDNrIyM/SxoxcYVc=; h=Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type:Date; b=Ms2m+6btisAVZ5j2KUp1HijTjKVJRMdBV0SvHIu4mIl4K8YZo9vyxvJ/SJSJXfKilz79NcP7kVAy2e+98N0ukcCYTQBfB1lpcO1SjVl6KTnHjmmQYBJSkWqBsqNRmghYTSsaUU1B+dpBjrAie7F4lf5lbhNbgvZwPQ9gIUHcO2U= 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=SIHbGenp; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=lUXOrPoD; 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: <20240410165553.636753630@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1712789248; 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=SIHbGenp76SOLVBs2dAVyy4fAMu+LZLTM/FfoCydWnvcOyeVcs0e2Ctnjy6Y3/oIYFsoHp mrVNV4oTcW8ky86GK0kmy7K3qFC9zlG46RxpYdZW8NlJGpp0ubRHiocrJXiC3Xn/y+gcFA OcBNNZhUfevnKD2S33f0OhFo3NQGgy7gRXVQJ+PF9CoTGszsQNp6eycRPcHTLDWik39P4g NRJoEPEguuLlfD5qgVkRTnhfqcUjJpyVvJ6RM/DOET2BEyFBEzBqOdvhP0oeEbF5ZqiOl8 eIalQiEhI3gvxVJspxs4rq+Vl9lEiJ77YGLjK+wpv98S5Hdnnzai8XsoCwcY7A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1712789248; 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=lUXOrPoD+iJthx03iSV1MRAA+nF/RxjZnoJ9yWD7k+5odTGsMjLbHg9bA3O3ehohvd+mkR 38HzHIdZlHcR+uDQ== 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 V2 43/50] signal: Add task argument to flush_sigqueue_mask() References: <20240410164558.316665885@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: Thu, 11 Apr 2024 00:47:27 +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); } }