anolis-cloud-kernel/kernel/rcu
Nikita Kiryushin d0e137b969 rcu-tasks: Fix show_rcu_tasks_trace_gp_kthread buffer overflow
ANBZ: #12843

commit cc5645fddb upstream.

There is a possibility of buffer overflow in
show_rcu_tasks_trace_gp_kthread() if counters, passed
to sprintf() are huge. Counter numbers, needed for this
are unrealistically high, but buffer overflow is still
possible.

Use snprintf() with buffer size instead of sprintf().

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: edf3775f0a ("rcu-tasks: Add count for idle tasks on offline CPUs")
Signed-off-by: Nikita Kiryushin <kiryushin@ancud.ru>
Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
Fixes: CVE-2024-38577
Signed-off-by: Tianchen Ding <dtcccc@linux.alibaba.com>
Reviewed-by: Cruz Zhao <CruzZhao@linux.alibaba.com>
Link: https://gitee.com/anolis/cloud-kernel/pulls/4362
2025-01-09 08:53:15 +00:00
..
Kconfig rcu: Make TASKS_RUDE_RCU select IRQ_WORK 2022-06-09 10:20:51 +02:00
Kconfig.debug Merge branch 'strictgp.2020.08.24a' into HEAD 2020-09-03 09:47:42 -07:00
Makefile rcuperf: Change rcuperf to rcuscale 2020-08-24 18:39:24 -07:00
rcu.h srcu: Fix broken node geometry after early ssp init 2021-07-20 16:05:38 +02:00
rcu_segcblist.c rcu/segcblist: Prevent useless GP start if no CBs to accelerate 2020-09-03 09:39:59 -07:00
rcu_segcblist.h rcu: Remove kfree_rcu() special casing and lazy-callback handling 2020-01-24 10:24:31 -08:00
rcuscale.c rcuperf: Change rcuperf to rcuscale 2020-08-24 18:39:24 -07:00
rcutorture.c rcutorture: Fix invalid context warning when enable srcu barrier testing 2024-08-12 09:46:50 +00:00
refscale.c refperf: Avoid null pointer dereference when buf fails to allocate 2020-08-24 18:45:35 -07:00
srcutiny.c srcu: Provide polling interfaces for Tiny SRCU grace periods 2021-09-03 10:09:30 +02:00
srcutree.c srcu: Take early exit on memory-allocation failure 2022-08-01 12:16:25 +00:00
sync.c rcu/sync: Simplify the state machine 2019-05-28 09:05:23 -07:00
tasks.h rcu-tasks: Fix show_rcu_tasks_trace_gp_kthread buffer overflow 2025-01-09 08:53:15 +00:00
tiny.c rcu: Rename *_kfree_callback/*_kfree_rcu_offset/kfree_call_* 2020-06-29 11:59:25 -07:00
tree.c rcu: kmemleak: Ignore kmemleak false positives when RCU-freeing objects 2024-08-12 09:46:50 +00:00
tree.h rcu: Prevent lockdep-RCU splats on lock acquisition/release 2024-08-12 09:46:50 +00:00
tree_exp.h rcu: Prevent expedited GP from enabling tick on offline CPU 2024-08-12 09:46:50 +00:00
tree_plugin.h rcu: Don't deboost before reporting expedited quiescent state 2022-03-28 09:57:10 +02:00
tree_stall.h ck: UKFEF: report rcu-stall event 2022-08-01 11:30:52 +00:00
update.c rcu: Reject RCU_LOCKDEP_WARN() false positives 2021-07-20 16:05:38 +02:00