Re: [PATCH v2] futex: don't leak robust_list pointer on exec race
From: kernel test robot
Date: Tue Aug 05 2025 - 14:28:22 EST
Hi Pranav,
kernel test robot noticed the following build warnings:
[auto build test WARNING on tip/locking/core]
[also build test WARNING on linus/master v6.16 next-20250805]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Pranav-Tyagi/futex-don-t-leak-robust_list-pointer-on-exec-race/20250804-195739
base: tip/locking/core
patch link: https://lore.kernel.org/r/20250804115533.14186-1-pranav.tyagi03%40gmail.com
patch subject: [PATCH v2] futex: don't leak robust_list pointer on exec race
config: x86_64-randconfig-r132-20250805 (https://download.01.org/0day-ci/archive/20250806/202508060225.urZa7B2V-lkp@xxxxxxxxx/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250806/202508060225.urZa7B2V-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202508060225.urZa7B2V-lkp@xxxxxxxxx/
sparse warnings: (new ones prefixed by >>)
>> kernel/futex/syscalls.c:64:39: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected void [noderef] __user * @@ got void * @@
kernel/futex/syscalls.c:64:39: sparse: expected void [noderef] __user *
kernel/futex/syscalls.c:64:39: sparse: got void *
kernel/futex/syscalls.c:94:23: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected void [noderef] __user * @@ got void * @@
kernel/futex/syscalls.c:94:23: sparse: expected void [noderef] __user *
kernel/futex/syscalls.c:94:23: sparse: got void *
vim +64 kernel/futex/syscalls.c
41
42 static void __user *get_robust_list_common(int pid,
43 bool compat)
44 {
45 void __user *head;
46 unsigned long ret;
47
48 struct task_struct *p;
49
50 if (!pid) {
51 p = current;
52 get_task_struct(p);
53 } else {
54 rcu_read_lock();
55 p = find_task_by_vpid(pid);
56 /*
57 * pin the task to permit dropping the RCU read lock before
58 * acquiring the semaphore
59 */
60 if (p)
61 get_task_struct(p);
62 rcu_read_unlock();
63 if (!p)
> 64 return ERR_PTR(-ESRCH);
65 }
66
67 /*
68 * Hold exec_update_lock to serialize with concurrent exec()
69 * so ptrace_may_access() is checked against stable credentials
70 */
71
72 ret = down_read_killable(&p->signal->exec_update_lock);
73 if (ret)
74 goto err_put;
75
76 ret = -EPERM;
77 if (!ptrace_may_access(p, PTRACE_MODE_READ_REALCREDS))
78 goto err_unlock;
79
80 if (compat)
81 head = p->compat_robust_list;
82 else
83 head = p->robust_list;
84
85 up_read(&p->signal->exec_update_lock);
86 put_task_struct(p);
87
88 return head;
89
90 err_unlock:
91 up_read(&p->signal->exec_update_lock);
92 err_put:
93 put_task_struct(p);
94 return ERR_PTR(ret);
95 }
96
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki