summary refs log tree commit diff stats
path: root/gitlab/issues/target_missing/host_missing/accel_missing/1729.toml
blob: 302c093f321910c44a8ad87cd996240509129789 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
id = 1729
title = "mremap fails with EFAULT if address range overlaps with stack guard"
state = "closed"
created_at = "2023-06-25T06:50:48.249Z"
closed_at = "2024-10-20T22:02:11.370Z"
labels = ["linux-user"]
url = "https://gitlab.com/qemu-project/qemu/-/issues/1729"
host-os = "any linux"
host-arch = "x86_64"
qemu-version = "any version"
guest-os = "alpine-linux"
guest-arch = "ARM 32-bit"
description = """When running 32-bit user-static on 64-bit host, `mremap` behave differently from the kernel. This difference let programs that call `pthread_getattr_np` on musl-libc to run into a loop on repeated calling `mremap`.

https://git.musl-libc.org/cgit/musl/plain/src/thread/pthread_getattr_np.c

``` c
\t\twhile (mremap(p-l-PAGE_SIZE, PAGE_SIZE, 2*PAGE_SIZE, 0)==MAP_FAILED && errno==ENOMEM)
\t\t\tl += PAGE_SIZE;
```"""
reproduce = """Compile the following program against musl-libc arm 32-bit, and run it in qemu-user-static on x86_64 host.

``` c
#define _GNU_SOURCE
#include <pthread.h>

int main(int argc, char *argv[]) {
\tpthread_attr_t attr;
\treturn pthread_getattr_np(pthread_self(), &attr);
}
```

For example, on x86_64 fedora 38 with podman and qemu-user-static installed, we can reproduce this with alpine container:

```
$ podman run --rm -it --arch arm/v7 docker.io/library/alpine:latest

/ # apk add alpine-sdk

......

/ # cat test.c
#define _GNU_SOURCE
#include <pthread.h>

int main(int argc, char *argv[]) {
\tpthread_attr_t attr;
\treturn pthread_getattr_np(pthread_self(), &attr);
}

/ # gcc test.c

/ # ./a.out
```"""
additional = """Original thread on musl mail list where this was initially reported: https://www.openwall.com/lists/musl/2017/06/15/9"""