From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: [rcu:dev 54/57] kernel/rcu/rcutorture.c:4683 rcu_test_kasan() error: dereferencing freed memory 'rhp' (line 4681)
Date: Thu, 03 Dec 2026 07:19:47 +0100 [thread overview]
Message-ID: <20261203071009.B1Ru5CSM-lkp@intel.com> (raw)
Unfiltered warning: this smatch report is sent as-is and has not been
reviewed for false positives, so please treat it with due skepticism.
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Kunwu Chan <kunwu.chan@gmail.com>
CC: Joel Fernandes <jfern@kernel.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/rcu/linux.git dev
head: 7c5d6e978b03d7d1e028adfbfed3ea41823a172e
commit: 1c9be559fe2063016a8537eed09f3869f6e1a3b1 [54/57] rcutorture: Add KASAN aux-stack self-test
:::::: branch date: 13 hours ago
:::::: commit date: 13 hours ago
config: x86_64-randconfig-2200-20261203 (https://download.01.org/0day-ci/archive/20261203/20261203071009.B1Ru5CSM-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
smatch: v0.5.0-9187-g5189e3fb
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
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/20261203071009.B1Ru5CSM-lkp@intel.com/
smatch warnings:
kernel/rcu/rcutorture.c:4683 rcu_test_kasan() error: dereferencing freed memory 'rhp' (line 4681)
vim +/rhp +4683 kernel/rcu/rcutorture.c
d2818df168b2c80c kernel/rcutorture.c Paul E. McKenney 2013-04-23 4647
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 4648 /*
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 4649 * Trigger a KASAN use-after-free report after draining a callback. Check
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 4650 * "Last potentially related work creation" for the callback enqueue stack.
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 4651 */
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 4652 static noinline void rcu_test_kasan(void)
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 4653 {
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 4654 struct rcu_head *rhp;
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 4655
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 4656 if (!IS_ENABLED(CONFIG_KASAN_GENERIC)) {
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 4657 pr_alert("%s: !CONFIG_KASAN_GENERIC, not testing KASAN aux stack call_%s()\n",
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 4658 KBUILD_MODNAME, cur_ops->name);
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 4659 return;
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 4660 }
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 4661
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 4662 if (!cur_ops->call || !cur_ops->cb_barrier) {
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 4663 pr_alert("%s: %s has no callback/barrier ops, skipping KASAN test\n",
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 4664 KBUILD_MODNAME, cur_ops->name);
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 4665 return;
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 4666 }
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 4667
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 4668 rhp = kmalloc_obj(*rhp);
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 4669 if (!rhp) {
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 4670 pr_alert("%s: KASAN aux-stack test skipped: allocation failed\n", KBUILD_MODNAME);
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 4671 return;
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 4672 }
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 4673
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 4674 pr_alert("%s: WARN: KASAN aux-stack call_%s() test starting.\n",
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 4675 KBUILD_MODNAME, cur_ops->name);
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 4676
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 4677 /* Keep the rcu_head allocated until all callbacks have completed. */
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 4678 cur_ops->call(rhp, rcu_torture_leak_cb);
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 4679 cur_ops->cb_barrier();
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 4680
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 @4681 kfree(rhp);
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 4682 /* Intentional use-after-free to display the recorded enqueue stack. */
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 @4683 (void)READ_ONCE(*(u8 *)rhp);
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 4684 pr_alert("%s: WARN: KASAN aux-stack call_%s() test complete.\n",
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 4685 KBUILD_MODNAME, cur_ops->name);
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 4686 }
1c9be559fe206301 kernel/rcu/rcutorture.c Kunwu Chan 2026-11-28 4687
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2026-12-03 6:20 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261203071009.B1Ru5CSM-lkp@intel.com \
--to=lkp@intel.com \
--cc=error27@gmail.com \
--cc=oe-kbuild@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.