summary refs log tree commit diff stats
path: root/results/classifier/no-thinking-deepseek-r1:70b/output/syscall/1884719
blob: 58e4b5956613e8cdb99999efddadb7bf68f0a8e2 (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
Function not implemented when using libaio

Hello

I experience "Function not implemented" errors when trying to use Linux libaio library in foreign architecture, e.g. aarch64.

I've faced this problem while using https://github.com/multiarch/qemu-user-static, i.e. Docker+QEMU. 
I understand that I do not use plain QEMU and you may count this report as a "distribution of QEMU"! Just let me know what are the steps to test it with plain QEMU and I will test and update this ticket!


Here are the steps to reproduce the issue:

1) On x86_64 machine register QEMU: 

    `docker run -it --rm --privileged multiarch/qemu-user-static --reset --credential yes --persistent yes`

2) Start a Docker image with foreign CPU architecture, e.g. aarch64

    `docker run -it arm64v8/centos:8 bash`

3) Inside the Docker container install GCC and libaio

    `yum install gcc libaio libaio-devel`

4) Compile the following C program

```
#include <stdio.h>
#include <errno.h>
#include <libaio.h>
#include <stdlib.h>

struct io_control {
    io_context_t ioContext;
};

int main() {
    int queueSize = 10;

    struct io_control * theControl = (struct io_control *) malloc(sizeof(struct io_control));
    if (theControl == NULL) {
        printf("theControl is NULL");
        return 123;
    }

    int res = io_queue_init(queueSize, &theControl->ioContext);
    io_queue_release(theControl->ioContext);
    free(theControl);
    printf("res is: %d", res);
}
```

    ```
    cat > test.c
        [PASTE THE CODE ABOVE HERE]
    ^D
    ```

    `gcc test.c -o out -laio && ./out`


When executed directly on aarch64 machine (i.e. without emulation) or on x86_64 Docker image (e.g. centos:8) it prints `res is: 0`, i.e. it successfully initialized a LibAIO queue.

But when executed on Docker image with foreign/emulated CPU architecture it prints `res is: -38` (ENOSYS). `man io_queue_init` says that error ENOSYS is returned when "Not implemented."

Environment:

QEMU version: 5.0.0.2  (https://github.com/multiarch/qemu-user-static/blob/master/.travis.yml#L24-L28)
Container application: Docker
Output of `docker --version`:

```
Client:
 Version:           19.03.8
 API version:       1.40
 Go version:        go1.13.8
 Git commit:        afacb8b7f0
 Built:             Wed Mar 11 23:42:35 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          19.03.8
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.8
  Git commit:       afacb8b7f0
  Built:            Wed Mar 11 22:48:33 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.3.3-0ubuntu2
  GitCommit:        
 runc:
  Version:          spec: 1.0.1-dev
  GitCommit:        
 docker-init:
  Version:          0.18.0
  GitCommit:        
```

Same happens with Ubuntu (arm64v8/ubuntu:focal).

I've tried to `strace` it but :

```
/usr/bin/strace: ptrace(PTRACE_TRACEME, ...): Function not implemented
/usr/bin/strace: PTRACE_SETOPTIONS: Function not implemented
/usr/bin/strace: detach: waitpid(112): No child processes
/usr/bin/strace: Process 112 detached
```

Here are the steps to reproduce the problem with strace:

     ```
     docker run --rm -it --security-opt seccomp:unconfined --security-opt apparmor:unconfined --privileged --cap-add ALL arm64v8/centos:8 bash

     yum install -y strace`

     strace echo Test
     ```

Note: I used --privileged, disabled seccomp and apparmor, and added all capabilities

Disabling security solves the "Permission denied" problem but then comes the "Not implemented" one.


Any idea what could be the problem and how to work it around ?
I've googled a lot but I wasn't able to find any problems related to libaio on QEMU.

Thank you!
Martin