From nobody Sat Feb 7 21:53:13 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 93A152F90C4 for ; Tue, 3 Feb 2026 21:59:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770155981; cv=none; b=KEQ57lyFT3eHkFvQrrRxvjQhPwnKn1+seJTQ8K9j4KgILLYOL0xlwFlFlI11L5P7T87/3z2dxe/qiCAh00ZWjHEPlHlrDgbuW8PZceAxB3kfR26fvo4VW6omZevRuuySiH5GoHc26berGg87o5iySbkO232QZnB9l4K/g1Q/h/I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770155981; c=relaxed/simple; bh=GypFtYupZ5G7BuF4gr13VL9kuS6AqMIS0d30hQEBXP4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gU8T2pY/vmpmUSXD1p87KsWqwXcXSilNSezgZ5rf3e6BHt0P1sEmGF9LVH1LUx2R2NnmvlCf8ALknpbVoBx1CjNU86xD2c8BCe++tKZkTt4NvHl46RpE+a9srOu23Bjcj2vlXVteOjPRvIp0M7ffbPXoKWZXUgBngVBtOxFTwnc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Ns1MfKDz; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Ns1MfKDz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E1BDC2BC87; Tue, 3 Feb 2026 21:59:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1770155981; bh=GypFtYupZ5G7BuF4gr13VL9kuS6AqMIS0d30hQEBXP4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ns1MfKDzaS+hcGcldb7KZAuMRri81/z45DXYqS0S/hsT+oASjoisjRqcsIwbk60C6 ZhMv1tR3sxWCzI9uyiOrrBmvYvzUu1bkq1wYoYkDh2jx2P9xw0vUvwZNhg7wztddQS kUY59ZMXZ2Gw7+gSur225bD5VhvSNwz021001zEZpzb0C4LQMKnGeJ1dinWquZjyCU 1/ZsfjwgL1ascHYdwWf+N46Ck0hMMIvHTjtiNaqMZwY2+W+xG/BixKMqcWLkMKVXjY LRTo8P7fSdhDXxIN5xv5zQYMX2Na7GAZ/NmowPNHivyUex17ocjmwKyrZ9FVSm2BB3 y8Upf7M7iIICg== From: Josh Poimboeuf To: Steven Rostedt Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Julia Lawall Subject: [PATCH 1/2] unwind: Fix negative bit check in unwind_deferred_request() Date: Tue, 3 Feb 2026 13:59:32 -0800 Message-ID: X-Mailer: git-send-email 2.52.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The following warning will never trigger because 'bit' is unsigned: if (WARN_ON_ONCE(bit < 0)) return -EINVAL; That variable is used for two distinct purposes, so split it into two variables accordingly: an 'int bit' and an 'unsigned long bit_mask'. Rename a few other variables for consistency with the "*_mask" scheme. Fixes: 357eda2d7450 ("unwind deferred: Use SRCU unwind_deferred_task_work()= ") Reported-by: Julia Lawall Signed-off-by: Josh Poimboeuf --- kernel/unwind/deferred.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/kernel/unwind/deferred.c b/kernel/unwind/deferred.c index a88fb481c4a3..416af9b98bad 100644 --- a/kernel/unwind/deferred.c +++ b/kernel/unwind/deferred.c @@ -230,10 +230,9 @@ void unwind_deferred_task_exit(struct task_struct *tas= k) int unwind_deferred_request(struct unwind_work *work, u64 *cookie) { struct unwind_task_info *info =3D ¤t->unwind_info; + unsigned long bit_mask, old_mask, new_mask; int twa_mode =3D TWA_RESUME; - unsigned long old, bits; - unsigned long bit; - int ret; + int bit, ret; =20 *cookie =3D 0; =20 @@ -257,17 +256,16 @@ int unwind_deferred_request(struct unwind_work *work,= u64 *cookie) if (WARN_ON_ONCE(bit < 0)) return -EINVAL; =20 - /* Only need the mask now */ - bit =3D BIT(bit); + bit_mask =3D BIT(bit); =20 guard(irqsave)(); =20 *cookie =3D get_cookie(info); =20 - old =3D atomic_long_read(&info->unwind_mask); + old_mask =3D atomic_long_read(&info->unwind_mask); =20 /* Is this already queued or executed */ - if (old & bit) + if (old_mask & bit_mask) return 1; =20 /* @@ -276,15 +274,15 @@ int unwind_deferred_request(struct unwind_work *work,= u64 *cookie) * work's bit or PENDING was already set, then this is already queued * to have a callback. */ - bits =3D UNWIND_PENDING | bit; - old =3D atomic_long_fetch_or(bits, &info->unwind_mask); - if (old & bits) { + new_mask =3D UNWIND_PENDING | bit_mask; + old_mask =3D atomic_long_fetch_or(new_mask, &info->unwind_mask); + if (old_mask & new_mask) { /* * If the work's bit was set, whatever set it had better * have also set pending and queued a callback. */ - WARN_ON_ONCE(!(old & UNWIND_PENDING)); - return old & bit; + WARN_ON_ONCE(!(old_mask & UNWIND_PENDING)); + return old_mask & bit_mask; } =20 /* The work has been claimed, now schedule it. */ --=20 2.52.0 From nobody Sat Feb 7 21:53:13 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 E245A2FD1CA for ; Tue, 3 Feb 2026 21:59:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770155982; cv=none; b=QACkTEXnb0PfyYbVPvusqgPB7DHh/FK+q6dMcVCHYdT8mCprMLtfEFxkQ36PVyErn+Nf0fQAicLKxMD/D/lObYtwSTs5DXhdQIZm14vLkPHZiH4DmpHMls8jdGMeU/+S5xd9UMooUVYGdIqHV99GmnjCRT8xe7Ra6W8buWuIPWw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770155982; c=relaxed/simple; bh=l3lv70WuHdd5JyfupJcNBHPFun7DR3XERVrXmaUS9K4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YgmXoU0/9zlJIMcTLX+yk+vvVLot7b3z9wQPi+vuybqvvh7noGE8ejXOjwup77HZNvjGciTrEQcWQp61u/Fk+jKaASvvP89H9bb56VmwBD+FEoUhkzYnRL+R3E5aiE4nKVkXAGXlge6kobGz/qPyUhdkY3ujwTR2azY1/4/gE2c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jwhm2+dg; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jwhm2+dg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A9B3C19425; Tue, 3 Feb 2026 21:59:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1770155981; bh=l3lv70WuHdd5JyfupJcNBHPFun7DR3XERVrXmaUS9K4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jwhm2+dguK84Z490HBA8W5Kdygf8hULbUbE+8TMOuYbHD4AtW5gNDCT+sfWcMGW75 eWJAQYBBwtLWy+mUjCbJ1rDo+xQvdWKDWfdnEQ5JKP0FI6WwmZksVlwI7bWX7V8PaR UK/jHgPBaxgqOXMMNZEdj+Di+W+xaF+FkDeU3dyqyxLmi6d6c9SdZz6Ae++4NdCFz4 noUQbJ+ZuEecRd+4zz4ZCgyEn07JvO2/WACdxy1BmrUgUTCl+D3rdDJbLz0wS/Qv/o zc5r5iBbWlOEF8nt2hvYaMM+aOX1TEFyiWAK7Yzc+zoCV5zt2NOuNsl17NUSjJ5D1h L44qAtN9us5zw== From: Josh Poimboeuf To: Steven Rostedt Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Julia Lawall Subject: [PATCH 2/2] unwind: Fix return value for already-queued case in unwind_deferred_request() Date: Tue, 3 Feb 2026 13:59:33 -0800 Message-ID: X-Mailer: git-send-email 2.52.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The unwind_deferred_request() return value is documented in the function header: * Return: 0 if the callback successfully was queued. * 1 if the callback is pending or was already executed. * Negative if there's an error. However, when the callback is already queued, it may return a non-1 value. Fix it to match the documented behavior. Fixes: be3d526a5b34 ("unwind deferred: Use bitmask to determine which callb= acks to call") Signed-off-by: Josh Poimboeuf --- kernel/unwind/deferred.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/unwind/deferred.c b/kernel/unwind/deferred.c index 416af9b98bad..edf39c61130a 100644 --- a/kernel/unwind/deferred.c +++ b/kernel/unwind/deferred.c @@ -282,7 +282,7 @@ int unwind_deferred_request(struct unwind_work *work, u= 64 *cookie) * have also set pending and queued a callback. */ WARN_ON_ONCE(!(old_mask & UNWIND_PENDING)); - return old_mask & bit_mask; + return !!(old_mask & bit_mask); } =20 /* The work has been claimed, now schedule it. */ --=20 2.52.0