mbox series

[v3,00/15] linux-user: Implement VDSOs

Message ID 20230811165052.161080-1-richard.henderson@linaro.org
Headers show
Series linux-user: Implement VDSOs | expand

Message

Richard Henderson Aug. 11, 2023, 4:50 p.m. UTC
It's time for another round on implementing the VDSO for linux-user.
We are now seeing applications built that absolutely require it, 
and have no fallback for the VDSO to be absent.

For instance,

  https://gitlab.com/qemu-project/qemu/-/issues/1267

uses musl and will currently branch to NULL executing the mmap
syscall, because the __kernel_vsyscall symbol is not found.

This is just a rebase of v2 from 2021:

  https://lists.nongnu.org/archive/html/qemu-devel/2021-07/msg01311.html

and does nothing to address the cross-compilation issues.

I am more hopful that cross-compilation can be solved now, due
to the work on Native Library Calls:

  https://patchew.org/QEMU/20230808141739.3110740-1-fufuyqqqqqq@gmail.com/

But frankly, even with cross-compilation enabled there will be
hosts which do not have the cross-compilers and I believe we will
still have to check the binaries into the repository.  As they are
all on the order of 5 to 6k, I really do not see this as a problem.


r~


PS: This patch set is now 13 years old:

  https://lists.nongnu.org/archive/html/qemu-devel/2010-04/msg00187.html
  https://lists.gnu.org/archive/html/qemu-devel/2013-07/msg04036.html

Let's see if we can get this resolved before it can vote.


Richard Henderson (15):
  linux-user: Introduce imgsrc_read, imgsrc_read_alloc
  linux-user: Tidy loader_exec
  linux-user: Do not clobber bprm_buf swapping ehdr
  linux-user: Use ImageSource in load_elf_image
  linux-user: Use ImageSource in load_symbols
  linux-user: Replace bprm->fd with bprm->src.fd
  linux-user: Load vdso image if available
  linux-user: Add gen-vdso tool
  linux-user/aarch64: Add vdso and use it for rt_sigreturn
  target/arm: Add isar_feature_aa32_a32
  linux-user/arm: Add vdso and use it for rt_sigreturn
  linux-user/hppa: Add vdso and use it for rt_sigreturn
  linux-user/i386: Add vdso and use it for sigreturn
  linux-user/x86_64: Add vdso
  linux-user/riscv: Add vdso and use it for sigreturn

 linux-user/loader.h              |  60 ++++-
 target/arm/cpu.h                 |   5 +
 linux-user/arm/signal.c          |  30 ++-
 linux-user/elfload.c             | 365 ++++++++++++++++++++-----------
 linux-user/flatload.c            |   8 +-
 linux-user/gen-vdso.c            | 223 +++++++++++++++++++
 linux-user/hppa/signal.c         |   1 -
 linux-user/linuxload.c           | 137 ++++++++++--
 target/arm/tcg/cpu32.c           |   7 +
 linux-user/gen-vdso-elfn.c.inc   | 306 ++++++++++++++++++++++++++
 linux-user/aarch64/Makefile.vdso |  11 +
 linux-user/aarch64/meson.build   |  11 +
 linux-user/aarch64/vdso-be.so    | Bin 0 -> 6000 bytes
 linux-user/aarch64/vdso-le.so    | Bin 0 -> 6000 bytes
 linux-user/aarch64/vdso.S        |  77 +++++++
 linux-user/aarch64/vdso.ld       |  74 +++++++
 linux-user/arm/Makefile.vdso     |  17 ++
 linux-user/arm/meson.build       |  18 ++
 linux-user/arm/vdso-arm-be.so    | Bin 0 -> 5648 bytes
 linux-user/arm/vdso-arm-le.so    | Bin 0 -> 5648 bytes
 linux-user/arm/vdso-thm-be.so    | Bin 0 -> 5620 bytes
 linux-user/arm/vdso-thm-le.so    | Bin 0 -> 5620 bytes
 linux-user/arm/vdso.S            | 209 ++++++++++++++++++
 linux-user/arm/vdso.ld           |  74 +++++++
 linux-user/hppa/Makefile.vdso    |   6 +
 linux-user/hppa/meson.build      |   6 +
 linux-user/hppa/vdso.S           | 149 +++++++++++++
 linux-user/hppa/vdso.ld          |  75 +++++++
 linux-user/hppa/vdso.so          | Bin 0 -> 5196 bytes
 linux-user/i386/Makefile.vdso    |   5 +
 linux-user/i386/meson.build      |   7 +
 linux-user/i386/vdso.S           | 181 +++++++++++++++
 linux-user/i386/vdso.ld          |  76 +++++++
 linux-user/i386/vdso.so          | Bin 0 -> 5528 bytes
 linux-user/meson.build           |   8 +-
 linux-user/riscv/Makefile.vdso   |  11 +
 linux-user/riscv/meson.build     |   9 +
 linux-user/riscv/vdso-32.so      | Bin 0 -> 5624 bytes
 linux-user/riscv/vdso-64.so      | Bin 0 -> 6120 bytes
 linux-user/riscv/vdso.S          | 207 ++++++++++++++++++
 linux-user/riscv/vdso.ld         |  76 +++++++
 linux-user/x86_64/Makefile.vdso  |   5 +
 linux-user/x86_64/meson.build    |   6 +
 linux-user/x86_64/vdso.S         | 122 +++++++++++
 linux-user/x86_64/vdso.ld        |  74 +++++++
 linux-user/x86_64/vdso.so        | Bin 0 -> 6008 bytes
 46 files changed, 2467 insertions(+), 189 deletions(-)
 create mode 100644 linux-user/gen-vdso.c
 create mode 100644 linux-user/gen-vdso-elfn.c.inc
 create mode 100644 linux-user/aarch64/Makefile.vdso
 create mode 100644 linux-user/aarch64/meson.build
 create mode 100755 linux-user/aarch64/vdso-be.so
 create mode 100755 linux-user/aarch64/vdso-le.so
 create mode 100644 linux-user/aarch64/vdso.S
 create mode 100644 linux-user/aarch64/vdso.ld
 create mode 100644 linux-user/arm/Makefile.vdso
 create mode 100755 linux-user/arm/vdso-arm-be.so
 create mode 100755 linux-user/arm/vdso-arm-le.so
 create mode 100755 linux-user/arm/vdso-thm-be.so
 create mode 100755 linux-user/arm/vdso-thm-le.so
 create mode 100644 linux-user/arm/vdso.S
 create mode 100644 linux-user/arm/vdso.ld
 create mode 100644 linux-user/hppa/Makefile.vdso
 create mode 100644 linux-user/hppa/vdso.S
 create mode 100644 linux-user/hppa/vdso.ld
 create mode 100755 linux-user/hppa/vdso.so
 create mode 100644 linux-user/i386/Makefile.vdso
 create mode 100644 linux-user/i386/vdso.S
 create mode 100644 linux-user/i386/vdso.ld
 create mode 100755 linux-user/i386/vdso.so
 create mode 100644 linux-user/riscv/Makefile.vdso
 create mode 100644 linux-user/riscv/meson.build
 create mode 100755 linux-user/riscv/vdso-32.so
 create mode 100755 linux-user/riscv/vdso-64.so
 create mode 100644 linux-user/riscv/vdso.S
 create mode 100644 linux-user/riscv/vdso.ld
 create mode 100644 linux-user/x86_64/Makefile.vdso
 create mode 100644 linux-user/x86_64/vdso.S
 create mode 100644 linux-user/x86_64/vdso.ld
 create mode 100755 linux-user/x86_64/vdso.so

Comments

Alex Bennée Aug. 14, 2023, 9:52 a.m. UTC | #1
Richard Henderson <richard.henderson@linaro.org> writes:

> It's time for another round on implementing the VDSO for linux-user.
> We are now seeing applications built that absolutely require it, 
> and have no fallback for the VDSO to be absent.

Something broke configure for me:

  ../../configure --disable-docs --disable-system


Gave:

  Dependency glib-2.0 found: YES 2.74.6 (overridden)
  Program indent found: NO

  ../../linux-user/hppa/meson.build:7:0: ERROR: File vdso.so does not exist.

  A full log can be found at /home/alex/lsrc/qemu.git/builds/user/meson-logs/meson-log.txt
  FAILED: build.ninja 
  /home/alex/lsrc/qemu.git/builds/user/pyvenv/bin/meson --internal regenerate /home/alex/lsrc/qemu.git /home/alex/lsrc/qemu.git/builds/user
  ninja: error: rebuilding 'build.ninja': subcommand failed
  make: Nothing to be done for 'all'.

Will there be linux-user targets that never support vdso?
Richard Henderson Aug. 16, 2023, 6:06 p.m. UTC | #2
On 8/14/23 02:52, Alex Bennée wrote:
> 
> Richard Henderson <richard.henderson@linaro.org> writes:
> 
>> It's time for another round on implementing the VDSO for linux-user.
>> We are now seeing applications built that absolutely require it,
>> and have no fallback for the VDSO to be absent.
> 
> Something broke configure for me:
> 
>    ../../configure --disable-docs --disable-system
> 
> 
> Gave:
> 
>    Dependency glib-2.0 found: YES 2.74.6 (overridden)
>    Program indent found: NO
> 
>    ../../linux-user/hppa/meson.build:7:0: ERROR: File vdso.so does not exist.
> 
>    A full log can be found at /home/alex/lsrc/qemu.git/builds/user/meson-logs/meson-log.txt
>    FAILED: build.ninja
>    /home/alex/lsrc/qemu.git/builds/user/pyvenv/bin/meson --internal regenerate /home/alex/lsrc/qemu.git /home/alex/lsrc/qemu.git/builds/user
>    ninja: error: rebuilding 'build.ninja': subcommand failed
>    make: Nothing to be done for 'all'.
> 
> Will there be linux-user targets that never support vdso?
> 

Something must have gone wrong with the email, or patch apply, because that file should 
definitely exist.  I have just sent a v4.  If that breaks too, let me know but then please 
just pull from my branch.


r~