[PATCH v9 10/14] futex: Create get_robust_list2() syscall
From: André Almeida
Date: Fri Dec 04 2026 - 11:16:38 EST
As in the original robust list interface, to pair with set_robust_list2(),
create a get_robust_list2() syscall with the following signature:
get_robust_list2(int pid, void __user **head_ptr, unsigned int index,
unsigned int flags)
- `pid` selects which task's list should be returned. If is 0, it gets
the list of the calling task.
- `index` is the index of the list to get.
- `flags` must be 0, reserved for future extensions.
Return value is 0 when the operations succeeds, returns and error
otherwise.
Signed-off-by: André Almeida <andrealmeid@xxxxxxxxxx>
---
kernel/futex/syscalls.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/kernel/futex/syscalls.c b/kernel/futex/syscalls.c
index 29be7d88c8f7..904b5820294b 100644
--- a/kernel/futex/syscalls.c
+++ b/kernel/futex/syscalls.c
@@ -143,6 +143,24 @@ SYSCALL_DEFINE3(set_robust_list2, struct robust_list_head * __user, head,
return futex_robust_list_install((uintptr_t) head, index, new, compat);
}
+SYSCALL_DEFINE4(get_robust_list2, int, pid, void __user * __user *, head_ptr,
+ unsigned int, index, unsigned int, flags)
+{
+ struct robust_list_head __user *head;
+
+ if (flags || index >= FUTEX_ROBUST_LIST2_PER_USER)
+ return -EINVAL;
+
+ head = futex_get_robust_list_common(pid, index + FUTEX_ROBUST_LIST2_IDX);
+
+ if (IS_ERR(head))
+ return PTR_ERR(head);
+
+ if (in_compat_syscall())
+ return put_user(ptr_to_compat(head), (u32 __user *)head_ptr);
+ return put_user(head, head_ptr);
+}
+
long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout,
u32 __user *uaddr2, u32 val2, u32 val3)
{
--
2.56.1