漏洞标题
跟踪:重构成 trace_clock_global() ,使其永不会阻塞。
漏洞描述信息
在Linux内核中,已经修复了以下漏洞:
tracing:重构trace_clock_global()函数,以避免阻塞
据报道,环缓冲递归检测的修复可能导致在执行挂起/恢复测试时出现机器死锁。以下是针对此情况提取的跟踪回溯:
调用追踪:
1. trace_clock_global+0x91/0xa0
2. _rb_reserve_next+0x237/0x460
3. ring_buffer_lock_reserve+0x12a/0x3f0
4. trace_buffer_lock_reserve+0x10/0x50
5. __trace_graph_return+0x1f/0x80
6. trace_graph_return+0xb7/0xf0
7. ? trace_clock_global+0x91/0xa0
RIP(返回地址):
0010:native_queued_spin_lock_slowpath+0x69/0x200
由于环缓冲递归检测的修复允许在跟踪期间发生一次递归,这导致trace_clock_global()函数获取了一个旋转锁,然后试图再次获取它:
ring_buffer_lock_reserve() {
trace_clock_global() {
arch_spin_lock() {
queued_spin_lock_slowpath() {
/* lock taken */
(其他一些东西被函数图追踪器跟踪)
ring_buffer_lock_reserve() {
trace_clock_global() {
arch_spin_lock() {
queued_spin_lock_slowpath() {
/* 死锁! */
追踪应该*永远不会*阻塞,因为这可能导致奇怪的锁定问题,如上述所示。
重构trace_clock_global()代码,而不是简单地获取一个锁来更新记录的"prev_time",而是直接使用它。当两个事件在不同的CPU上同时调用此函数时,它们之间的顺序并不重要。尝试获取锁以更新prev_time,如果失败,则下次再试。如果无法获取锁,那意味着已经有其他东西正在更新它。
Bugzilla链接:https://bugzilla.kernel.org/show_bug.cgi?id=212761
CVSS信息
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
漏洞类别
跨界内存写
漏洞标题
tracing: Restructure trace_clock_global() to never block
漏洞描述信息
In the Linux kernel, the following vulnerability has been resolved:
tracing: Restructure trace_clock_global() to never block
It was reported that a fix to the ring buffer recursion detection would
cause a hung machine when performing suspend / resume testing. The
following backtrace was extracted from debugging that case:
Call Trace:
trace_clock_global+0x91/0xa0
__rb_reserve_next+0x237/0x460
ring_buffer_lock_reserve+0x12a/0x3f0
trace_buffer_lock_reserve+0x10/0x50
__trace_graph_return+0x1f/0x80
trace_graph_return+0xb7/0xf0
? trace_clock_global+0x91/0xa0
ftrace_return_to_handler+0x8b/0xf0
? pv_hash+0xa0/0xa0
return_to_handler+0x15/0x30
? ftrace_graph_caller+0xa0/0xa0
? trace_clock_global+0x91/0xa0
? __rb_reserve_next+0x237/0x460
? ring_buffer_lock_reserve+0x12a/0x3f0
? trace_event_buffer_lock_reserve+0x3c/0x120
? trace_event_buffer_reserve+0x6b/0xc0
? trace_event_raw_event_device_pm_callback_start+0x125/0x2d0
? dpm_run_callback+0x3b/0xc0
? pm_ops_is_empty+0x50/0x50
? platform_get_irq_byname_optional+0x90/0x90
? trace_device_pm_callback_start+0x82/0xd0
? dpm_run_callback+0x49/0xc0
With the following RIP:
RIP: 0010:native_queued_spin_lock_slowpath+0x69/0x200
Since the fix to the recursion detection would allow a single recursion to
happen while tracing, this lead to the trace_clock_global() taking a spin
lock and then trying to take it again:
ring_buffer_lock_reserve() {
trace_clock_global() {
arch_spin_lock() {
queued_spin_lock_slowpath() {
/* lock taken */
(something else gets traced by function graph tracer)
ring_buffer_lock_reserve() {
trace_clock_global() {
arch_spin_lock() {
queued_spin_lock_slowpath() {
/* DEAD LOCK! */
Tracing should *never* block, as it can lead to strange lockups like the
above.
Restructure the trace_clock_global() code to instead of simply taking a
lock to update the recorded "prev_time" simply use it, as two events
happening on two different CPUs that calls this at the same time, really
doesn't matter which one goes first. Use a trylock to grab the lock for
updating the prev_time, and if it fails, simply try again the next time.
If it failed to be taken, that means something else is already updating
it.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=212761
CVSS信息
N/A
漏洞类别
N/A
漏洞标题
Linux kernel 安全漏洞
漏洞描述信息
Linux kernel是美国Linux基金会的开源操作系统Linux所使用的内核。 Linux kernel 存在安全漏洞,该漏洞源于重构trace_clock_global()以永不阻塞。
CVSS信息
N/A
漏洞类别
其他