From nobody Tue Nov 26 04:05:18 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Xy89p489dz5dmTW; Tue, 26 Nov 2024 04:05:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Xy89p3MV8z4DBY; Tue, 26 Nov 2024 04:05:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732593918; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Jx6FmPqlFRUAXWjR6HMjHaSKXAhfhnNge3w29+MaYVc=; b=jMpIgR4k78NxPG61EeqFyjXQm44nFNmIniOt+jvOVE02Kq2DYOWBPJbEAVRU3MDnlNHWwf +uuKMk1rcMEjHEN56G+HNvxLNy7JDmq8PZpGvgV07f+mRu6BGiiHfBB+q3Q9E4M+dGBB1V QyaLl5ocYrFgjTj3zwap6h5bKfBlWvaTEMT8rfuz5BC4Z7kTTYdnhQF7ixAA2w55GdAgcY IjVcaV0cpoFpDh/Jq5+2d1xA0iEaGhMrCe6MISbBz4ek0qyoCcQ7IRH7KBjNmqzALdFTRs yr1D/lbqiLIgC1YeS1BPwaSbyfLZgkBioWgGBRqe2g7jcdk55pLuaOTXssBxHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732593918; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Jx6FmPqlFRUAXWjR6HMjHaSKXAhfhnNge3w29+MaYVc=; b=Dj72a+ke50q/Y03E1H0o+9hJxNofUHXDoPy9I3ZtuGYhov7zDcDFf2158OwCbysei3W2va hd1jA5QzMzhYmNDIJ+gv8EKO4QZoOSUW8BDczZuPNKtCA4HPAY/Day4SL2ao4BjpZaAThc b7a5RbY4djiVVVrOIKgn0LniQv9vvCnGTpQFjxXwdkJUzMsxX1p/OziASvOp+S5AqVQLid A2MrPR2s25ijyBSi2hTsZvfsD5SXFuNj39MuKMADLuzummAu9c3QG9Kouwhx1euxk6AxIv NlfytSt6PXmPvx1V6vxU2aYqKBQfIwBwUSEhXG5GUwOc8ds/PRbG9b9z6hPTYg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1732593918; a=rsa-sha256; cv=none; b=mSNblAE0xWYfNBV/OYtFHtBvLzeaWYJXF0bq1PndDDhYj1PcquaKTzgqylBJ6qHcchwf92 gSpAph/ofink4OKZM0hDQOEaMbAS+eZvaR6p57JFmy37ADyzC8pzTexv1d5kI9SedD8uHh 5n+OBwnu9YJMZcdyt1XJrb/0hzt1RCXG4XZwKEjoQ6Q9ahFl0jGv48jO0Pkm7W2fjoyAKB sgBXd5XcHsXFxeXqeJGcbB4yuNelXhPG0qHl/vc/W5uJaTjMjCJCIeXtP3Z0hb/CmQRXjx sk6qPEw8VC8hOU0VPGnzEbg3nOuNroGgv6zYaClLgmGzpnXgOWGj17q+LaMIJQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Xy89p2dx7z18PV; Tue, 26 Nov 2024 04:05:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4AQ45I9G093826; Tue, 26 Nov 2024 04:05:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4AQ45I4O093823; Tue, 26 Nov 2024 04:05:18 GMT (envelope-from git) Date: Tue, 26 Nov 2024 04:05:18 GMT Message-Id: <202411260405.4AQ45I4O093823@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: cab31f5633c1 - main - kern: add a TDA_PSELECT for early restoration of sigmask List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cab31f5633c1ffdd8b24749a3c9dd22c59568503 Auto-Submitted: auto-generated The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=cab31f5633c1ffdd8b24749a3c9dd22c59568503 commit cab31f5633c1ffdd8b24749a3c9dd22c59568503 Author: Kyle Evans AuthorDate: 2024-11-26 04:04:48 +0000 Commit: Kyle Evans CommitDate: 2024-11-26 04:04:48 +0000 kern: add a TDA_PSELECT for early restoration of sigmask It may be the case that we want to avoid delivering signals that are normally blocked by the thread's signal mask, in which case the syscall should schedule this one instead to restore the mask prior to delivery. This will be used by pselect/ppoll to avoid delivering signals that were supposed to be blocked after the timeout has elapsed. The name was chosen as this is the expected behavior of pselect/ppoll, while late restoration of the mask is exceptional behavior for these specific calls. __FreeBSD_version bump as later TDA_* values have changed, third-party modules that may be using MOD3/MOD4 need to be rebuilt. Reviewed by: kib Sponsored by: Klara, Inc. Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D47741 --- sys/kern/kern_sig.c | 10 ++++++++++ sys/sys/param.h | 2 +- sys/sys/proc.h | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index cded24450ca1..96dc5e356ae9 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -365,6 +365,16 @@ sigqueue_start(void) SIGFILLSET(fastblock_mask); SIG_CANTMASK(fastblock_mask); ast_register(TDA_SIG, ASTR_UNCOND, 0, ast_sig); + + /* + * TDA_PSELECT is for the case where the signal mask should be restored + * before delivering any signals so that we do not deliver any that are + * blocked by the normal thread mask. It is mutually exclusive with + * TDA_SIGSUSPEND, which should be used if we *do* want to deliver + * signals that are normally blocked, e.g., if it interrupted our sleep. + */ + ast_register(TDA_PSELECT, ASTR_ASTF_REQUIRED | ASTR_TDP, + TDP_OLDMASK, ast_sigsuspend); ast_register(TDA_SIGSUSPEND, ASTR_ASTF_REQUIRED | ASTR_TDP, TDP_OLDMASK, ast_sigsuspend); } diff --git a/sys/sys/param.h b/sys/sys/param.h index 79ecd58569a3..550ea1fc61f6 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -73,7 +73,7 @@ * cannot include sys/param.h and should only be updated here. */ #undef __FreeBSD_version -#define __FreeBSD_version 1500027 +#define __FreeBSD_version 1500028 /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, diff --git a/sys/sys/proc.h b/sys/sys/proc.h index c5ef4f849eab..3422f75172f0 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -494,6 +494,7 @@ enum { TDA_RACCT, TDA_MOD1, /* For third party use, before signals are */ TAD_MOD2, /* processed .. */ + TDA_PSELECT, /* For discarding temporary signal mask */ TDA_SIG, TDA_KTRACE, TDA_SUSPEND,