1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
<think>
Okay, so I need to figure out whether this bug is related to user-mode or system-mode in QEMU. Let me start by understanding the problem described.
The issue arises when running a 32-bit program using QEMU's user-static mode on a 64-bit host. The program uses readdir(), which returns NULL with errno=EOVERFLOW. The root cause is traced back to glibc, specifically in the getdents.c file. The explanation says that because the C standard expects readdir() to return a DIR* structure with 32-bit integers for inode numbers and offsets, glibc checks if these values fit into 32 bits when using getdents64(). If they don't, it returns EOVERFLOW.
On a real 32-bit system, the kernel would generate 32-bit inode numbers, so this problem wouldn't occur. But in QEMU's user-static mode, since the host is 64-bit, the underlying getdents64() syscall from the host returns 64-bit values which often exceed the 32-bit limit, causing the error.
The reporter suggests that while glibc is correctly enforcing the C standard by checking these limits, QEMU might need to handle this differently. However, maintaining a mapping between 64-bit and 32-bit inode numbers would be complex and could impact performance, making it unlikely to be fixed soon.
Now, I need to classify this bug as either 'user-mode' or 'system-mode'. User-mode issues typically involve processes running under QEMU's user emulator, dealing with system calls and binary translation without requiring kernel-level changes. System-mode involves virtualizing hardware, emulating devices, and handling higher privilege levels like the kernel.
In this case, the problem occurs because QEMU is translating 64-bit syscalls into a 32-bit environment but isn't adjusting the inode numbers to fit within 32 bits. This adjustment would need to happen in how QEMU handles the system calls for user-space programs, which falls under user-mode emulation.
Therefore, this bug is related to user-mode because it's about translating and handling syscalls for user-space applications running under QEMU's user-static mode.
</think>
user
|