From: "Maciej Żenczykowski" <maze@google.com>
To: "Maciej Żenczykowski" <zenczykowski@gmail.com>
Cc: "Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
"Maciej Żenczykowski" <maze@google.com>,
"Richard Weinberger" <richard@nod.at>,
"Anton Ivanov" <anton.ivanov@cambridgegreys.com>,
"Johannes Berg" <johannes@sipsolutions.net>,
linux-um@lists.infradead.org
Subject: [PATCH] um: make personality(PER_LINUX32) work on x86_64
Date: Tue, 13 Aug 2024 16:47:55 -0700 [thread overview]
Message-ID: <20240813234755.3615697-1-maze@google.com> (raw)
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@nod.at>
Cc: Anton Ivanov <anton.ivanov@cambridgegreys.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-um@lists.infradead.org
Signed-off-by: Maciej Żenczykowski <maze@google.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
next reply other threads:[~2024-08-13 23:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-13 23:47 Maciej Żenczykowski [this message]
2024-08-19 12:23 ` [PATCH] um: make personality(PER_LINUX32) work on x86_64 Johannes Berg
2024-08-19 18:46 ` Maciej Żenczykowski
2024-08-28 12:58 ` Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240813234755.3615697-1-maze@google.com \
--to=maze@google.com \
--cc=anton.ivanov@cambridgegreys.com \
--cc=johannes@sipsolutions.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-um@lists.infradead.org \
--cc=richard@nod.at \
--cc=zenczykowski@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox