[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240813234755.3615697-1-maze@google.com>
Date: Tue, 13 Aug 2024 16:47:55 -0700
From: "Maciej Żenczykowski" <maze@...gle.com>
To: "Maciej Żenczykowski" <zenczykowski@...il.com>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"Maciej Żenczykowski" <maze@...gle.com>, Richard Weinberger <richard@....at>,
Anton Ivanov <anton.ivanov@...bridgegreys.com>, Johannes Berg <johannes@...solutions.net>,
linux-um@...ts.infradead.org
Subject: [PATCH] um: make personality(PER_LINUX32) work on x86_64
Without this patch:
#!/usr/bin/python3
import ctypes
import os
personality = ctypes.CDLL(None).personality
personality.restype = ctypes.c_int
personality.argtypes = [ctypes.c_ulong]
PER_LINUX32=8
personality(PER_LINUX32)
print(os.uname().machine)
returns:
x86_64
instead of the desired:
i686
Cc: Richard Weinberger <richard@....at>
Cc: Anton Ivanov <anton.ivanov@...bridgegreys.com>
Cc: Johannes Berg <johannes@...solutions.net>
Cc: linux-um@...ts.infradead.org
Signed-off-by: Maciej Żenczykowski <maze@...gle.com>
---
arch/um/include/asm/Kbuild | 1 -
arch/um/include/asm/compat.h | 12 ++++++++++++
2 files changed, 12 insertions(+), 1 deletion(-)
create mode 100644 arch/um/include/asm/compat.h
diff --git a/arch/um/include/asm/Kbuild b/arch/um/include/asm/Kbuild
index b2d834a29f3a..0b961dd089ab 100644
--- a/arch/um/include/asm/Kbuild
+++ b/arch/um/include/asm/Kbuild
@@ -1,7 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
generic-y += bpf_perf_event.h
generic-y += bug.h
-generic-y += compat.h
generic-y += current.h
generic-y += device.h
generic-y += dma-mapping.h
diff --git a/arch/um/include/asm/compat.h b/arch/um/include/asm/compat.h
new file mode 100644
index 000000000000..110319031dcf
--- /dev/null
+++ b/arch/um/include/asm/compat.h
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __UM_COMPAT_H
+#define __UM_COMPAT_H
+
+#include <asm-generic/compat.h>
+
+#if defined(CONFIG_UML_X86) && defined(CONFIG_64BIT)
+/* From arch/x86/include/asm/compat.h */
+#define COMPAT_UTS_MACHINE "i686\0\0"
+#endif
+
+#endif
--
2.46.0.76.ge559c4bf1a-goog
Powered by blists - more mailing lists