From nobody Mon Feb 9 05:42:36 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 CA0E31F418F; Sun, 2 Nov 2025 21:05:51 +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=1762117551; cv=none; b=CS+lGrjTa5d7JEn+WfBSV3/A6dbz/U0b/xUTFaZIjb3Vy+7ZdNx/sxzIPeNr9kXYoNakZkA4fPPY8JlAUVdouVmnyPJ8/J107jDZQZw9CPl0pC5owDNPH34PYXF0U6pC7Ma2qJ6etgiCcyHh+EcN9HddlfY1n0G1vCokVUeKVZA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762117551; c=relaxed/simple; bh=nTHX1YfCh7X8t+gy7/mwsMUuWMwgp6cK39S8CemYIGw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=MbDRwwUxoB31wLKPSuW6bLNeenD9TwufDset/qEAnLDV6MVSo3pEi4PxdikyHtQbId+fjvD/d9fgiWHNkXhtehCZ2QcQxj9N1lCnHqW3DVKN1bkWtSlFDQejtWI2Y35o1X1yohj9bgZMyChQbAVTOIYk3UD3Vpdol5hVvFSsh6U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=OFj+LG1Q; 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="OFj+LG1Q" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58283C4CEF7; Sun, 2 Nov 2025 21:05:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1762117551; bh=nTHX1YfCh7X8t+gy7/mwsMUuWMwgp6cK39S8CemYIGw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OFj+LG1Qvk7YNodw8pQtzv2vnJKRnj9xVaY0axOQSaDzpCPJV8DgA/C1c7Hm5zUQa JGI3dMin4BaQD3IEM5kDqUog9AAkE5lzu/cxxx+4H0Z5X8ixaiVcY5hZNpKFzM0NTj YeJzHFr4Ksxhu9l8/8RYaqdKsOwFfAOe5+7UNmECedngREaJryK62Ff22ie0L3bLbh OngBPm2t8ISRF8FbARoj2ZdoVb0CuHrzcP3AuPK3//jx30/pe2Cf10Pc9Djul5Krg4 VUBYf4FLR/mUrag+Dvnv+aUTSqEvNJuC77VyJeDmYVDu0TC2Zih+gk6LCkF6teRenx tTk23700Sgz4Q== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 37630CE0F4C; Sun, 2 Nov 2025 13:05:50 -0800 (PST) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, Wang Liang , Zhang Changzhong , "Paul E . McKenney" Subject: [PATCH 1/3] locktorture: Fix memory leak in param_set_cpumask() Date: Sun, 2 Nov 2025 13:05:45 -0800 Message-Id: <20251102210547.3898972-1-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <6eb0d40f-9776-412a-9ab4-2d3298ead766@paulmck-laptop> References: <6eb0d40f-9776-412a-9ab4-2d3298ead766@paulmck-laptop> 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" From: Wang Liang With CONFIG_CPUMASK_OFFSTACK=3Dy, the 'bind_writers' buffer is allocated via alloc_cpumask_var() in param_set_cpumask(). But it is not freed, when setting the module parameter multiple times by sysfs interface or removing module. Below kmemleak trace is seen for this issue: unreferenced object 0xffff888100aabff8 (size 8): comm "bash", pid 323, jiffies 4295059233 hex dump (first 8 bytes): 07 00 00 00 00 00 00 00 ........ backtrace (crc ac50919): __kmalloc_node_noprof+0x2e5/0x420 alloc_cpumask_var_node+0x1f/0x30 param_set_cpumask+0x26/0xb0 [locktorture] param_attr_store+0x93/0x100 module_attr_store+0x1b/0x30 kernfs_fop_write_iter+0x114/0x1b0 vfs_write+0x300/0x410 ksys_write+0x60/0xd0 do_syscall_64+0xa4/0x260 entry_SYSCALL_64_after_hwframe+0x77/0x7f This issue can be reproduced by: insmod locktorture.ko bind_writers=3D1 rmmod locktorture or: insmod locktorture.ko bind_writers=3D1 echo 2 > /sys/module/locktorture/parameters/bind_writers Considering that setting the module parameter 'bind_writers' or 'bind_readers' by sysfs interface has no real effect, set the parameter permissions to 0444. To fix the memory leak when removing module, free 'bind_writers' and 'bind_readers' memory in lock_torture_cleanup(). Fixes: 73e341242483 ("locktorture: Add readers_bind and writers_bind module= parameters") Suggested-by: Zhang Changzhong Signed-off-by: Wang Liang Signed-off-by: Paul E. McKenney --- kernel/locking/locktorture.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c index ce0362f0a871..6567e5eeacc0 100644 --- a/kernel/locking/locktorture.c +++ b/kernel/locking/locktorture.c @@ -103,8 +103,8 @@ static const struct kernel_param_ops lt_bind_ops =3D { .get =3D param_get_cpumask, }; =20 -module_param_cb(bind_readers, <_bind_ops, &bind_readers, 0644); -module_param_cb(bind_writers, <_bind_ops, &bind_writers, 0644); +module_param_cb(bind_readers, <_bind_ops, &bind_readers, 0444); +module_param_cb(bind_writers, <_bind_ops, &bind_writers, 0444); =20 long torture_sched_setaffinity(pid_t pid, const struct cpumask *in_mask, b= ool dowarn); =20 @@ -1211,6 +1211,10 @@ static void lock_torture_cleanup(void) cxt.cur_ops->exit(); cxt.init_called =3D false; } + + free_cpumask_var(bind_readers); + free_cpumask_var(bind_writers); + torture_cleanup_end(); } =20 --=20 2.40.1 From nobody Mon Feb 9 05:42:36 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 9309718CC13; Sun, 2 Nov 2025 21:05:51 +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=1762117551; cv=none; b=r4h0rkE05hLpLU9nJxIY/AALA72HheuubmqWOfzU4zyL962gxwWVosF1xkRpTXCW2tC7BG2NqSF5Ar2mdPT5omr7pSKL+RCoQtTBSqu2MLh+rHwSuZs7vBgIlqfqlg8r2MhSjry5sCJHSSUBGDK85/34bk6q0vi7yX65gBoaD88= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762117551; c=relaxed/simple; bh=4KUUrYSVLSgf7AtIDUdA8yD1hmE5D2On1prenhy0yxs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=puuKzLHhtoKZl0SIzwdNkOaIMh5GPsI4GKzSpfMTKEHxNJggPfCyrNIVFF3s8hwudxuvc/TpCjsM1EGJD7JSl81aBlRbI697XOiEvQvbDOLOQ7XhDW07QbxyU6h4ac5hYYy0312lQiGqzCZNxPv0cAf8kHI6TalJk878hyr5f68= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XJWJ6IlB; 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="XJWJ6IlB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D30AC113D0; Sun, 2 Nov 2025 21:05:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1762117551; bh=4KUUrYSVLSgf7AtIDUdA8yD1hmE5D2On1prenhy0yxs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XJWJ6IlBiI0ol/o2uOH/A1eSEfRCMM+oV6C/50NzpBRqhJA761koPotXwi8+IhBbm 1OEzM3+xTsF6+jy+LzYRm9iIFknvOWBO6+PNvBAwpetWnjv38m4jeno+2wp2e2aUhF 1Smr2Hs8MS5VjqioOCBV29moh8BTjlbHn7ZLJYyZY5h05bNE+An3F8sznSWbjb/t1o IhtNs4klYScYAgcadXOIbTESIirfyxbWlM4BBg+pTXYVxMe9MQmbU0M6fbLcH65A3H L2o9wFVhdo+qNjCEgBFkQQGCLiw7oI3lwLg2/o3vyX7bv1R9eM7hkpssj0cguqmfkj lwtizZao6d+2w== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 3A489CE0F65; Sun, 2 Nov 2025 13:05:50 -0800 (PST) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, Xuanqiang Luo , "Paul E . McKenney" Subject: [PATCH 2/3] rcu: use WRITE_ONCE() for ->next and ->pprev of hlist_nulls Date: Sun, 2 Nov 2025 13:05:46 -0800 Message-Id: <20251102210547.3898972-2-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <6eb0d40f-9776-412a-9ab4-2d3298ead766@paulmck-laptop> References: <6eb0d40f-9776-412a-9ab4-2d3298ead766@paulmck-laptop> 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" From: Xuanqiang Luo In rculist_nulls.h we can still see ordinary assignments to ->pprev and ->next of hlist_nulls. As noted in the two patches below: commit efd04f8a8b45 ("rcu: Use WRITE_ONCE() for assignments to ->next for rculist_nulls") commit 860c8802ace1 ("rcu: Use WRITE_ONCE() for assignments to ->pprev for hlist_nulls") We should use WRITE_ONCE(). Signed-off-by: Xuanqiang Luo Signed-off-by: Paul E. McKenney --- include/linux/rculist_nulls.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/rculist_nulls.h b/include/linux/rculist_nulls.h index 89186c499dd4..d5a656cc4c6a 100644 --- a/include/linux/rculist_nulls.h +++ b/include/linux/rculist_nulls.h @@ -138,7 +138,7 @@ static inline void hlist_nulls_add_tail_rcu(struct hlis= t_nulls_node *n, =20 if (last) { WRITE_ONCE(n->next, last->next); - n->pprev =3D &last->next; + WRITE_ONCE(n->pprev, &last->next); rcu_assign_pointer(hlist_nulls_next_rcu(last), n); } else { hlist_nulls_add_head_rcu(n, h); @@ -148,8 +148,8 @@ static inline void hlist_nulls_add_tail_rcu(struct hlis= t_nulls_node *n, /* after that hlist_nulls_del will work */ static inline void hlist_nulls_add_fake(struct hlist_nulls_node *n) { - n->pprev =3D &n->next; - n->next =3D (struct hlist_nulls_node *)NULLS_MARKER(NULL); + WRITE_ONCE(n->pprev, &n->next); + WRITE_ONCE(n->next, (struct hlist_nulls_node *)NULLS_MARKER(NULL)); } =20 /** --=20 2.40.1 From nobody Mon Feb 9 05:42:36 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 A243A1A9FBF; Sun, 2 Nov 2025 21:05:51 +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=1762117551; cv=none; b=VNToxiO6NR1WAVH/0ECVb1VsdGI1x8IkigEMQuYt4P3/OT0Dr/ndZQb1BHrS5X5y1mcQHzvQQeMXaRx2ApErmtANdZZyL2h7nmI+mJAlx4kbPKzfYXBIx4gMvMwcZww8rkgrSqzLZkBE6zGJU/Rluq1KictOOwu8S/mUYxisHLo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762117551; c=relaxed/simple; bh=HlubEs5OuiijkixzaLlAICetG732GktzK4GSPaRKir4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=GjbAsBI1tDYqBntZcxuqwkXAi9KAA3N47pMpfgPy29zxIhLVVnPcyx9E2tgyxkUMo7HRSE0YFOc1rri6blon6iYcJterZcFK2m84PLpXceuc8LPVrlEODBc/oGuMkegbv/mpsF7op0mG768b54IjVJ12lRJhFEalUmF/hT05YsU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=q4NQh7Da; 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="q4NQh7Da" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 742B1C116D0; Sun, 2 Nov 2025 21:05:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1762117551; bh=HlubEs5OuiijkixzaLlAICetG732GktzK4GSPaRKir4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q4NQh7DaUDx8NA10VtEeAqnL33XJOy9cS0Rng94XQAOdmG+IorKYJWnNkckKhXbcV MTRNjD4dzLMNq3/t2KonL5lWCaKzZwlrH5RyR525VL3iPA6OOkGXn6cXy30CccBXDA JkQ59GDV9mGKu2CgkAeUoypA+WI+Xe+FTjXpNJzj9lzk91vpwARJWuO6V7SGbNIRg6 3Rv0wIjPrG/jzCiW4J5nYAGSipanG/9aQJmypfzQI1SMqZ/vRdQyKrIGMF5hcdJSLa QIkXh5q0UZ8yPVeFwlZLEh+mLOaj6O3AGdpE0JDiNbiiCCfYuB5kpU8YbHG+FolQrZ b5EoIRbWRr5bA== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 3CEF9CE0F8F; Sun, 2 Nov 2025 13:05:50 -0800 (PST) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" Subject: [PATCH 3/3] torture: Add kvm-series.sh to test commit/scenario combination Date: Sun, 2 Nov 2025 13:05:47 -0800 Message-Id: <20251102210547.3898972-3-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <6eb0d40f-9776-412a-9ab4-2d3298ead766@paulmck-laptop> References: <6eb0d40f-9776-412a-9ab4-2d3298ead766@paulmck-laptop> 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" This commit adds a kvm-series.sh script that takes a list of scenarios and a list of commits, and then runs each scenario on all of the commits. A given scenario is run on all the commits before advancing to the next scenario to minimize build times. The successes and failures are summarized at the end of the run. Signed-off-by: Paul E. McKenney --- .../selftests/rcutorture/bin/kvm-series.sh | 115 ++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100755 tools/testing/selftests/rcutorture/bin/kvm-series.sh diff --git a/tools/testing/selftests/rcutorture/bin/kvm-series.sh b/tools/t= esting/selftests/rcutorture/bin/kvm-series.sh new file mode 100755 index 000000000000..a39e401c8d4d --- /dev/null +++ b/tools/testing/selftests/rcutorture/bin/kvm-series.sh @@ -0,0 +1,115 @@ +#!/bin/bash +# +# Usage: kvm-series.sh config-list commit-id-list [ kvm.sh parameters ] +# +# Tests the specified list of unadorned configs ("TREE01 SRCU-P" but not +# "CFLIST" or "3*TRACE01") and an indication of a set of commits to test, +# then runs each commit through the specified list of commits using kvm.sh. +# The runs are grouped into a -series/config/commit directory tree. +# Each run defaults to a duration of one minute. +#=20 +# Run in top-level Linux source directory. Please note that this is in +# no way a replacement for "git bisect"!!! +# +# This script is intended to replace kvm-check-branches.sh by providing +# ease of use and faster execution. + +T=3D"`mktemp -d ${TMPDIR-/tmp}/kvm-series.sh.XXXXXX`" +trap 'rm -rf $T' 0 + +scriptname=3D$0 +args=3D"$*" + +config_list=3D"${1}" +if test -z "${config_list}" +then + echo "$0: Need a quoted list of --config arguments for first argument." + exit 1 +fi +if test -z "${config_list}" || echo "${config_list}" | grep -q '\*' +then + echo "$0: Repetition ('*') not allowed in config list." + exit 1 +fi + +commit_list=3D"${2}" +if test -z "${commit_list}" +then + echo "$0: Need a list of commits (e.g., HEAD^^^..) for second argument." + exit 2 +fi +git log --pretty=3Dformat:"%h" "${commit_list}" > $T/commits +ret=3D$? +if test "${ret}" -ne 0 +then + echo "$0: Invalid commit list ('${commit_list}')." + exit 2 +fi +sha1_list=3D`cat $T/commits` + +shift +shift + +RCUTORTURE=3D"`pwd`/tools/testing/selftests/rcutorture"; export RCUTORTURE +PATH=3D${RCUTORTURE}/bin:$PATH; export PATH +. functions.sh + +ret=3D0 +nfail=3D0 +nsuccess=3D0 +faillist=3D +successlist=3D +cursha1=3D"`git rev-parse --abbrev-ref HEAD`" +ds=3D"`date +%Y.%m.%d-%H.%M.%S`-series" +startdate=3D"`date`" +starttime=3D"`get_starttime`" + +echo " --- " $scriptname $args | tee -a $T/log +echo " --- Results directory: " $ds | tee -a $T/log + +for config in ${config_list} +do + sha_n=3D0 + for sha in ${sha1_list} + do + sha1=3D${sha_n}.${sha} # Enable "sort -k1nr" to list commits in order. + echo Starting ${config}/${sha1} at `date` | tee -a $T/log + git checkout "${sha}" + time tools/testing/selftests/rcutorture/bin/kvm.sh --configs "$config" -= -datestamp "$ds/${config}/${sha1}" --duration 1 "$@" + curret=3D$? + if test "${curret}" -ne 0 + then + nfail=3D$((nfail+1)) + faillist=3D"$faillist ${config}/${sha1}(${curret})" + else + nsuccess=3D$((nsuccess+1)) + successlist=3D"$successlist ${config}/${sha1}" + # Successful run, so remove large files. + rm -f ${RCUTORTURE}/$ds/${config}/${sha1}/{vmlinux,bzImage,System.map,M= odule.symvers} + fi + if test "${ret}" -eq 0 + then + ret=3D${curret} + fi + sha_n=3D$((sha_n+1)) + done +done +git checkout "${cursha1}" + +echo ${nsuccess} SUCCESSES: | tee -a $T/log +echo ${successlist} | fmt | tee -a $T/log +echo | tee -a $T/log +echo ${nfail} FAILURES: | tee -a $T/log +echo ${faillist} | fmt | tee -a $T/log +if test -n "${faillist}" +then + echo | tee -a $T/log + echo Failures across commits: | tee -a $T/log + echo ${faillist} | tr ' ' '\012' | sed -e 's,^[^/]*/,,' -e 's/([0-9]*)//'= | + sort | uniq -c | sort -k2n | tee -a $T/log +fi +echo Started at $startdate, ended at `date`, duration `get_starttime_durat= ion $starttime`. | tee -a $T/log +echo Summary: Successes: ${nsuccess} Failures: ${nfail} | tee -a $T/log +cp $T/log tools/testing/selftests/rcutorture/res/${ds} + +exit "${ret}" --=20 2.40.1