blob: fcc8870ff1802d2907cd93cc3f22125f730955b1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
id = 1041
title = "x86_64 Auxillary vector reports platform as i686 which doesn't match the linux kernel"
state = "closed"
created_at = "2022-05-27T18:11:26.561Z"
closed_at = "2022-06-24T17:49:58.495Z"
labels = ["Closed::Fixed", "linux-user", "target: i386"]
url = "https://gitlab.com/qemu-project/qemu/-/issues/1041"
host-os = "Debian GNU/Linux 11 (bullseye)"
host-arch = "x86-64"
qemu-version = "qemu-x86_64 version 5.2.0 (Debian 1:5.2+dfsg-11+deb11u1)"
guest-os = "Linux"
guest-arch = "x86-64"
description = """Based on the kernel source in the auxiliary vector AT_PLATFORM should be `x86_64` (confirmed by running outside qemu). However qemu sets it to `i686`.
This was originally reported with docker-for-mac, but was reduced on `x86_64` which is why it is pointless"""
reproduce = """1. Compile the following for x86_64 (statically if you don't want have an x86_64 dynamic linker) (code originally from https://stackoverflow.com/questions/26520163/accessing-auxiliary-vectors-c)
```
#include <stdio.h>
#include <elf.h>
int main(int argc, char** argv, char* envp[]) {
Elf64_auxv_t *auxv;
while(*envp++ != NULL);
/*from stack diagram above: *envp = NULL marks end of envp*/
int i = 0 ;
for (auxv = (Elf64_auxv_t *)envp; auxv->a_type != AT_NULL; auxv++)
/* auxv->a_type = AT_NULL marks the end of auxv */
{
if( auxv->a_type == AT_PLATFORM)
printf("AT_PLATFORM is: %s\\n", ((char*)auxv->a_un.a_val));
}
}
```
2. Run with `qemu-x86_64-static`
3. See `AT_PLATFORM is: i686`
4. Compare to "real" x86_64 bit system which gives `AT_PLATFORM is: x86_64`"""
additional = """I think that adding `#define ELF_PLATFORM "x86_64"` [here](https://gitlab.com/qemu-project/qemu/-/blob/master/linux-user/elfload.c#L134) should work (but I don't fully understand the code). Otherwise we just end up getting the 32-bit case."""
|