From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=192.198.163.19 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795864045; b=v7Jyn9/vj+35l73xD8E578fzipu3SjGrTUK1wyi3lZCwp2tKwSdCSNp+t7ET320wF9EG ChqR/y+QOo4rm2R6uR7E6QHPllAflBpHBAfMkfy1yBT9snlzGlUt4glhz33m16/hIQHfu DjWZ0tZ/Rb5ZST2ArDtWYEhrdIyepHBAATN4hff6FupRJe4Q0aDcD+1RcGfWUCK1y2O1N ITDDIiNyV8NdKBwK9m0zf0g3Z6ohklSXAmPdpUqWithbeaLoxPcRJcg/It6ffEnCmENdC xCLEBPAgcCrQWDHXvscCETS/e4mnDB1bV+cU8lDBdCLMvZqvC6JFTRsCjv4mb11i3/A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795864045; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:Received:Date:From:To: Cc:Subject:Message-ID:User-Agent; bh=Me9Rm2E0dY1vsZpGIYrc6ZHsranlN5hNwEYuls03yFs=; b=tR75hl7JRLCfGrnDpT4vbuZYgRkZTYyZTJWUgRTgxaYVOy5pG4cn9TKDqW118gcr6oMl dJQp+WGnxPdrhaeAwMW01YmztzRcwhV25ovqJSPMLQ3CfUsJplXhP5yDFMyajdN9X8cR+ u3IDpNE3Rym0/hy1hpsOw7Q/6B/+NMLOd+cswrp2sqgckdMkpOjR1dKwbj+d5yyoSAwVw di9Mx/p5uyHBBP1HD9K6vXMIUD8k5XQD9GTVd0h+MLxZDzPPoCfNv1yb2JymNaBud75RZ SQqCFVPAYHQikENPpC5c15KrKYdoAqAIaSJQdRc2XKa31VFi4xK3Zrk3Vj1bYpQvtWA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=ZgZQ60Gz; arc=none smtp.remote-ip=192.198.163.19 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 96FDE606A31C for ; Sat, 28 Nov 2026 11:07:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 96FDE606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=ZgZQ60Gz DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1795864044; x=1827400044; h=date:from:to:cc:subject:message-id; bh=LfjdnBxzrr8a17nEt0S7ykthaOFC0kGlpxmMvxuCZRg=; b=ZgZQ60Gzk9BTtGaR9W3pjcF4PevA0knOCUNjiurjTpLMVAb0lIJbk5d1 3kwX2MTqXglkbM/CH6tJTfw/In7aujbMI3Fd0fDVo9DZYugGFObYj2Lx7 JHg2Au0CwQ721gNNZWbdQChSC6aTg7wJuOr/Hy7OK2XseXj9HbD4VjHNe IeqcGFOkuzTkzBvBCltxEcFleLz4Q5+pboGg5pJOaDMvXN1qkM5P+iX6S oPUyjiYEh7sTu8EJWAoWldTLG4Tln2ker+2GowBpBvqILaYusFunW+tJb wwMLq6VBjbxa7rNpQbL9aT655TPfdC+1fBK/lr2AmQjPTYdqQluaJXmDy A==; X-CSE-ConnectionGUID: f4underhTIC9NRB8OV53eA== X-CSE-MsgGUID: v+ePA8/RQlyLsxrGNqyavQ== X-IronPort-AV: E=McAfee;i="6800,10657,11979"; a="4771558" X-IronPort-AV: E=Sophos;i="6.27,238,1787036400"; d="scan'208";a="4771558" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Nov 2026 03:07:23 -0800 X-CSE-ConnectionGUID: 8xJeMTyaR4CwPEPB+uyS6Q== X-CSE-MsgGUID: vXpyVAFPTNy6qyJKHGWP7g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,238,1787036400"; d="scan'208";a="12416825" Received: from igk-lkp-server01.igk.intel.com (HELO 146cf1e082f1) ([10.211.93.152]) by orviesa004.jf.intel.com with ESMTP; 28 Nov 2026 03:07:22 -0800 Received: from kbuild by 146cf1e082f1 with local (Exim 4.98.2) (envelope-from ) id 1xXGH1-000000000ZS-0SqI; Sat, 28 Nov 2026 11:07:19 +0000 Date: Sat, 28 Nov 2026 12:06:46 +0100 From: kernel test robot To: oe-kbuild@lists.linux.dev Cc: lkp@intel.com, Julia Lawall Subject: kernel/unwind/deferred.c:257:18-21: WARNING: Unsigned expression compared with zero: bit < 0 Message-ID: <20261128120447.6kdULadA-lkp@intel.com> User-Agent: s-nail v14.9.25 X-Mailing-List: oe-kbuild@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list BCC: lkp@intel.com CC: oe-kbuild-all@lists.linux.dev CC: linux-kernel@vger.kernel.org TO: Josh Poimboeuf CC: Peter Zijlstra CC: "Steven Rostedt (Google)" Hi Josh, First bad commit (maybe != root cause): tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 7cd8495c0f16275c4f9abe1cef09a7b5fcd6d046 commit: 49cf34c0815f93fb2ea3ab5cfbac1124bd9b45d0 unwind_user/x86: Enable frame pointer unwinding on x86 date: 1 year, 1 month ago :::::: branch date: 8 hours ago :::::: commit date: 1 year, 1 month ago config: x86_64-randconfig-2100-20261128 (https://download.01.org/0day-ci/archive/20261128/20261128120447.6kdULadA-lkp@intel.com/config) compiler: gcc-12 (Debian 12.4.0-5) 12.4.0 If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Fixes: 49cf34c0815f ("unwind_user/x86: Enable frame pointer unwinding on x86") | Reported-by: kernel test robot | Reported-by: Julia Lawall | Closes: https://lore.kernel.org/r/20261128120447.6kdULadA-lkp@intel.com/ cocci warnings: (new ones prefixed by >>) >> kernel/unwind/deferred.c:257:18-21: WARNING: Unsigned expression compared with zero: bit < 0 vim +257 kernel/unwind/deferred.c b3b9cb11aa034c Steven Rostedt 2025-07-29 204 2dffa355f6c279 Josh Poimboeuf 2025-07-29 205 /** 2dffa355f6c279 Josh Poimboeuf 2025-07-29 206 * unwind_deferred_request - Request a user stacktrace on task kernel exit 2dffa355f6c279 Josh Poimboeuf 2025-07-29 207 * @work: Unwind descriptor requesting the trace 2dffa355f6c279 Josh Poimboeuf 2025-07-29 208 * @cookie: The cookie of the first request made for this task 2dffa355f6c279 Josh Poimboeuf 2025-07-29 209 * 2dffa355f6c279 Josh Poimboeuf 2025-07-29 210 * Schedule a user space unwind to be done in task work before exiting the 2dffa355f6c279 Josh Poimboeuf 2025-07-29 211 * kernel. 2dffa355f6c279 Josh Poimboeuf 2025-07-29 212 * 2dffa355f6c279 Josh Poimboeuf 2025-07-29 213 * The returned @cookie output is the generated cookie of the very first 2dffa355f6c279 Josh Poimboeuf 2025-07-29 214 * request for a user space stacktrace for this task since it entered the 2dffa355f6c279 Josh Poimboeuf 2025-07-29 215 * kernel. It can be from a request by any caller of this infrastructure. 2dffa355f6c279 Josh Poimboeuf 2025-07-29 216 * Its value will also be passed to the callback function. It can be 2dffa355f6c279 Josh Poimboeuf 2025-07-29 217 * used to stitch kernel and user stack traces together in post-processing. 2dffa355f6c279 Josh Poimboeuf 2025-07-29 218 * 2dffa355f6c279 Josh Poimboeuf 2025-07-29 219 * It's valid to call this function multiple times for the same @work within 2dffa355f6c279 Josh Poimboeuf 2025-07-29 220 * the same task entry context. Each call will return the same cookie 2dffa355f6c279 Josh Poimboeuf 2025-07-29 221 * while the task hasn't left the kernel. If the callback is not pending 2dffa355f6c279 Josh Poimboeuf 2025-07-29 222 * because it has already been previously called for the same entry context, 2dffa355f6c279 Josh Poimboeuf 2025-07-29 223 * it will be called again with the same stack trace and cookie. 2dffa355f6c279 Josh Poimboeuf 2025-07-29 224 * be3d526a5b3410 Steven Rostedt 2025-07-29 225 * Return: 0 if the callback successfully was queued. be3d526a5b3410 Steven Rostedt 2025-07-29 226 * 1 if the callback is pending or was already executed. 2dffa355f6c279 Josh Poimboeuf 2025-07-29 227 * Negative if there's an error. 2dffa355f6c279 Josh Poimboeuf 2025-07-29 228 * @cookie holds the cookie of the first request by any user 2dffa355f6c279 Josh Poimboeuf 2025-07-29 229 */ 2dffa355f6c279 Josh Poimboeuf 2025-07-29 230 int unwind_deferred_request(struct unwind_work *work, u64 *cookie) 2dffa355f6c279 Josh Poimboeuf 2025-07-29 231 { 2dffa355f6c279 Josh Poimboeuf 2025-07-29 232 struct unwind_task_info *info = ¤t->unwind_info; a38a64712e740d Peter Zijlstra 2025-09-22 233 int twa_mode = TWA_RESUME; be3d526a5b3410 Steven Rostedt 2025-07-29 234 unsigned long old, bits; 357eda2d745054 Steven Rostedt 2025-07-29 235 unsigned long bit; 2dffa355f6c279 Josh Poimboeuf 2025-07-29 236 int ret; 2dffa355f6c279 Josh Poimboeuf 2025-07-29 237 2dffa355f6c279 Josh Poimboeuf 2025-07-29 238 *cookie = 0; 2dffa355f6c279 Josh Poimboeuf 2025-07-29 239 2dffa355f6c279 Josh Poimboeuf 2025-07-29 240 if ((current->flags & (PF_KTHREAD | PF_EXITING)) || 2dffa355f6c279 Josh Poimboeuf 2025-07-29 241 !user_mode(task_pt_regs(current))) 2dffa355f6c279 Josh Poimboeuf 2025-07-29 242 return -EINVAL; 2dffa355f6c279 Josh Poimboeuf 2025-07-29 243 055c7060e7ca71 Steven Rostedt 2025-07-29 244 /* 055c7060e7ca71 Steven Rostedt 2025-07-29 245 * NMI requires having safe cmpxchg operations. 055c7060e7ca71 Steven Rostedt 2025-07-29 246 * Trigger a warning to make it obvious that an architecture 055c7060e7ca71 Steven Rostedt 2025-07-29 247 * is using this in NMI when it should not be. 055c7060e7ca71 Steven Rostedt 2025-07-29 248 */ a38a64712e740d Peter Zijlstra 2025-09-22 249 if (in_nmi()) { a38a64712e740d Peter Zijlstra 2025-09-22 250 if (WARN_ON_ONCE(!CAN_USE_IN_NMI)) 055c7060e7ca71 Steven Rostedt 2025-07-29 251 return -EINVAL; a38a64712e740d Peter Zijlstra 2025-09-22 252 twa_mode = TWA_NMI_CURRENT; a38a64712e740d Peter Zijlstra 2025-09-22 253 } 055c7060e7ca71 Steven Rostedt 2025-07-29 254 357eda2d745054 Steven Rostedt 2025-07-29 255 /* Do not allow cancelled works to request again */ 357eda2d745054 Steven Rostedt 2025-07-29 256 bit = READ_ONCE(work->bit); 357eda2d745054 Steven Rostedt 2025-07-29 @257 if (WARN_ON_ONCE(bit < 0)) 357eda2d745054 Steven Rostedt 2025-07-29 258 return -EINVAL; 357eda2d745054 Steven Rostedt 2025-07-29 259 357eda2d745054 Steven Rostedt 2025-07-29 260 /* Only need the mask now */ 357eda2d745054 Steven Rostedt 2025-07-29 261 bit = BIT(bit); 357eda2d745054 Steven Rostedt 2025-07-29 262 2dffa355f6c279 Josh Poimboeuf 2025-07-29 263 guard(irqsave)(); 2dffa355f6c279 Josh Poimboeuf 2025-07-29 264 2dffa355f6c279 Josh Poimboeuf 2025-07-29 265 *cookie = get_cookie(info); 2dffa355f6c279 Josh Poimboeuf 2025-07-29 266 639214f65b1db8 Peter Zijlstra 2025-09-22 267 old = atomic_long_read(&info->unwind_mask); 055c7060e7ca71 Steven Rostedt 2025-07-29 268 be3d526a5b3410 Steven Rostedt 2025-07-29 269 /* Is this already queued or executed */ be3d526a5b3410 Steven Rostedt 2025-07-29 270 if (old & bit) 2dffa355f6c279 Josh Poimboeuf 2025-07-29 271 return 1; 2dffa355f6c279 Josh Poimboeuf 2025-07-29 272 be3d526a5b3410 Steven Rostedt 2025-07-29 273 /* be3d526a5b3410 Steven Rostedt 2025-07-29 274 * This work's bit hasn't been set yet. Now set it with the PENDING be3d526a5b3410 Steven Rostedt 2025-07-29 275 * bit and fetch the current value of unwind_mask. If ether the be3d526a5b3410 Steven Rostedt 2025-07-29 276 * work's bit or PENDING was already set, then this is already queued be3d526a5b3410 Steven Rostedt 2025-07-29 277 * to have a callback. be3d526a5b3410 Steven Rostedt 2025-07-29 278 */ be3d526a5b3410 Steven Rostedt 2025-07-29 279 bits = UNWIND_PENDING | bit; 639214f65b1db8 Peter Zijlstra 2025-09-22 280 old = atomic_long_fetch_or(bits, &info->unwind_mask); be3d526a5b3410 Steven Rostedt 2025-07-29 281 if (old & bits) { be3d526a5b3410 Steven Rostedt 2025-07-29 282 /* be3d526a5b3410 Steven Rostedt 2025-07-29 283 * If the work's bit was set, whatever set it had better be3d526a5b3410 Steven Rostedt 2025-07-29 284 * have also set pending and queued a callback. be3d526a5b3410 Steven Rostedt 2025-07-29 285 */ be3d526a5b3410 Steven Rostedt 2025-07-29 286 WARN_ON_ONCE(!(old & UNWIND_PENDING)); be3d526a5b3410 Steven Rostedt 2025-07-29 287 return old & bit; be3d526a5b3410 Steven Rostedt 2025-07-29 288 } be3d526a5b3410 Steven Rostedt 2025-07-29 289 2dffa355f6c279 Josh Poimboeuf 2025-07-29 290 /* The work has been claimed, now schedule it. */ a38a64712e740d Peter Zijlstra 2025-09-22 291 ret = task_work_add(current, &info->work, twa_mode); 2dffa355f6c279 Josh Poimboeuf 2025-07-29 292 be3d526a5b3410 Steven Rostedt 2025-07-29 293 if (WARN_ON_ONCE(ret)) 639214f65b1db8 Peter Zijlstra 2025-09-22 294 atomic_long_set(&info->unwind_mask, 0); be3d526a5b3410 Steven Rostedt 2025-07-29 295 be3d526a5b3410 Steven Rostedt 2025-07-29 296 return ret; 2dffa355f6c279 Josh Poimboeuf 2025-07-29 297 } 2dffa355f6c279 Josh Poimboeuf 2025-07-29 298 :::::: The code at line 257 was first introduced by commit :::::: 357eda2d745054eb737397368bc9b0f84814b0a5 unwind deferred: Use SRCU unwind_deferred_task_work() :::::: TO: Steven Rostedt :::::: CC: Steven Rostedt (Google) -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki