diff options
author | Manfred Spraul <[email protected]> | 2021-06-30 18:57:15 -0700 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2021-07-01 11:06:07 -0700 |
commit | 17d056e0bdaab3d3f1fbec1ac154addcc4183aed (patch) | |
tree | 1bd3fa260f546c38caab76a9542915d1f26db0c9 /scripts/gdb/linux/tasks.py | |
parent | bc8136a543aa839a848b49af5e101ac6de5f6b27 (diff) |
ipc/sem.c: use READ_ONCE()/WRITE_ONCE() for use_global_lock
The patch solves three weaknesses in ipc/sem.c:
1) The initial read of use_global_lock in sem_lock() is an intentional
race. KCSAN detects these accesses and prints a warning.
2) The code assumes that plain C read/writes are not mangled by the CPU
or the compiler.
3) The comment it sysvipc_sem_proc_show() was hard to understand: The
rest of the comments in ipc/sem.c speaks about sem_perm.lock, and
suddenly this function speaks about ipc_lock_object().
To solve 1) and 2), use READ_ONCE()/WRITE_ONCE(). Plain C reads are used
in code that owns sma->sem_perm.lock.
The comment is updated to solve 3)
[[email protected]: use READ_ONCE()/WRITE_ONCE() for use_global_lock]
Link: https://lkml.kernel.org/r/[email protected]
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Manfred Spraul <[email protected]>
Reviewed-by: Paul E. McKenney <[email protected]>
Reviewed-by: Davidlohr Bueso <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'scripts/gdb/linux/tasks.py')
0 files changed, 0 insertions, 0 deletions