qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <1884719@bugs.launchpad.net>
To: qemu-devel@nongnu.org
Subject: Re: [Bug 1884719] [NEW] Function not implemented when using libaio
Date: Mon, 29 Jun 2020 10:43:08 -0000	[thread overview]
Message-ID: <20200629104308.GG31392@stefanha-x1.localdomain> (raw)
Message-ID: <20200629104308.uc6SbUVpdU28Dou_LGkbYCGvn8ALLUA42fffPQrWJQU@z> (raw)
In-Reply-To: 159289799812.6175.17000319886186623286.malonedeb@soybean.canonical.com

On Tue, Jun 23, 2020 at 07:39:58AM -0000, Martin Grigorov wrote:
> Public bug reported:

CCing Filip and Laurent, who may be interested in adding Linux AIO
syscalls to qemu-user.

> 
> 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
> 
> ** Affects: qemu
>      Importance: Undecided
>          Status: New
> 
> -- 
> You received this bug notification because you are a member of qemu-
> devel-ml, which is subscribed to QEMU.
> https://bugs.launchpad.net/bugs/1884719
> 
> Title:
>   Function not implemented when using libaio
> 
> Status in QEMU:
>   New
> 
> Bug description:
>   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
> 
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/qemu/+bug/1884719/+subscriptions
>

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1884719

Title:
  Function not implemented when using libaio

Status in QEMU:
  New

Bug description:
  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

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1884719/+subscriptions


  reply	other threads:[~2020-06-29 10:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-23  7:39 [Bug 1884719] [NEW] Function not implemented when using libaio Martin Grigorov
2020-06-29 10:43 ` Stefan Hajnoczi [this message]
2020-06-29 10:43   ` Stefan Hajnoczi
2020-06-29 11:28 ` [Bug 1884719] " Laurent Vivier
2020-06-29 11:30 ` Laurent Vivier
2020-06-29 12:13 ` Martin Grigorov
2020-07-13 17:38 ` Martin Grigorov
2020-07-13 19:37 ` Laurent Vivier
2020-07-14  7:48 ` Martin Grigorov
2020-07-15 19:27 ` Laurent Vivier
2020-07-16  5:58 ` Martin Grigorov
2020-08-24 13:33 ` Martin Grigorov
2020-08-24 20:23 ` Laurent Vivier
2021-05-07  2:52 ` Thomas Huth
2021-05-07  6:35 ` Thomas Huth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200629104308.GG31392@stefanha-x1.localdomain \
    --to=1884719@bugs.launchpad.net \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).