* Re: [PATCH v8 05/10] futex: Create get_robust_list2() syscall
@ 2026-11-21 4:29 kernel test robot
0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2026-11-21 4:29 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp
::::::
:::::: Manual check reason: "too many reports for this commit"
::::::
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20261115-tonyk-robust_futex-v8-5-a4fe47333a28@igalia.com>
References: <20261115-tonyk-robust_futex-v8-5-a4fe47333a28@igalia.com>
TO: "André Almeida" <andrealmeid@igalia.com>
TO: Ingo Molnar <mingo@redhat.com>
TO: Peter Zijlstra <peterz@infradead.org>
TO: Darren Hart <dvhart@infradead.org>
TO: Davidlohr Bueso <dave@stgolabs.net>
TO: Arnd Bergmann <arnd@arndb.de>
TO: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
TO: Waiman Long <longman@redhat.com>
TO: Ryan Houdek <Sonicadvance1@gmail.com>
TO: Thomas Gleixner <tglx@kernel.org>
CC: linux-kernel@vger.kernel.org
CC: linux-kselftest@vger.kernel.org
CC: linux-api@vger.kernel.org
CC: kernel-dev@igalia.com
CC: "André Almeida" <andrealmeid@igalia.com>
Hi André,
kernel test robot noticed the following build warnings:
[auto build test WARNING on 9f74092fda91ef93c2b07585785c1dc83cd7971f]
url: https://github.com/intel-lab-lkp/linux/commits/Andr-Almeida/futex-Skip-test_futex_robust_unlock-if-not-supported/20261115-143110
base: 9f74092fda91ef93c2b07585785c1dc83cd7971f
patch link: https://lore.kernel.org/r/20261115-tonyk-robust_futex-v8-5-a4fe47333a28%40igalia.com
patch subject: [PATCH v8 05/10] futex: Create get_robust_list2() syscall
:::::: branch date: 5 days ago
:::::: commit date: 5 days ago
config: microblaze-randconfig-r2306-20261121 (https://download.01.org/0day-ci/archive/20261121/20261121051836.KdlAcGYi-lkp@intel.com/config)
compiler: microblaze-linux-gcc (GCC) 10.5.0
sparse: v0.6.5-rc1-21-g84ec0658
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261121/20261121051836.KdlAcGYi-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/r/20261121051836.KdlAcGYi-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
kernel/futex/syscalls.c:119:46: sparse: sparse: dereference of noderef expression
kernel/futex/syscalls.c:216:14: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct robust_list_head *head @@ got struct robust_list_head [noderef] __user * @@
kernel/futex/syscalls.c:216:14: sparse: expected struct robust_list_head *head
kernel/futex/syscalls.c:216:14: sparse: got struct robust_list_head [noderef] __user *
>> kernel/futex/syscalls.c:218:16: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void [noderef] __user *volatile __pu_val @@ got struct robust_list_head *head @@
kernel/futex/syscalls.c:218:16: sparse: expected void [noderef] __user *volatile __pu_val
kernel/futex/syscalls.c:218:16: sparse: got struct robust_list_head *head
vim +218 kernel/futex/syscalls.c
af8cc9600bbf22 Peter Zijlstra 2021-09-23 115
5384a6aeaf2edf André Almeida 2026-11-15 116 SYSCALL_DEFINE4(set_robust_list2, struct robust_list_head * __user, head, unsigned int,
5384a6aeaf2edf André Almeida 2026-11-15 117 cmd, unsigned int, index, unsigned int, flags)
5384a6aeaf2edf André Almeida 2026-11-15 118 {
5384a6aeaf2edf André Almeida 2026-11-15 @119 uintptr_t entry = (__force uintptr_t)head;
5384a6aeaf2edf André Almeida 2026-11-15 120 size_t align = sizeof(u32);
5384a6aeaf2edf André Almeida 2026-11-15 121 int ret;
5384a6aeaf2edf André Almeida 2026-11-15 122
5384a6aeaf2edf André Almeida 2026-11-15 123 if (flags)
5384a6aeaf2edf André Almeida 2026-11-15 124 return -EINVAL;
5384a6aeaf2edf André Almeida 2026-11-15 125
5384a6aeaf2edf André Almeida 2026-11-15 126 if (cmd >= FUTEX_ROBUST_LIST_CMD_USER_MAX)
5384a6aeaf2edf André Almeida 2026-11-15 127 return -EINVAL;
5384a6aeaf2edf André Almeida 2026-11-15 128
5384a6aeaf2edf André Almeida 2026-11-15 129 if (cmd == FUTEX_ROBUST_LIST_CMD_CREATE_64 ||
5384a6aeaf2edf André Almeida 2026-11-15 130 cmd == FUTEX_ROBUST_LIST_CMD_MODIFY_64) {
5384a6aeaf2edf André Almeida 2026-11-15 131 if (futex_in_32bit_syscall())
5384a6aeaf2edf André Almeida 2026-11-15 132 return -EOPNOTSUPP;
5384a6aeaf2edf André Almeida 2026-11-15 133 align = sizeof(u64);
5384a6aeaf2edf André Almeida 2026-11-15 134 }
5384a6aeaf2edf André Almeida 2026-11-15 135
5384a6aeaf2edf André Almeida 2026-11-15 136 switch (cmd) {
5384a6aeaf2edf André Almeida 2026-11-15 137 case FUTEX_ROBUST_LIST_CMD_CREATE_64:
5384a6aeaf2edf André Almeida 2026-11-15 138 case FUTEX_ROBUST_LIST_CMD_CREATE_32:
5384a6aeaf2edf André Almeida 2026-11-15 139 if (index)
5384a6aeaf2edf André Almeida 2026-11-15 140 return -EINVAL;
5384a6aeaf2edf André Almeida 2026-11-15 141
5384a6aeaf2edf André Almeida 2026-11-15 142 if (entry % align)
5384a6aeaf2edf André Almeida 2026-11-15 143 return -EINVAL;
5384a6aeaf2edf André Almeida 2026-11-15 144
5384a6aeaf2edf André Almeida 2026-11-15 145 /*
5384a6aeaf2edf André Almeida 2026-11-15 146 * The first two indexes are reserved for the kernel to be used
5384a6aeaf2edf André Almeida 2026-11-15 147 * with the legacy syscall, so we hide them from userspace.
5384a6aeaf2edf André Almeida 2026-11-15 148 *
5384a6aeaf2edf André Almeida 2026-11-15 149 * We map [0, FUTEX_ROBUST_LISTS_PER_USER) to
5384a6aeaf2edf André Almeida 2026-11-15 150 * [FUTEX_ROBUST_LIST2_IDX, FUTEX_ROBUST_LIST2_MAX_IDX)
5384a6aeaf2edf André Almeida 2026-11-15 151 */
5384a6aeaf2edf André Almeida 2026-11-15 152 ret = futex_robust_list_create(entry, cmd);
5384a6aeaf2edf André Almeida 2026-11-15 153
5384a6aeaf2edf André Almeida 2026-11-15 154 if (ret >= 0)
5384a6aeaf2edf André Almeida 2026-11-15 155 ret -= FUTEX_ROBUST_LIST2_IDX;
5384a6aeaf2edf André Almeida 2026-11-15 156
5384a6aeaf2edf André Almeida 2026-11-15 157 return ret;
5384a6aeaf2edf André Almeida 2026-11-15 158
5384a6aeaf2edf André Almeida 2026-11-15 159 case FUTEX_ROBUST_LIST_CMD_MODIFY_64:
5384a6aeaf2edf André Almeida 2026-11-15 160 case FUTEX_ROBUST_LIST_CMD_MODIFY_32:
5384a6aeaf2edf André Almeida 2026-11-15 161 if (entry % align)
5384a6aeaf2edf André Almeida 2026-11-15 162 return -EINVAL;
5384a6aeaf2edf André Almeida 2026-11-15 163 return futex_robust_list_modify(entry, cmd, index);
5384a6aeaf2edf André Almeida 2026-11-15 164 case FUTEX_ROBUST_LIST_CMD_LIST_LIMIT:
5384a6aeaf2edf André Almeida 2026-11-15 165 return FUTEX_ROBUST_LISTS_PER_USER;
5384a6aeaf2edf André Almeida 2026-11-15 166 }
5384a6aeaf2edf André Almeida 2026-11-15 167
5384a6aeaf2edf André Almeida 2026-11-15 168 return -EINVAL;
5384a6aeaf2edf André Almeida 2026-11-15 169 }
5384a6aeaf2edf André Almeida 2026-11-15 170
5588aabbe40841 André Almeida 2026-11-15 171 SYSCALL_DEFINE4(get_robust_list2, int, pid,
5588aabbe40841 André Almeida 2026-11-15 172 void __user * __user *, head_ptr,
5588aabbe40841 André Almeida 2026-11-15 173 unsigned int, index, unsigned int, flags)
5588aabbe40841 André Almeida 2026-11-15 174 {
5588aabbe40841 André Almeida 2026-11-15 175 struct robust_list_head *head;
5588aabbe40841 André Almeida 2026-11-15 176 void __user *entry_ptr;
5588aabbe40841 André Almeida 2026-11-15 177 uintptr_t entry;
5588aabbe40841 André Almeida 2026-11-15 178
5588aabbe40841 André Almeida 2026-11-15 179 if (index >= FUTEX_ROBUST_LISTS_PER_USER)
5588aabbe40841 André Almeida 2026-11-15 180 return -EINVAL;
5588aabbe40841 André Almeida 2026-11-15 181
5588aabbe40841 André Almeida 2026-11-15 182 if (flags)
5588aabbe40841 André Almeida 2026-11-15 183 return -EINVAL;
5588aabbe40841 André Almeida 2026-11-15 184
5588aabbe40841 André Almeida 2026-11-15 185 /*
5588aabbe40841 André Almeida 2026-11-15 186 * The first two indexes are reserved for the kernel to be used with the
5588aabbe40841 André Almeida 2026-11-15 187 * legacy syscall, so we hide them from userspace.
5588aabbe40841 André Almeida 2026-11-15 188 *
5588aabbe40841 André Almeida 2026-11-15 189 * We map [0, FUTEX_ROBUST_LISTS_PER_USER) to
5588aabbe40841 André Almeida 2026-11-15 190 * [FUTEX_ROBUST_LIST2_IDX, FUTEX_ROBUST_LIST2_MAX_IDX)
5588aabbe40841 André Almeida 2026-11-15 191 */
5588aabbe40841 André Almeida 2026-11-15 192 index += FUTEX_ROBUST_LIST2_IDX;
5588aabbe40841 André Almeida 2026-11-15 193
5588aabbe40841 André Almeida 2026-11-15 194 entry_ptr = futex_get_robust_list_common(pid, false, index);
5588aabbe40841 André Almeida 2026-11-15 195 if (IS_ERR(entry_ptr))
5588aabbe40841 André Almeida 2026-11-15 196 return PTR_ERR(entry_ptr);
5588aabbe40841 André Almeida 2026-11-15 197
5588aabbe40841 André Almeida 2026-11-15 198 entry = (uintptr_t) entry_ptr;
5588aabbe40841 André Almeida 2026-11-15 199
5588aabbe40841 André Almeida 2026-11-15 200 if (futex_in_32bit_syscall()) {
5588aabbe40841 André Almeida 2026-11-15 201 u32 entry32;
5588aabbe40841 André Almeida 2026-11-15 202
5588aabbe40841 André Almeida 2026-11-15 203 if (entry && !(entry & FUTEX_ROBUST_LIST_ENTRY_32BIT))
5588aabbe40841 André Almeida 2026-11-15 204 return -EOPNOTSUPP;
5588aabbe40841 André Almeida 2026-11-15 205
5588aabbe40841 André Almeida 2026-11-15 206 entry32 = (u32)entry;
5588aabbe40841 André Almeida 2026-11-15 207 entry32 &= FUTEX_ROBUST_LIST_ENTRY_MASK;
5588aabbe40841 André Almeida 2026-11-15 208
5588aabbe40841 André Almeida 2026-11-15 209 if (copy_to_user(head_ptr, &entry32, sizeof(entry32)))
5588aabbe40841 André Almeida 2026-11-15 210 return -EFAULT;
5588aabbe40841 André Almeida 2026-11-15 211
5588aabbe40841 André Almeida 2026-11-15 212 return 0;
5588aabbe40841 André Almeida 2026-11-15 213 }
5588aabbe40841 André Almeida 2026-11-15 214
5588aabbe40841 André Almeida 2026-11-15 215 entry &= FUTEX_ROBUST_LIST_ENTRY_MASK;
5588aabbe40841 André Almeida 2026-11-15 216 head = (__force struct robust_list_head __user *)entry;
5588aabbe40841 André Almeida 2026-11-15 217
5588aabbe40841 André Almeida 2026-11-15 @218 return put_user(head, head_ptr);
5588aabbe40841 André Almeida 2026-11-15 219 }
5588aabbe40841 André Almeida 2026-11-15 220
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v8 05/10] futex: Create get_robust_list2() syscall
@ 2026-11-21 1:17 kernel test robot
0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2026-11-21 1:17 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp
::::::
:::::: Manual check reason: "too many reports for this commit"
::::::
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20261115-tonyk-robust_futex-v8-5-a4fe47333a28@igalia.com>
References: <20261115-tonyk-robust_futex-v8-5-a4fe47333a28@igalia.com>
TO: "André Almeida" <andrealmeid@igalia.com>
TO: Ingo Molnar <mingo@redhat.com>
TO: Peter Zijlstra <peterz@infradead.org>
TO: Darren Hart <dvhart@infradead.org>
TO: Davidlohr Bueso <dave@stgolabs.net>
TO: Arnd Bergmann <arnd@arndb.de>
TO: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
TO: Waiman Long <longman@redhat.com>
TO: Ryan Houdek <Sonicadvance1@gmail.com>
TO: Thomas Gleixner <tglx@kernel.org>
CC: linux-kernel@vger.kernel.org
CC: linux-kselftest@vger.kernel.org
CC: linux-api@vger.kernel.org
CC: kernel-dev@igalia.com
CC: "André Almeida" <andrealmeid@igalia.com>
Hi André,
kernel test robot noticed the following build warnings:
[auto build test WARNING on 9f74092fda91ef93c2b07585785c1dc83cd7971f]
url: https://github.com/intel-lab-lkp/linux/commits/Andr-Almeida/futex-Skip-test_futex_robust_unlock-if-not-supported/20261115-143110
base: 9f74092fda91ef93c2b07585785c1dc83cd7971f
patch link: https://lore.kernel.org/r/20261115-tonyk-robust_futex-v8-5-a4fe47333a28%40igalia.com
patch subject: [PATCH v8 05/10] futex: Create get_robust_list2() syscall
:::::: branch date: 5 days ago
:::::: commit date: 5 days ago
config: nios2-randconfig-r2306-20261120 (https://download.01.org/0day-ci/archive/20261121/20261121020956.KlugeMYq-lkp@intel.com/config)
compiler: nios2-linux-gcc (GCC) 8.5.0
sparse: v0.6.5-rc1-21-g84ec0658
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261121/20261121020956.KlugeMYq-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/r/20261121020956.KlugeMYq-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
kernel/futex/syscalls.c:119:46: sparse: sparse: dereference of noderef expression
>> kernel/futex/syscalls.c:216:14: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct robust_list_head *head @@ got struct robust_list_head [noderef] __user * @@
kernel/futex/syscalls.c:216:14: sparse: expected struct robust_list_head *head
kernel/futex/syscalls.c:216:14: sparse: got struct robust_list_head [noderef] __user *
vim +216 kernel/futex/syscalls.c
af8cc9600bbf22 Peter Zijlstra 2021-09-23 115
5384a6aeaf2edf André Almeida 2026-11-15 116 SYSCALL_DEFINE4(set_robust_list2, struct robust_list_head * __user, head, unsigned int,
5384a6aeaf2edf André Almeida 2026-11-15 117 cmd, unsigned int, index, unsigned int, flags)
5384a6aeaf2edf André Almeida 2026-11-15 118 {
5384a6aeaf2edf André Almeida 2026-11-15 @119 uintptr_t entry = (__force uintptr_t)head;
5384a6aeaf2edf André Almeida 2026-11-15 120 size_t align = sizeof(u32);
5384a6aeaf2edf André Almeida 2026-11-15 121 int ret;
5384a6aeaf2edf André Almeida 2026-11-15 122
5384a6aeaf2edf André Almeida 2026-11-15 123 if (flags)
5384a6aeaf2edf André Almeida 2026-11-15 124 return -EINVAL;
5384a6aeaf2edf André Almeida 2026-11-15 125
5384a6aeaf2edf André Almeida 2026-11-15 126 if (cmd >= FUTEX_ROBUST_LIST_CMD_USER_MAX)
5384a6aeaf2edf André Almeida 2026-11-15 127 return -EINVAL;
5384a6aeaf2edf André Almeida 2026-11-15 128
5384a6aeaf2edf André Almeida 2026-11-15 129 if (cmd == FUTEX_ROBUST_LIST_CMD_CREATE_64 ||
5384a6aeaf2edf André Almeida 2026-11-15 130 cmd == FUTEX_ROBUST_LIST_CMD_MODIFY_64) {
5384a6aeaf2edf André Almeida 2026-11-15 131 if (futex_in_32bit_syscall())
5384a6aeaf2edf André Almeida 2026-11-15 132 return -EOPNOTSUPP;
5384a6aeaf2edf André Almeida 2026-11-15 133 align = sizeof(u64);
5384a6aeaf2edf André Almeida 2026-11-15 134 }
5384a6aeaf2edf André Almeida 2026-11-15 135
5384a6aeaf2edf André Almeida 2026-11-15 136 switch (cmd) {
5384a6aeaf2edf André Almeida 2026-11-15 137 case FUTEX_ROBUST_LIST_CMD_CREATE_64:
5384a6aeaf2edf André Almeida 2026-11-15 138 case FUTEX_ROBUST_LIST_CMD_CREATE_32:
5384a6aeaf2edf André Almeida 2026-11-15 139 if (index)
5384a6aeaf2edf André Almeida 2026-11-15 140 return -EINVAL;
5384a6aeaf2edf André Almeida 2026-11-15 141
5384a6aeaf2edf André Almeida 2026-11-15 142 if (entry % align)
5384a6aeaf2edf André Almeida 2026-11-15 143 return -EINVAL;
5384a6aeaf2edf André Almeida 2026-11-15 144
5384a6aeaf2edf André Almeida 2026-11-15 145 /*
5384a6aeaf2edf André Almeida 2026-11-15 146 * The first two indexes are reserved for the kernel to be used
5384a6aeaf2edf André Almeida 2026-11-15 147 * with the legacy syscall, so we hide them from userspace.
5384a6aeaf2edf André Almeida 2026-11-15 148 *
5384a6aeaf2edf André Almeida 2026-11-15 149 * We map [0, FUTEX_ROBUST_LISTS_PER_USER) to
5384a6aeaf2edf André Almeida 2026-11-15 150 * [FUTEX_ROBUST_LIST2_IDX, FUTEX_ROBUST_LIST2_MAX_IDX)
5384a6aeaf2edf André Almeida 2026-11-15 151 */
5384a6aeaf2edf André Almeida 2026-11-15 152 ret = futex_robust_list_create(entry, cmd);
5384a6aeaf2edf André Almeida 2026-11-15 153
5384a6aeaf2edf André Almeida 2026-11-15 154 if (ret >= 0)
5384a6aeaf2edf André Almeida 2026-11-15 155 ret -= FUTEX_ROBUST_LIST2_IDX;
5384a6aeaf2edf André Almeida 2026-11-15 156
5384a6aeaf2edf André Almeida 2026-11-15 157 return ret;
5384a6aeaf2edf André Almeida 2026-11-15 158
5384a6aeaf2edf André Almeida 2026-11-15 159 case FUTEX_ROBUST_LIST_CMD_MODIFY_64:
5384a6aeaf2edf André Almeida 2026-11-15 160 case FUTEX_ROBUST_LIST_CMD_MODIFY_32:
5384a6aeaf2edf André Almeida 2026-11-15 161 if (entry % align)
5384a6aeaf2edf André Almeida 2026-11-15 162 return -EINVAL;
5384a6aeaf2edf André Almeida 2026-11-15 163 return futex_robust_list_modify(entry, cmd, index);
5384a6aeaf2edf André Almeida 2026-11-15 164 case FUTEX_ROBUST_LIST_CMD_LIST_LIMIT:
5384a6aeaf2edf André Almeida 2026-11-15 165 return FUTEX_ROBUST_LISTS_PER_USER;
5384a6aeaf2edf André Almeida 2026-11-15 166 }
5384a6aeaf2edf André Almeida 2026-11-15 167
5384a6aeaf2edf André Almeida 2026-11-15 168 return -EINVAL;
5384a6aeaf2edf André Almeida 2026-11-15 169 }
5384a6aeaf2edf André Almeida 2026-11-15 170
5588aabbe40841 André Almeida 2026-11-15 171 SYSCALL_DEFINE4(get_robust_list2, int, pid,
5588aabbe40841 André Almeida 2026-11-15 172 void __user * __user *, head_ptr,
5588aabbe40841 André Almeida 2026-11-15 173 unsigned int, index, unsigned int, flags)
5588aabbe40841 André Almeida 2026-11-15 174 {
5588aabbe40841 André Almeida 2026-11-15 175 struct robust_list_head *head;
5588aabbe40841 André Almeida 2026-11-15 176 void __user *entry_ptr;
5588aabbe40841 André Almeida 2026-11-15 177 uintptr_t entry;
5588aabbe40841 André Almeida 2026-11-15 178
5588aabbe40841 André Almeida 2026-11-15 179 if (index >= FUTEX_ROBUST_LISTS_PER_USER)
5588aabbe40841 André Almeida 2026-11-15 180 return -EINVAL;
5588aabbe40841 André Almeida 2026-11-15 181
5588aabbe40841 André Almeida 2026-11-15 182 if (flags)
5588aabbe40841 André Almeida 2026-11-15 183 return -EINVAL;
5588aabbe40841 André Almeida 2026-11-15 184
5588aabbe40841 André Almeida 2026-11-15 185 /*
5588aabbe40841 André Almeida 2026-11-15 186 * The first two indexes are reserved for the kernel to be used with the
5588aabbe40841 André Almeida 2026-11-15 187 * legacy syscall, so we hide them from userspace.
5588aabbe40841 André Almeida 2026-11-15 188 *
5588aabbe40841 André Almeida 2026-11-15 189 * We map [0, FUTEX_ROBUST_LISTS_PER_USER) to
5588aabbe40841 André Almeida 2026-11-15 190 * [FUTEX_ROBUST_LIST2_IDX, FUTEX_ROBUST_LIST2_MAX_IDX)
5588aabbe40841 André Almeida 2026-11-15 191 */
5588aabbe40841 André Almeida 2026-11-15 192 index += FUTEX_ROBUST_LIST2_IDX;
5588aabbe40841 André Almeida 2026-11-15 193
5588aabbe40841 André Almeida 2026-11-15 194 entry_ptr = futex_get_robust_list_common(pid, false, index);
5588aabbe40841 André Almeida 2026-11-15 195 if (IS_ERR(entry_ptr))
5588aabbe40841 André Almeida 2026-11-15 196 return PTR_ERR(entry_ptr);
5588aabbe40841 André Almeida 2026-11-15 197
5588aabbe40841 André Almeida 2026-11-15 198 entry = (uintptr_t) entry_ptr;
5588aabbe40841 André Almeida 2026-11-15 199
5588aabbe40841 André Almeida 2026-11-15 200 if (futex_in_32bit_syscall()) {
5588aabbe40841 André Almeida 2026-11-15 201 u32 entry32;
5588aabbe40841 André Almeida 2026-11-15 202
5588aabbe40841 André Almeida 2026-11-15 203 if (entry && !(entry & FUTEX_ROBUST_LIST_ENTRY_32BIT))
5588aabbe40841 André Almeida 2026-11-15 204 return -EOPNOTSUPP;
5588aabbe40841 André Almeida 2026-11-15 205
5588aabbe40841 André Almeida 2026-11-15 206 entry32 = (u32)entry;
5588aabbe40841 André Almeida 2026-11-15 207 entry32 &= FUTEX_ROBUST_LIST_ENTRY_MASK;
5588aabbe40841 André Almeida 2026-11-15 208
5588aabbe40841 André Almeida 2026-11-15 209 if (copy_to_user(head_ptr, &entry32, sizeof(entry32)))
5588aabbe40841 André Almeida 2026-11-15 210 return -EFAULT;
5588aabbe40841 André Almeida 2026-11-15 211
5588aabbe40841 André Almeida 2026-11-15 212 return 0;
5588aabbe40841 André Almeida 2026-11-15 213 }
5588aabbe40841 André Almeida 2026-11-15 214
5588aabbe40841 André Almeida 2026-11-15 215 entry &= FUTEX_ROBUST_LIST_ENTRY_MASK;
5588aabbe40841 André Almeida 2026-11-15 @216 head = (__force struct robust_list_head __user *)entry;
5588aabbe40841 André Almeida 2026-11-15 217
5588aabbe40841 André Almeida 2026-11-15 218 return put_user(head, head_ptr);
5588aabbe40841 André Almeida 2026-11-15 219 }
5588aabbe40841 André Almeida 2026-11-15 220
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH v8 00/10] futex: Create {set,get}_robust_list2() syscalls
@ 2026-11-15 17:31 André Almeida
2026-11-15 17:31 ` [PATCH v8 05/10] futex: Create get_robust_list2() syscall André Almeida
0 siblings, 1 reply; 5+ messages in thread
From: André Almeida @ 2026-11-15 17:31 UTC (permalink / raw)
To: Ingo Molnar, Peter Zijlstra, Darren Hart, Davidlohr Bueso,
Arnd Bergmann, Sebastian Andrzej Siewior, Waiman Long,
Ryan Houdek, Thomas Gleixner
Cc: linux-kernel, linux-kselftest, linux-api, kernel-dev,
André Almeida
Hello,
Now that we mostly fixed the op_pending race condition, I believe it's time to
continue the new syscall work. This patchset is adapted to the robust_try_unlock
mechanics.
* Use case
The use-case for the new syscalls is detailed in the last patch version:
https://lore.kernel.org/lkml/20250626-tonyk-robust_futex-v5-0-179194dbde8f@igalia.com
* The syscall interface
Documented at patches 3/9 "futex: Create set_robust_list2() syscall" and
4/9 "futex: Create get_robust_list2() syscall".
* Testing
I expanded the current robust list selftest to use the new interface,
and also ported the original syscall to use the new syscall internals,
and everything survived the tests. Tested on both x86 and arm64.
* Changelog
Changes from v7:
- Expanded the selftest for more corner cases and error handling
- Fix a lot of Sashiko findings, including:
- Refactor handling of 32-bit lists in get_robust_list2
- Fix legacy 32-bit list creation overwritting 64-bit list
- Fix 32-bit list never getting cleared
- Fix corrupting error code
- Fix logic for modifying list elements
- Link to v7: https://patch.msgid.link/20260925-tonyk-robust_futex-v7-0-d1095991152c@igalia.com
Changes from v6:
- Interface now uses CREATE/MODIFY semantics instead of SET. This allows to
both libc and app to use the lists without conflicts.
- Rebased on top of mainline, including the new VDSO changes
- v6: https://lore.kernel.org/r/20251122-tonyk-robust_futex-v6-0-05fea005a0fd@igalia.com
Changes from v5:
- Complete interface rewrite, there are so many changes but the main
ones are the following points
- Array of robust lists now has a static size, allocated once during the
first usage of the list
- Now that the list of robust lists have a fixed size, I removed the
logic of having a command for creating a new index on the list. To
simplify things for everyone, userspace just need to call
set_robust_list2(head, 32-bit/64-bit type, index).
- Created get_robust_list2()
- The new code can be better integrated with the original interface
- v5: https://lore.kernel.org/r/20250626-tonyk-robust_futex-v5-0-179194dbde8f@igalia.com
Feedback is very welcomed!
---
André Almeida (10):
futex: Skip test_futex_robust_unlock() if not supported
futex: Use explicit sizes for compat_robust_list structs
futex: Make exit_robust_list32() unconditionally available for 64-bit kernels
futex: Create set_robust_list2() syscall
futex: Create get_robust_list2() syscall
futex: Wire up set_robust_list2 syscall
futex: Wire up get_robust_list2 syscall
selftests/futex: Expand for set_robust_list2()
selftests/futex: Expand for get_robust_list2()
futex: Use new robust list API internally
arch/alpha/kernel/syscalls/syscall.tbl | 2 +
arch/arm/tools/syscall.tbl | 2 +
arch/m68k/kernel/syscalls/syscall.tbl | 2 +
arch/microblaze/kernel/syscalls/syscall.tbl | 2 +
arch/mips/kernel/syscalls/syscall_n32.tbl | 2 +
arch/mips/kernel/syscalls/syscall_n64.tbl | 2 +
arch/mips/kernel/syscalls/syscall_o32.tbl | 2 +
arch/parisc/kernel/syscalls/syscall.tbl | 2 +
arch/powerpc/kernel/syscalls/syscall.tbl | 2 +
arch/s390/kernel/syscalls/syscall.tbl | 2 +
arch/sh/kernel/syscalls/syscall.tbl | 2 +
arch/sparc/kernel/syscalls/syscall.tbl | 2 +
arch/x86/entry/syscalls/syscall_32.tbl | 2 +
arch/x86/entry/syscalls/syscall_64.tbl | 2 +
arch/xtensa/kernel/syscalls/syscall.tbl | 2 +
include/linux/compat.h | 13 +-
include/linux/futex.h | 24 +
include/linux/futex_types.h | 9 +-
include/uapi/asm-generic/unistd.h | 7 +-
include/uapi/linux/futex.h | 28 +
kernel/futex/core.c | 196 +++++--
kernel/futex/futex.h | 5 +
kernel/futex/syscalls.c | 158 +++++-
kernel/sys_ni.c | 2 +
scripts/syscall.tbl | 2 +
.../selftests/futex/functional/robust_list.c | 626 +++++++++++++++++++--
26 files changed, 976 insertions(+), 124 deletions(-)
---
base-commit: 9f74092fda91ef93c2b07585785c1dc83cd7971f
change-id: 20250225-tonyk-robust_futex-60adeedac695
Best regards,
--
André Almeida <andrealmeid@igalia.com>
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH v8 05/10] futex: Create get_robust_list2() syscall
2026-11-15 17:31 [PATCH v8 00/10] futex: Create {set,get}_robust_list2() syscalls André Almeida
@ 2026-11-15 17:31 ` André Almeida
2026-11-21 0:35 ` kernel test robot
2026-11-21 0:46 ` kernel test robot
0 siblings, 2 replies; 5+ messages in thread
From: André Almeida @ 2026-11-15 17:31 UTC (permalink / raw)
To: Ingo Molnar, Peter Zijlstra, Darren Hart, Davidlohr Bueso,
Arnd Bergmann, Sebastian Andrzej Siewior, Waiman Long,
Ryan Houdek, Thomas Gleixner
Cc: linux-kernel, linux-kselftest, linux-api, kernel-dev,
André Almeida
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` sets with 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` is unused but can be used for expanding the interface
Signed-off-by: André Almeida <andrealmeid@igalia.com>
---
kernel/futex/syscalls.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++---
kernel/sys_ni.c | 1 +
2 files changed, 63 insertions(+), 4 deletions(-)
diff --git a/kernel/futex/syscalls.c b/kernel/futex/syscalls.c
index 48e87b5e4e33..0ecb32afd5e1 100644
--- a/kernel/futex/syscalls.c
+++ b/kernel/futex/syscalls.c
@@ -44,7 +44,7 @@ static inline void __user *futex_task_robust_list(struct task_struct *p, bool co
return p->futex.robust_list;
}
-static void __user *futex_get_robust_list_common(int pid, bool compat)
+static void __user *futex_get_robust_list_common(int pid, bool compat, int index)
{
struct task_struct *p = current;
void __user *head;
@@ -71,7 +71,15 @@ static void __user *futex_get_robust_list_common(int pid, bool compat)
if (!ptrace_may_access(p, PTRACE_MODE_READ_REALCREDS))
goto err_unlock;
- head = futex_task_robust_list(p, compat);
+ if (index >= 0) {
+ scoped_guard(mutex, &p->futex.exit_mutex) {
+ uintptr_t *rl = p->futex.robust_lists;
+
+ head = rl ? (void __user *) rl[index] : NULL;
+ }
+ } else {
+ head = futex_task_robust_list(p, compat);
+ }
up_read(&p->signal->exec_update_lock);
put_task_struct(p);
@@ -95,7 +103,7 @@ SYSCALL_DEFINE3(get_robust_list, int, pid,
struct robust_list_head __user * __user *, head_ptr,
size_t __user *, len_ptr)
{
- struct robust_list_head __user *head = futex_get_robust_list_common(pid, false);
+ struct robust_list_head __user *head = futex_get_robust_list_common(pid, false, -1);
if (IS_ERR(head))
return PTR_ERR(head);
@@ -160,6 +168,56 @@ SYSCALL_DEFINE4(set_robust_list2, struct robust_list_head * __user, head, unsign
return -EINVAL;
}
+SYSCALL_DEFINE4(get_robust_list2, int, pid,
+ void __user * __user *, head_ptr,
+ unsigned int, index, unsigned int, flags)
+{
+ struct robust_list_head *head;
+ void __user *entry_ptr;
+ uintptr_t entry;
+
+ if (index >= FUTEX_ROBUST_LISTS_PER_USER)
+ return -EINVAL;
+
+ if (flags)
+ return -EINVAL;
+
+ /*
+ * The first two indexes are reserved for the kernel to be used with the
+ * legacy syscall, so we hide them from userspace.
+ *
+ * We map [0, FUTEX_ROBUST_LISTS_PER_USER) to
+ * [FUTEX_ROBUST_LIST2_IDX, FUTEX_ROBUST_LIST2_MAX_IDX)
+ */
+ index += FUTEX_ROBUST_LIST2_IDX;
+
+ entry_ptr = futex_get_robust_list_common(pid, false, index);
+ if (IS_ERR(entry_ptr))
+ return PTR_ERR(entry_ptr);
+
+ entry = (uintptr_t) entry_ptr;
+
+ if (futex_in_32bit_syscall()) {
+ u32 entry32;
+
+ if (entry && !(entry & FUTEX_ROBUST_LIST_ENTRY_32BIT))
+ return -EOPNOTSUPP;
+
+ entry32 = (u32)entry;
+ entry32 &= FUTEX_ROBUST_LIST_ENTRY_MASK;
+
+ if (copy_to_user(head_ptr, &entry32, sizeof(entry32)))
+ return -EFAULT;
+
+ return 0;
+ }
+
+ entry &= FUTEX_ROBUST_LIST_ENTRY_MASK;
+ head = (__force struct robust_list_head __user *)entry;
+
+ 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)
{
@@ -548,7 +606,7 @@ COMPAT_SYSCALL_DEFINE3(get_robust_list, int, pid,
compat_uptr_t __user *, head_ptr,
compat_size_t __user *, len_ptr)
{
- struct robust_list_head32 __user *head = futex_get_robust_list_common(pid, true);
+ struct robust_list_head32 __user *head = futex_get_robust_list_common(pid, true, -1);
if (IS_ERR(head))
return PTR_ERR(head);
diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c
index 0bb92b3cb589..d8bbcd87d535 100644
--- a/kernel/sys_ni.c
+++ b/kernel/sys_ni.c
@@ -173,6 +173,7 @@ COND_SYSCALL(lsm_get_self_attr);
COND_SYSCALL(lsm_set_self_attr);
COND_SYSCALL(lsm_list_modules);
COND_SYSCALL(set_robust_list2);
+COND_SYSCALL(get_robust_list2);
/* CONFIG_MMU only */
COND_SYSCALL(swapon);
--
2.56.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH v8 05/10] futex: Create get_robust_list2() syscall
2026-11-15 17:31 ` [PATCH v8 05/10] futex: Create get_robust_list2() syscall André Almeida
@ 2026-11-21 0:35 ` kernel test robot
2026-11-21 0:46 ` kernel test robot
1 sibling, 0 replies; 5+ messages in thread
From: kernel test robot @ 2026-11-21 0:35 UTC (permalink / raw)
To: André Almeida, Ingo Molnar, Peter Zijlstra, Darren Hart,
Davidlohr Bueso, Arnd Bergmann, Sebastian Andrzej Siewior,
Waiman Long, Ryan Houdek, Thomas Gleixner
Cc: oe-kbuild-all, linux-kernel, linux-kselftest, linux-api,
kernel-dev, André Almeida
Hi André,
kernel test robot noticed the following build warnings:
[auto build test WARNING on 9f74092fda91ef93c2b07585785c1dc83cd7971f]
url: https://github.com/intel-lab-lkp/linux/commits/Andr-Almeida/futex-Skip-test_futex_robust_unlock-if-not-supported/20261115-143110
base: 9f74092fda91ef93c2b07585785c1dc83cd7971f
patch link: https://lore.kernel.org/r/20261115-tonyk-robust_futex-v8-5-a4fe47333a28%40igalia.com
patch subject: [PATCH v8 05/10] futex: Create get_robust_list2() syscall
config: arm64-randconfig-r2300-20261120 (https://download.01.org/0day-ci/archive/20261121/20261121013133.eLi73Mpq-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 12.5.0
sparse: v0.6.5-rc1-21-g84ec0658
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261121/20261121013133.eLi73Mpq-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/20261121013133.eLi73Mpq-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
kernel/futex/syscalls.c:119:46: sparse: sparse: dereference of noderef expression
kernel/futex/syscalls.c:216:14: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct robust_list_head *head @@ got struct robust_list_head [noderef] __user * @@
kernel/futex/syscalls.c:216:14: sparse: expected struct robust_list_head *head
kernel/futex/syscalls.c:216:14: sparse: got struct robust_list_head [noderef] __user *
>> kernel/futex/syscalls.c:218:16: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void [noderef] __user *__rpu_val @@ got struct robust_list_head *head @@
kernel/futex/syscalls.c:218:16: sparse: expected void [noderef] __user *__rpu_val
kernel/futex/syscalls.c:218:16: sparse: got struct robust_list_head *head
vim +218 kernel/futex/syscalls.c
170
171 SYSCALL_DEFINE4(get_robust_list2, int, pid,
172 void __user * __user *, head_ptr,
173 unsigned int, index, unsigned int, flags)
174 {
175 struct robust_list_head *head;
176 void __user *entry_ptr;
177 uintptr_t entry;
178
179 if (index >= FUTEX_ROBUST_LISTS_PER_USER)
180 return -EINVAL;
181
182 if (flags)
183 return -EINVAL;
184
185 /*
186 * The first two indexes are reserved for the kernel to be used with the
187 * legacy syscall, so we hide them from userspace.
188 *
189 * We map [0, FUTEX_ROBUST_LISTS_PER_USER) to
190 * [FUTEX_ROBUST_LIST2_IDX, FUTEX_ROBUST_LIST2_MAX_IDX)
191 */
192 index += FUTEX_ROBUST_LIST2_IDX;
193
194 entry_ptr = futex_get_robust_list_common(pid, false, index);
195 if (IS_ERR(entry_ptr))
196 return PTR_ERR(entry_ptr);
197
198 entry = (uintptr_t) entry_ptr;
199
200 if (futex_in_32bit_syscall()) {
201 u32 entry32;
202
203 if (entry && !(entry & FUTEX_ROBUST_LIST_ENTRY_32BIT))
204 return -EOPNOTSUPP;
205
206 entry32 = (u32)entry;
207 entry32 &= FUTEX_ROBUST_LIST_ENTRY_MASK;
208
209 if (copy_to_user(head_ptr, &entry32, sizeof(entry32)))
210 return -EFAULT;
211
212 return 0;
213 }
214
215 entry &= FUTEX_ROBUST_LIST_ENTRY_MASK;
216 head = (__force struct robust_list_head __user *)entry;
217
> 218 return put_user(head, head_ptr);
219 }
220
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v8 05/10] futex: Create get_robust_list2() syscall
2026-11-15 17:31 ` [PATCH v8 05/10] futex: Create get_robust_list2() syscall André Almeida
2026-11-21 0:35 ` kernel test robot
@ 2026-11-21 0:46 ` kernel test robot
1 sibling, 0 replies; 5+ messages in thread
From: kernel test robot @ 2026-11-21 0:46 UTC (permalink / raw)
To: André Almeida, Ingo Molnar, Peter Zijlstra, Darren Hart,
Davidlohr Bueso, Arnd Bergmann, Sebastian Andrzej Siewior,
Waiman Long, Ryan Houdek, Thomas Gleixner
Cc: oe-kbuild-all, linux-kernel, linux-kselftest, linux-api,
kernel-dev, André Almeida
Hi André,
kernel test robot noticed the following build warnings:
[auto build test WARNING on 9f74092fda91ef93c2b07585785c1dc83cd7971f]
url: https://github.com/intel-lab-lkp/linux/commits/Andr-Almeida/futex-Skip-test_futex_robust_unlock-if-not-supported/20261115-143110
base: 9f74092fda91ef93c2b07585785c1dc83cd7971f
patch link: https://lore.kernel.org/r/20261115-tonyk-robust_futex-v8-5-a4fe47333a28%40igalia.com
patch subject: [PATCH v8 05/10] futex: Create get_robust_list2() syscall
config: loongarch-randconfig-r2311-20261120 (https://download.01.org/0day-ci/archive/20261121/20261121013854.0hhfuC97-lkp@intel.com/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project 8db60b003f961f25c5cafe91ee44176f61374279)
sparse: v0.6.5-rc1-21-g84ec0658
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261121/20261121013854.0hhfuC97-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/20261121013854.0hhfuC97-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
kernel/futex/syscalls.c:119:46: sparse: sparse: dereference of noderef expression
kernel/futex/syscalls.c:216:14: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct robust_list_head *head @@ got struct robust_list_head [noderef] __user * @@
kernel/futex/syscalls.c:216:14: sparse: expected struct robust_list_head *head
kernel/futex/syscalls.c:216:14: sparse: got struct robust_list_head [noderef] __user *
>> kernel/futex/syscalls.c:218:16: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void [noderef] __user *__pu_val @@ got struct robust_list_head *head @@
kernel/futex/syscalls.c:218:16: sparse: expected void [noderef] __user *__pu_val
kernel/futex/syscalls.c:218:16: sparse: got struct robust_list_head *head
vim +218 kernel/futex/syscalls.c
170
171 SYSCALL_DEFINE4(get_robust_list2, int, pid,
172 void __user * __user *, head_ptr,
173 unsigned int, index, unsigned int, flags)
174 {
175 struct robust_list_head *head;
176 void __user *entry_ptr;
177 uintptr_t entry;
178
179 if (index >= FUTEX_ROBUST_LISTS_PER_USER)
180 return -EINVAL;
181
182 if (flags)
183 return -EINVAL;
184
185 /*
186 * The first two indexes are reserved for the kernel to be used with the
187 * legacy syscall, so we hide them from userspace.
188 *
189 * We map [0, FUTEX_ROBUST_LISTS_PER_USER) to
190 * [FUTEX_ROBUST_LIST2_IDX, FUTEX_ROBUST_LIST2_MAX_IDX)
191 */
192 index += FUTEX_ROBUST_LIST2_IDX;
193
194 entry_ptr = futex_get_robust_list_common(pid, false, index);
195 if (IS_ERR(entry_ptr))
196 return PTR_ERR(entry_ptr);
197
198 entry = (uintptr_t) entry_ptr;
199
200 if (futex_in_32bit_syscall()) {
201 u32 entry32;
202
203 if (entry && !(entry & FUTEX_ROBUST_LIST_ENTRY_32BIT))
204 return -EOPNOTSUPP;
205
206 entry32 = (u32)entry;
207 entry32 &= FUTEX_ROBUST_LIST_ENTRY_MASK;
208
209 if (copy_to_user(head_ptr, &entry32, sizeof(entry32)))
210 return -EFAULT;
211
212 return 0;
213 }
214
215 entry &= FUTEX_ROBUST_LIST_ENTRY_MASK;
216 head = (__force struct robust_list_head __user *)entry;
217
> 218 return put_user(head, head_ptr);
219 }
220
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-11-21 4:29 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-21 4:29 [PATCH v8 05/10] futex: Create get_robust_list2() syscall kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2026-11-21 1:17 kernel test robot
2026-11-15 17:31 [PATCH v8 00/10] futex: Create {set,get}_robust_list2() syscalls André Almeida
2026-11-15 17:31 ` [PATCH v8 05/10] futex: Create get_robust_list2() syscall André Almeida
2026-11-21 0:35 ` kernel test robot
2026-11-21 0:46 ` kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.