Fwd: [PATCH] [RFC] UAPI: Add QEMU linux-user emulation flag

Helge Deller <[email protected]>
Newsgroups org.kernel.vger.linux-parisc
Message-ID <[email protected]>
-------- Forwarded Message --------
Subject: [PATCH] [RFC] UAPI: Add QEMU linux-user emulation flag
Date: Fri, 31 Jul 2026 17:09:49 +0200
From: Helge Deller <[email protected]>
To: Christoph Hellwig <[email protected]>, [email protected], [email protected], [email protected]
CC: [email protected]

From: Helge Deller <[email protected]>

For some userspace applications it's useful to know if they currently
run on QEMU's linux-user emulation. Such programs are for example the
LTP testsuite, which could avoid testing specific testcases, or systemd
which should avoid use of specific syscalls.

This RFC is about adding a QEMU_LINUX_USER flag to the personality()
syscall which would be injected by qemu-user binary.
Applications may then call personality(-1), and check the
QEMU_LINUX_USER flag to determine if they are running on qemu-user.
Adding this flag seems for me to be the least invasive change. No
changes to uname strings which would need to be parsed or other
modifications to the emulation.

As this patch is just an RFC, maybe people come up with other ideas?

Signed-off-by: Helge Deller <[email protected]>
---
  include/uapi/linux/personality.h | 1 +
  1 file changed, 1 insertion(+)

diff --git a/include/uapi/linux/personality.h b/include/uapi/linux/personality.h
index 243f5f80a7b8..ba6ddaef8954 100644
--- a/include/uapi/linux/personality.h
+++ b/include/uapi/linux/personality.h
@@ -9,6 +9,7 @@
   * These occupy the top three bytes.
   */
  enum {
+	QEMU_LINUX_USER =	0x0010000,	/* Qemu linux-user emulation */
  	UNAME26	=               0x0020000,
  	ADDR_NO_RANDOMIZE = 	0x0040000,	/* disable randomization of VA space */
  	FDPIC_FUNCPTRS =	0x0080000,	/* userspace function ptrs point to descriptors
-- 
2.54.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.