Message ID | 20210706234932.356913-1-richard.henderson@linaro.org |
---|---|
Headers | show |
Series | linux-user: Signal trampolines and vdsos | expand |
On 7/7/21 1:48 AM, Richard Henderson wrote: > Supercedes: <20210619034329.532318-1-richard.henderson@linaro.org> > ("[PATCH 00/12] linux-user: Load a vdso for x86_64 and hppa") > > Supercedes: <20210618192951.125651-1-richard.henderson@linaro.org> > ("[PATCH v2 00/23] linux-user: Move signal trampolines to new page") > > Changes for v2: > * Add vdsos for aarch64, arm, i386, riscv. > * Drop setup_sigtramp for any target with a vdso. > * Drop arm v1 signal support. > * Simplify ppc encode_trampoline. > > The remaining linux kernel targets that support vdsos are: > > MIPS is particularly troublesome because of a multitude of ISAs. > The kernel doesn't even support them all, disabling the vdso for > micromips (and probably ignores nanomips entirely). Though I'll > note that linux-user/mips does not handle any of the modern > ISAs -- install_sigtramp is strictly MIPS I. In addition there > are 3 ELF ABIs, so there's some combinatorial explosion in the > set of vdsos that would need to be pre-built. Perhaps put this > off until we can build these on demand. Cc'ing Maciej to keep him aware, but FWIW, this sounds good to me. > PPC is troublesome because of __kernel_get_syscall_map. > In addition to needing to collect the set of syscalls that qemu > supports, we'd need to update the vdso every time we add support > for a new syscall. And then there are the 3 ELF ABIs. So again > put this off until we can build these on demand. > > S390x shouldn't be troublesome, I just didn't finish them all. > > > r~ > > > Richard Henderson (36): > linux-user: Add infrastructure for a signal trampoline page > linux-user: Fix style problems in linuxload.c > 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: Introduce imgsrc_mmap > linux-user: Load vdso image if available > linux-user: Add gen-vdso tool > linux-user/aarch64: Add vdso and use it for rt_sigreturn > linux-user/arm: Drop v1 signal frames > linux-user/arm: Drop "_v2" from symbols in signal.c > target/arm: Add isar_feature_aa32_a32 > linux-user/arm: Add vdso and use it for rt_sigreturn > linux-user/alpha: Implement setup_sigtramp > linux-user/cris: Implement setup_sigtramp > linux-user/hexagon: Implement setup_sigtramp > linux-user/hppa: Add vdso and use it for rt_sigreturn > linux-user/x86_64: Raise SIGSEGV if SA_RESTORER not set > linux-user/i386: Add vdso and use it for sigreturn > linux-user/x86_64: Add vdso > linux-user/m68k: Implement setup_sigtramp > linux-user/microblaze: Implement setup_sigtramp > linux-user/mips: Tidy install_sigtramp > linux-user/mips: Implement setup_sigtramp > linux-user/nios2: Document non-use of setup_sigtramp > linux-user/openrisc: Implement setup_sigtramp > target/ppc: Simplify encode_trampoline > linux-user/ppc: Implement setup_sigtramp > linux-user/riscv: Add vdso and use it for sigreturn > linux-user/s390x: Implement setup_sigtramp > linux-user/sh4: Implement setup_sigtramp > linux-user/sparc: Implement setup_sigtramp > linux-user/xtensa: Implement setup_sigtramp > > linux-user/alpha/target_signal.h | 1 + > linux-user/cris/target_signal.h | 2 + > linux-user/hexagon/target_signal.h | 2 + > linux-user/m68k/target_signal.h | 2 + > linux-user/microblaze/target_signal.h | 2 + > linux-user/mips/target_signal.h | 1 + > linux-user/mips64/target_signal.h | 2 + > linux-user/nios2/target_signal.h | 3 + > linux-user/openrisc/target_signal.h | 2 + > linux-user/ppc/target_signal.h | 2 + > linux-user/qemu.h | 67 +++- > linux-user/s390x/target_signal.h | 2 + > linux-user/sh4/target_signal.h | 2 + > linux-user/sparc/target_signal.h | 4 + > linux-user/xtensa/target_signal.h | 2 + > target/arm/cpu.h | 5 + > linux-user/aarch64/signal.c | 17 +- > linux-user/alpha/signal.c | 34 +- > linux-user/arm/signal.c | 500 ++++++-------------------- > linux-user/cris/signal.c | 29 +- > linux-user/elfload.c | 367 ++++++++++++------- > linux-user/flatload.c | 8 +- > linux-user/gen-vdso.c | 223 ++++++++++++ > linux-user/hexagon/signal.c | 19 +- > linux-user/hppa/signal.c | 8 +- > linux-user/i386/signal.c | 50 +-- > linux-user/linuxload.c | 171 ++++++--- > linux-user/m68k/signal.c | 47 ++- > linux-user/microblaze/signal.c | 24 +- > linux-user/mips/signal.c | 39 +- > linux-user/openrisc/signal.c | 24 +- > linux-user/ppc/signal.c | 40 +-- > linux-user/riscv/signal.c | 10 +- > linux-user/s390x/signal.c | 24 +- > linux-user/sh4/signal.c | 40 ++- > linux-user/signal.c | 3 + > linux-user/sparc/signal.c | 32 +- > linux-user/xtensa/signal.c | 50 +-- > target/arm/cpu_tcg.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 | 149 ++++++++ > 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 > 76 files changed, 2866 insertions(+), 789 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 >
On Wed, 7 Jul 2021 at 00:51, Richard Henderson <richard.henderson@linaro.org> wrote: > > Supercedes: <20210619034329.532318-1-richard.henderson@linaro.org> > ("[PATCH 00/12] linux-user: Load a vdso for x86_64 and hppa") > > Supercedes: <20210618192951.125651-1-richard.henderson@linaro.org> > ("[PATCH v2 00/23] linux-user: Move signal trampolines to new page") > > Changes for v2: > * Add vdsos for aarch64, arm, i386, riscv. > * Drop setup_sigtramp for any target with a vdso. > * Drop arm v1 signal support. > * Simplify ppc encode_trampoline. I'm not planning to review this series, but a general comment: I'm not really enthusiastic about the "vdso binaries checked into git and the build mechanism is a random makefile that has to be run by hand in the right environment" setup (and distros that like to build everything from source probably won't be keen either). At a minimum the handling of the cross-environment stuff should be more automated and reproducible like 'make check-tcg'. It would be useful also to get input from the Debian folks on how they'd want to see the build-from-source requirements/setup working... -- PMM
Peter Maydell <peter.maydell@linaro.org> writes: > On Wed, 7 Jul 2021 at 00:51, Richard Henderson > <richard.henderson@linaro.org> wrote: >> >> Supercedes: <20210619034329.532318-1-richard.henderson@linaro.org> >> ("[PATCH 00/12] linux-user: Load a vdso for x86_64 and hppa") >> >> Supercedes: <20210618192951.125651-1-richard.henderson@linaro.org> >> ("[PATCH v2 00/23] linux-user: Move signal trampolines to new page") >> >> Changes for v2: >> * Add vdsos for aarch64, arm, i386, riscv. >> * Drop setup_sigtramp for any target with a vdso. >> * Drop arm v1 signal support. >> * Simplify ppc encode_trampoline. > > I'm not planning to review this series, but a general comment: > I'm not really enthusiastic about the "vdso binaries checked into > git and the build mechanism is a random makefile that has to be > run by hand in the right environment" setup (and distros that > like to build everything from source probably won't be keen > either). AIUI the vdso's are really pretty simple stubs more in line with our stub launchers we currently have scattered around in our sources as hex bytes. They are a bit bigger but not by much. > At a minimum the handling of the cross-environment > stuff should be more automated and reproducible like 'make check-tcg'. > It would be useful also to get input from the Debian folks on > how they'd want to see the build-from-source requirements/setup > working... In Debian they require cross compilers so they can build the various blobs we use. However those blobs are packaged as "noarch" blobs and only built on x86 where all the cross compilers are functional. This is the reason you can't do a full build of QEMU packages on non-x86 platforms and why you need: apt build-dep -yy -a arm64 --arch-only qemu so it doesn't barf trying to find cross compilers that haven't been built for the host arch. So far my attempts to suggest the distros just simply package all cross compilers on all supported host architectures have been rebuffed on the basis it does tend to explode the build matrix a bit. The check-tcg compiler logic could be used to build the vdso's but it is currently optional so if we can't run them you don't get any tests. I suspect we still need to package the binary vdso blobs but use the check-tcg machinery to rebuild them when we can. > > -- PMM -- Alex Bennée
On 9/3/21 3:39 PM, Alex Bennée wrote: > The check-tcg compiler logic could be used to build the vdso's but it is > currently optional so if we can't run them you don't get any tests. I > suspect we still need to package the binary vdso blobs but use the > check-tcg machinery to rebuild them when we can. This is what I was hoping for. I was going to suggest that we migrate the check-tcg machinery into meson, so that the tests could be migrated out of their special makefiles and that we could re-use that for the vdsos. r~