Skip to contentSkip to conversation

um: add a UML specific futex implementation

PATCH New [email protected] 1 participant 1 message Nov 13, 2020 User-mode Linux (UML)

lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH v3 1/1 um: add a UML specific futex implementation

From: Anton Ivanov <[email protected]>

The generic asm futex implementation emulates atomic access to memory by doing a get_user followed by put_user. These translate to two mapping operations on UML with paging enabled in the meantime. This, in turn may end up changing interrupts, invoking the signal loop, etc.

This replaces the generic implementation by a mapping followed by an operation on the mapped segment. It is for now limited to 64 bit as the 32 bit may also need to take care of highmem, etc.

---
 arch/um/include/asm/Kbuild    |   1 -
 arch/um/include/asm/futex.h   |  20 ++++++
 arch/um/kernel/skas/uaccess.c | 119 ++++++++++++++++++++++++++++++++++
 3 files changed, 139 insertions(+), 1 deletion(-)
 create mode 100644 arch/um/include/asm/futex.h
arch/um/include/asm/Kbuild +0 -1
index 1c63b260ecc4..873e6815bc50 100644
@@ -8,7 +8,6 @@ generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
 generic-y += ftrace.h
-generic-y += futex.h
 generic-y += hw_irq.h
 generic-y += irq_regs.h
 generic-y += irq_work.h
arch/um/include/asm/futex.h new file +20 -0
new file mode 100644
index 000000000000..9af35ab66b6e
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ASM_GENERIC_FUTEX_H
+#define _ASM_GENERIC_FUTEX_H
+
+#ifdef CONFIG_64BIT
+
+#include <linux/futex.h>
+#include <linux/uaccess.h>
+#include <asm/errno.h>
+
+
+extern int arch_futex_atomic_op_inuser(int op, u32 oparg, int *oval, u32 __user *uaddr);
+extern int futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
+			      u32 oldval, u32 newval);
+
+#else
+#include <"asm-generic/futex.h">
+#endif /* CONFIG_64BIT */
+
+#endif
arch/um/kernel/skas/uaccess.c +119 -0

128 lines not on this page · raw message

Signature · 7 lines
2.20.1


_______________________________________________
linux-um mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-um