[RFC PATCH 2/2] futex: hack: Add debug delays
From: André Almeida
Date: Fri Feb 20 2026 - 15:27:56 EST
Add delays to handle_futex_death() to increase the chance of hitting the race
condition.
Signed-off-by: André Almeida <andrealmeid@xxxxxxxxxx>
---
kernel/futex/core.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/kernel/futex/core.c b/kernel/futex/core.c
index cf7e610eac42..d409b3368cb3 100644
--- a/kernel/futex/core.c
+++ b/kernel/futex/core.c
@@ -44,6 +44,7 @@
#include <linux/prctl.h>
#include <linux/mempolicy.h>
#include <linux/mmap_lock.h>
+#include <linux/delay.h>
#include "futex.h"
#include "../locking/rtmutex_common.h"
@@ -1095,6 +1096,12 @@ static int handle_futex_death(u32 __user *uaddr, struct task_struct *curr,
* does not guarantee R/W access. If that fails we
* give up and leave the futex locked.
*/
+
+ if (!strcmp(current->comm, "robust_bug")) {
+ printk("robust_bug is exiting\n");
+ msleep(500);
+ }
+
if ((err = futex_cmpxchg_value_locked(&nval, uaddr, uval, mval))) {
switch (err) {
case -EFAULT:
@@ -1112,6 +1119,9 @@ static int handle_futex_death(u32 __user *uaddr, struct task_struct *curr,
}
}
+ if (!strcmp(current->comm, "robust_bug"))
+ printk("memory written\n");
+
if (nval != uval)
goto retry;
--
2.53.0