All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v9 05/14] futex: Create exit_robust_lists() for multi-robust list
  2026-12-04 16:15 [PATCH v9 00/14] futex: Create {set,get}_robust_list2() syscalls André Almeida
@ 2026-12-04 16:15 ` André Almeida
  2026-12-05  9:55   ` kernel test robot
  0 siblings, 1 reply; 4+ messages in thread
From: André Almeida @ 2026-12-04 16:15 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Darren Hart, Davidlohr Bueso,
	Arnd Bergmann, Sebastian Andrzej Siewior, Waiman Long,
	Ryan Houdek, Florian Weimer, Thomas Gleixner
  Cc: linux-kernel, linux-kselftest, linux-api, kernel-dev, libc-coord,
	André Almeida

Create function exit_robust_lists() to process task's list of robust lists.
This function processes an array of robust list heads and call the
appropriate function to deal with it, according to the pointer size. The
low bit of each entry indicates whether the list is 32-bit.

Giving that the current syscalls don't use the multi-list array, this
introduction is a no-op and futex::robust_lists is always empty.

Signed-off-by: André Almeida <andrealmeid@igalia.com>
---
 kernel/futex/core.c  | 35 +++++++++++++++++++++++++++++++++++
 kernel/futex/futex.h |  6 ++++++
 2 files changed, 41 insertions(+)

diff --git a/kernel/futex/core.c b/kernel/futex/core.c
index dc5b6379060e..d15906f3c80c 100644
--- a/kernel/futex/core.c
+++ b/kernel/futex/core.c
@@ -1477,8 +1477,43 @@ void __futex_fixup_robust_unlock(struct pt_regs *regs, struct futex_unlock_cs_ra
 }
 #endif /* CONFIG_FUTEX_ROBUST_UNLOCK */
 
+static void exit_robust_lists(struct task_struct *tsk)
+{
+	uintptr_t *rl = tsk->futex.robust_lists;
+	unsigned int idx;
+
+	if (!rl)
+		return;
+
+	tsk->futex.robust_lists = NULL;
+
+	for (idx = 0; idx < FUTEX_ROBUST_LIST2_MAX_IDX; idx++) {
+		uintptr_t entry = rl[idx] & FUTEX_ROBUST_LIST2_ENTRY_MASK;
+
+		if (!entry)
+			continue;
+
+		if (IS_ENABLED(CONFIG_64BIT) && (rl[idx] & FUTEX_ROBUST_LIST2_ENTRY_32BIT)) {
+			struct robust_list_head32 __user *head;
+
+			head = (__force struct robust_list_head32 __user *)entry;
+			exit_robust_list32(tsk, head);
+		} else {
+			struct robust_list_head __user *head;
+
+			head = (__force struct robust_list_head __user *)entry;
+			exit_robust_list(tsk, head);
+		}
+	}
+
+	kfree(rl);
+}
+
 static void futex_cleanup(struct task_struct *tsk)
 {
+	if (unlikely(tsk->futex.robust_lists))
+		exit_robust_lists(tsk);
+
 	if (unlikely(tsk->futex.robust_list)) {
 		exit_robust_list(tsk, tsk->futex.robust_list);
 		tsk->futex.robust_list = NULL;
diff --git a/kernel/futex/futex.h b/kernel/futex/futex.h
index bd552a1ce5f6..c1da53fd7187 100644
--- a/kernel/futex/futex.h
+++ b/kernel/futex/futex.h
@@ -49,6 +49,12 @@
 #define FUTEX_ROBUST_LIST2_PER_USER	8
 #define FUTEX_ROBUST_LIST2_MAX_IDX	(FUTEX_ROBUST_LIST2_IDX + FUTEX_ROBUST_LIST2_PER_USER)
 
+/*
+ * List entries without _32BIT flag are using the native machine size
+ */
+#define FUTEX_ROBUST_LIST2_ENTRY_32BIT	0x1UL
+#define FUTEX_ROBUST_LIST2_ENTRY_MASK	(~(uintptr_t)FUTEX_ROBUST_LIST2_ENTRY_32BIT)
+
 /* FUTEX_ to FLAGS_ */
 static inline unsigned int futex_to_flags(unsigned int op)
 {

-- 
2.56.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v9 05/14] futex: Create exit_robust_lists() for multi-robust list
  2026-12-04 16:15 ` [PATCH v9 05/14] futex: Create exit_robust_lists() for multi-robust list André Almeida
@ 2026-12-05  9:55   ` kernel test robot
  0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2026-12-05  9:55 UTC (permalink / raw)
  To: André Almeida, Ingo Molnar, Peter Zijlstra, Darren Hart,
	Davidlohr Bueso, Arnd Bergmann, Sebastian Andrzej Siewior,
	Waiman Long, Ryan Houdek, Florian Weimer, Thomas Gleixner
  Cc: oe-kbuild-all, linux-kernel, linux-kselftest, linux-api,
	kernel-dev, libc-coord, André Almeida

Hi André,

kernel test robot noticed the following build errors:

[auto build test ERROR on 39cc4e512ebcd2a6d106d710285040a4e43c2dd9]

url:    https://github.com/intel-lab-lkp/linux/commits/Andr-Almeida/futex-Use-explicit-sizes-for-compat_robust_list-structs/20261204-131517
base:   39cc4e512ebcd2a6d106d710285040a4e43c2dd9
patch link:    https://lore.kernel.org/r/20261204-tonyk-robust_futex-v9-5-743d68d488b5%40igalia.com
patch subject: [PATCH v9 05/14] futex: Create exit_robust_lists() for multi-robust list
config: openrisc-defconfig (https://download.01.org/0day-ci/archive/20261205/20261205041736.L8DSYdGV-lkp@intel.com/config)
compiler: or1k-linux-gcc (GCC) 16.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261205/20261205041736.L8DSYdGV-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/20261205041736.L8DSYdGV-lkp@intel.com/

All errors (new ones prefixed by >>):

   kernel/futex/core.c: In function 'exit_robust_lists':
>> kernel/futex/core.c:1500:25: error: implicit declaration of function 'exit_robust_list32'; did you mean 'exit_robust_lists'? [-Wimplicit-function-declaration]
    1500 |                         exit_robust_list32(tsk, head);
         |                         ^~~~~~~~~~~~~~~~~~
         |                         exit_robust_lists


vim +1500 kernel/futex/core.c

  1479	
  1480	static void exit_robust_lists(struct task_struct *tsk)
  1481	{
  1482		uintptr_t *rl = tsk->futex.robust_lists;
  1483		unsigned int idx;
  1484	
  1485		if (!rl)
  1486			return;
  1487	
  1488		tsk->futex.robust_lists = NULL;
  1489	
  1490		for (idx = 0; idx < FUTEX_ROBUST_LIST2_MAX_IDX; idx++) {
  1491			uintptr_t entry = rl[idx] & FUTEX_ROBUST_LIST2_ENTRY_MASK;
  1492	
  1493			if (!entry)
  1494				continue;
  1495	
  1496			if (IS_ENABLED(CONFIG_64BIT) && (rl[idx] & FUTEX_ROBUST_LIST2_ENTRY_32BIT)) {
  1497				struct robust_list_head32 __user *head;
  1498	
  1499				head = (__force struct robust_list_head32 __user *)entry;
> 1500				exit_robust_list32(tsk, head);
  1501			} else {
  1502				struct robust_list_head __user *head;
  1503	
  1504				head = (__force struct robust_list_head __user *)entry;
  1505				exit_robust_list(tsk, head);
  1506			}
  1507		}
  1508	
  1509		kfree(rl);
  1510	}
  1511	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v9 05/14] futex: Create exit_robust_lists() for multi-robust list
@ 2026-12-05  9:55 kernel test robot
  0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2026-12-05  9:55 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp

:::::: 
:::::: Manual check reason: "same reports for this branch"
:::::: 

BCC: lkp@intel.com
CC: llvm@lists.linux.dev
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20261204-tonyk-robust_futex-v9-5-743d68d488b5@igalia.com>
References: <20261204-tonyk-robust_futex-v9-5-743d68d488b5@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: Florian Weimer <fweimer@redhat.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: libc-coord@lists.openwall.com
CC: "André Almeida" <andrealmeid@igalia.com>

Hi André,

kernel test robot noticed the following build errors:

[auto build test ERROR on 39cc4e512ebcd2a6d106d710285040a4e43c2dd9]

url:    https://github.com/intel-lab-lkp/linux/commits/Andr-Almeida/futex-Use-explicit-sizes-for-compat_robust_list-structs/20261204-131517
base:   39cc4e512ebcd2a6d106d710285040a4e43c2dd9
patch link:    https://lore.kernel.org/r/20261204-tonyk-robust_futex-v9-5-743d68d488b5%40igalia.com
patch subject: [PATCH v9 05/14] futex: Create exit_robust_lists() for multi-robust list
:::::: branch date: 6 hours ago
:::::: commit date: 6 hours ago
config: hexagon-defconfig (https://download.01.org/0day-ci/archive/20261205/20261205060307.npUP8f8x-lkp@intel.com/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project 63b30c97f6082ebf34b31bdd81bb50df7672b67b)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261205/20261205060307.npUP8f8x-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/20261205060307.npUP8f8x-lkp@intel.com/

All errors (new ones prefixed by >>):

>> kernel/futex/core.c:1500:4: error: call to undeclared function 'exit_robust_list32'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    1500 |                         exit_robust_list32(tsk, head);
         |                         ^
   1 error generated.


vim +/exit_robust_list32 +1500 kernel/futex/core.c

7010c39d8fc5063 Thomas Gleixner 2026-06-02  1479  
53323289ae96226 André Almeida   2026-12-04  1480  static void exit_robust_lists(struct task_struct *tsk)
53323289ae96226 André Almeida   2026-12-04  1481  {
53323289ae96226 André Almeida   2026-12-04  1482  	uintptr_t *rl = tsk->futex.robust_lists;
53323289ae96226 André Almeida   2026-12-04  1483  	unsigned int idx;
53323289ae96226 André Almeida   2026-12-04  1484  
53323289ae96226 André Almeida   2026-12-04  1485  	if (!rl)
53323289ae96226 André Almeida   2026-12-04  1486  		return;
53323289ae96226 André Almeida   2026-12-04  1487  
53323289ae96226 André Almeida   2026-12-04  1488  	tsk->futex.robust_lists = NULL;
53323289ae96226 André Almeida   2026-12-04  1489  
53323289ae96226 André Almeida   2026-12-04  1490  	for (idx = 0; idx < FUTEX_ROBUST_LIST2_MAX_IDX; idx++) {
53323289ae96226 André Almeida   2026-12-04  1491  		uintptr_t entry = rl[idx] & FUTEX_ROBUST_LIST2_ENTRY_MASK;
53323289ae96226 André Almeida   2026-12-04  1492  
53323289ae96226 André Almeida   2026-12-04  1493  		if (!entry)
53323289ae96226 André Almeida   2026-12-04  1494  			continue;
53323289ae96226 André Almeida   2026-12-04  1495  
53323289ae96226 André Almeida   2026-12-04  1496  		if (IS_ENABLED(CONFIG_64BIT) && (rl[idx] & FUTEX_ROBUST_LIST2_ENTRY_32BIT)) {
53323289ae96226 André Almeida   2026-12-04  1497  			struct robust_list_head32 __user *head;
53323289ae96226 André Almeida   2026-12-04  1498  
53323289ae96226 André Almeida   2026-12-04  1499  			head = (__force struct robust_list_head32 __user *)entry;
53323289ae96226 André Almeida   2026-12-04 @1500  			exit_robust_list32(tsk, head);
53323289ae96226 André Almeida   2026-12-04  1501  		} else {
53323289ae96226 André Almeida   2026-12-04  1502  			struct robust_list_head __user *head;
53323289ae96226 André Almeida   2026-12-04  1503  
53323289ae96226 André Almeida   2026-12-04  1504  			head = (__force struct robust_list_head __user *)entry;
53323289ae96226 André Almeida   2026-12-04  1505  			exit_robust_list(tsk, head);
53323289ae96226 André Almeida   2026-12-04  1506  		}
53323289ae96226 André Almeida   2026-12-04  1507  	}
53323289ae96226 André Almeida   2026-12-04  1508  
53323289ae96226 André Almeida   2026-12-04  1509  	kfree(rl);
53323289ae96226 André Almeida   2026-12-04  1510  }
53323289ae96226 André Almeida   2026-12-04  1511  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v9 05/14] futex: Create exit_robust_lists() for multi-robust list
@ 2026-12-05  9:55 kernel test robot
  0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2026-12-05  9:55 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: <20261204-tonyk-robust_futex-v9-5-743d68d488b5@igalia.com>
References: <20261204-tonyk-robust_futex-v9-5-743d68d488b5@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: Florian Weimer <fweimer@redhat.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: libc-coord@lists.openwall.com
CC: "André Almeida" <andrealmeid@igalia.com>

Hi André,

kernel test robot noticed the following build errors:

[auto build test ERROR on 39cc4e512ebcd2a6d106d710285040a4e43c2dd9]

url:    https://github.com/intel-lab-lkp/linux/commits/Andr-Almeida/futex-Use-explicit-sizes-for-compat_robust_list-structs/20261204-131517
base:   39cc4e512ebcd2a6d106d710285040a4e43c2dd9
patch link:    https://lore.kernel.org/r/20261204-tonyk-robust_futex-v9-5-743d68d488b5%40igalia.com
patch subject: [PATCH v9 05/14] futex: Create exit_robust_lists() for multi-robust list
:::::: branch date: 13 hours ago
:::::: commit date: 13 hours ago
config: m68k-allnoconfig (https://download.01.org/0day-ci/archive/20261205/20261205133947.C1FYsKQx-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 16.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261205/20261205133947.C1FYsKQx-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/20261205133947.C1FYsKQx-lkp@intel.com/

All errors (new ones prefixed by >>):

   kernel/futex/core.c: In function 'exit_robust_lists':
>> kernel/futex/core.c:1500:25: error: implicit declaration of function 'exit_robust_list32'; did you mean 'exit_robust_lists'? [-Wimplicit-function-declaration]
    1500 |                         exit_robust_list32(tsk, head);
         |                         ^~~~~~~~~~~~~~~~~~
         |                         exit_robust_lists


vim +1500 kernel/futex/core.c

7010c39d8fc506 Thomas Gleixner 2026-06-02  1479  
53323289ae9622 André Almeida   2026-12-04  1480  static void exit_robust_lists(struct task_struct *tsk)
53323289ae9622 André Almeida   2026-12-04  1481  {
53323289ae9622 André Almeida   2026-12-04  1482  	uintptr_t *rl = tsk->futex.robust_lists;
53323289ae9622 André Almeida   2026-12-04  1483  	unsigned int idx;
53323289ae9622 André Almeida   2026-12-04  1484  
53323289ae9622 André Almeida   2026-12-04  1485  	if (!rl)
53323289ae9622 André Almeida   2026-12-04  1486  		return;
53323289ae9622 André Almeida   2026-12-04  1487  
53323289ae9622 André Almeida   2026-12-04  1488  	tsk->futex.robust_lists = NULL;
53323289ae9622 André Almeida   2026-12-04  1489  
53323289ae9622 André Almeida   2026-12-04  1490  	for (idx = 0; idx < FUTEX_ROBUST_LIST2_MAX_IDX; idx++) {
53323289ae9622 André Almeida   2026-12-04  1491  		uintptr_t entry = rl[idx] & FUTEX_ROBUST_LIST2_ENTRY_MASK;
53323289ae9622 André Almeida   2026-12-04  1492  
53323289ae9622 André Almeida   2026-12-04  1493  		if (!entry)
53323289ae9622 André Almeida   2026-12-04  1494  			continue;
53323289ae9622 André Almeida   2026-12-04  1495  
53323289ae9622 André Almeida   2026-12-04  1496  		if (IS_ENABLED(CONFIG_64BIT) && (rl[idx] & FUTEX_ROBUST_LIST2_ENTRY_32BIT)) {
53323289ae9622 André Almeida   2026-12-04  1497  			struct robust_list_head32 __user *head;
53323289ae9622 André Almeida   2026-12-04  1498  
53323289ae9622 André Almeida   2026-12-04  1499  			head = (__force struct robust_list_head32 __user *)entry;
53323289ae9622 André Almeida   2026-12-04 @1500  			exit_robust_list32(tsk, head);
53323289ae9622 André Almeida   2026-12-04  1501  		} else {
53323289ae9622 André Almeida   2026-12-04  1502  			struct robust_list_head __user *head;
53323289ae9622 André Almeida   2026-12-04  1503  
53323289ae9622 André Almeida   2026-12-04  1504  			head = (__force struct robust_list_head __user *)entry;
53323289ae9622 André Almeida   2026-12-04  1505  			exit_robust_list(tsk, head);
53323289ae9622 André Almeida   2026-12-04  1506  		}
53323289ae9622 André Almeida   2026-12-04  1507  	}
53323289ae9622 André Almeida   2026-12-04  1508  
53323289ae9622 André Almeida   2026-12-04  1509  	kfree(rl);
53323289ae9622 André Almeida   2026-12-04  1510  }
53323289ae9622 André Almeida   2026-12-04  1511  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-12-05  9:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-05  9:55 [PATCH v9 05/14] futex: Create exit_robust_lists() for multi-robust list kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2026-12-05  9:55 kernel test robot
2026-12-04 16:15 [PATCH v9 00/14] futex: Create {set,get}_robust_list2() syscalls André Almeida
2026-12-04 16:15 ` [PATCH v9 05/14] futex: Create exit_robust_lists() for multi-robust list André Almeida
2026-12-05  9:55   ` 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.