qemu-patch-raspberry4/target
Peter Maydell 35e9a0a8ce target/arm/arm-semi: Make semihosting code hand out its own file descriptors
Currently the Arm semihosting code returns the guest file descriptors
(handles) which are simply the fd values from the host OS or the
remote gdbstub. Part of the semihosting 2.0 specification requires
that we implement special handling of opening a ":semihosting-features"
filename. Guest fds which result from opening the special file
won't correspond to host fds, so to ensure that we don't end up
with duplicate fds we need to have QEMU code control the allocation
of the fd values we give the guest.

Add in an abstraction layer which lets us allocate new guest FD
values, and translate from a guest FD value back to the host one.
This also fixes an odd hole where a semihosting guest could
use the semihosting API to read, write or close file descriptors
that it had never allocated but which were being used by QEMU itself.
(This isn't a security hole, because enabling semihosting permits
the guest to do arbitrary file access to the whole host filesystem,
and so should only be done if the guest is completely trusted.)

Currently the only kind of guest fd is one which maps to a
host fd, but in a following commit we will add one which maps
to the :semihosting-features magic data.

If the guest is migrated with an open semihosting file descriptor
then subsequent attempts to use the fd will all fail; this is
not a change from the previous situation (where the host fd
being used on the source end would not be re-opened on the
destination end).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20190916141544.17540-5-peter.maydell@linaro.org
2019-10-15 18:09:03 +01:00
..
alpha target/alpha: Tidy helper_fp_exc_raise_s 2019-09-26 19:00:53 +01:00
arm target/arm/arm-semi: Make semihosting code hand out its own file descriptors 2019-10-15 18:09:03 +01:00
cris Monitor patches for 2019-08-21 2019-08-22 10:31:21 +01:00
hppa target/hppa: prevent trashing of temporary in do_depw_sar() 2019-09-14 15:39:24 -04:00
i386 target/i386/kvm: Silence warning from Valgrind about uninitialized bytes 2019-10-04 18:49:20 +02:00
lm32 Monitor patches for 2019-08-21 2019-08-22 10:31:21 +01:00
m68k target/m68k/fpu_helper.c: rename the access arguments 2019-09-19 12:12:19 +02:00
microblaze tcg: TCGMemOp is now accelerator independent MemOp 2019-09-03 08:30:38 -07:00
mips target/mips: msa: Move helpers for <AND|NOR|OR|XOR>.V 2019-10-01 16:58:45 +02:00
moxie hw/core: Move cpu.c, cpu.h from qom/ to hw/core/ 2019-08-21 13:24:01 +02:00
nios2 Monitor patches for 2019-08-21 2019-08-22 10:31:21 +01:00
openrisc target/openrisc: Update cpu "any" to v1.3 2019-09-04 13:01:56 -07:00
ppc target/ppc: use Vsr macros in BCD helpers 2019-10-04 19:08:21 +10:00
riscv gdbstub: riscv: fix the fflags registers 2019-09-17 08:42:50 -07:00
s390x s390x/tcg: MVCL: Exit to main loop if requested 2019-10-10 12:27:15 +02:00
sh4 Monitor patches for 2019-08-21 2019-08-22 10:31:21 +01:00
sparc target/sparc: Switch to do_transaction_failed() hook 2019-09-17 12:01:00 +01:00
tilegx tcg: TCGMemOp is now accelerator independent MemOp 2019-09-03 08:30:38 -07:00
tricore tcg: TCGMemOp is now accelerator independent MemOp 2019-09-03 08:30:38 -07:00
unicore32 Monitor patches for 2019-08-21 2019-08-22 10:31:21 +01:00
xtensa target/xtensa: linux-user: add call0 ABI support 2019-09-11 08:47:06 +02:00