summary refs log tree commit diff stats
path: root/gitlab/issues/target_sparc/host_missing/accel_missing/1394.toml
diff options
context:
space:
mode:
Diffstat (limited to 'gitlab/issues/target_sparc/host_missing/accel_missing/1394.toml')
-rw-r--r--gitlab/issues/target_sparc/host_missing/accel_missing/1394.toml69
1 files changed, 69 insertions, 0 deletions
diff --git a/gitlab/issues/target_sparc/host_missing/accel_missing/1394.toml b/gitlab/issues/target_sparc/host_missing/accel_missing/1394.toml
new file mode 100644
index 000000000..c0ef72f40
--- /dev/null
+++ b/gitlab/issues/target_sparc/host_missing/accel_missing/1394.toml
@@ -0,0 +1,69 @@
+id = 1394
+title = "Byte-swapping issue in getresuid on qemu-user-sparc64"
+state = "closed"
+created_at = "2022-12-25T13:24:39.830Z"
+closed_at = "2023-03-31T11:59:20.559Z"
+labels = ["TestCase", "linux-user", "target: sparc"]
+url = "https://gitlab.com/qemu-project/qemu/-/issues/1394"
+host-os = "Debian bookworm/sid"
+host-arch = "x86_64"
+qemu-version = "qemu-sparc64 version 7.1.0 (Debian 1:7.1+dfsg-2+b3)"
+guest-os = "Debian sid"
+guest-arch = "sparc64"
+description = """When calling getresuid() in the big-endian sparc64 guest, the uid_t values are written with their 16-bit halves reversed.
+
+For example, the UID 0x000003e8 (1000) becomes 0x03e80000."""
+reproduce = """A minimal test case looks like this:
+```c
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <sys/types.h>
+#include <pwd.h>
+#include <unistd.h>
+
+int main(int argc, char **argv) {
+\tstruct passwd *pw = getpwuid(geteuid());
+\tif (pw == NULL) {
+\t\tperror("getpwuid failure");
+\t\treturn 1;
+\t}
+\tprintf("getpwuid()->pw_uid=0x%08x\\n", pw->pw_uid);
+
+\tuid_t ruid = 0, euid = 0, suid = 0;
+\tif (getresuid(&ruid, &euid, &suid) != 0) {
+\t\tperror("getresuid failure");
+\t\treturn 1;
+\t}
+\tprintf("getresuid()->suid=0x%08x\\n", suid);
+
+\treturn 0;
+}
+```
+
+Compile and run with:
+```
+$ sparc64-linux-gnu-gcc -Wall -O0 -g -o sid-sparc64/test test.c
+$ sudo chroot sid-sparc64
+[chroot] $ qemu-sparc64-static ./test
+```
+
+Alternatively, static compilation without a chroot is also possible (despite a warning about `getpwuid()`):
+```
+$ sparc64-linux-gnu-gcc -static -Wall -O0 -g -o test test.c
+$ qemu-sparc64-static ./test
+```
+
+Expected output:
+```
+$ ./test 
+getpwuid()->pw_uid=0x000003e8
+getresuid()->suid=0x000003e8
+```
+
+Actual output:
+```
+$ ./test 
+getpwuid()->pw_uid=0x000003e8
+getresuid()->suid=0x03e80000
+```"""
+additional = """I'm not sure if this is a glibc, qemu or kernel issue, but it doesn't occur outside qemu."""