Skip to main content

Module robust_list

Module robust_list 

Source
Expand description

Robust list syscalls: set_robust_list, get_robust_list

Robust lists allow the kernel to clean up held futex-based mutexes when a thread dies, preventing deadlocks.

Linux ABI (robust_list_head in userspace): offset 0: struct robust_list list (next pointer, 8 bytes) offset 8: long futex_offset (offset from list entry to futex int) offset 16: struct robust_list *list_op_pending (pending operation)

Total: 24 bytes on x86_64.

ConstantsΒ§

FUTEX_OWNER_DIED πŸ”’
Futex value bit: the owner has died.
ROBUST_LIST_LIMIT πŸ”’
Maximum number of entries to walk in a robust list (Linux uses 4096).
TID_MASK πŸ”’
Mask for the TID portion of a futex value.

FunctionsΒ§

cleanup_robust_list
Walk the robust list for a dying task and mark owned futexes as β€œowner died”.
mark_futex_owner_died πŸ”’
Mark a futex as owner-died if the current thread still holds it.
read_u32_from_user πŸ”’
Read a u32 from userspace memory at the given address.
sys_get_robust_list
SYS_GET_ROBUST_LIST (611): Get the robust list head for a task.
sys_set_robust_list
SYS_SET_ROBUST_LIST (610): Register the robust list head for the current task.