[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 0/7] Allow semihosting from user mode

From: Richard Henderson
Subject: Re: [PATCH v2 0/7] Allow semihosting from user mode
Date: Tue, 6 Sep 2022 08:50:43 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0

On 8/22/22 15:12, Peter Maydell wrote:
Currently our semihosting implementations usually prohibit use of
semihosting calls in system emulation from the guest userspace.  This
is a very long standing behaviour justified originally "to provide
some semblance of security" (since code with access to the semihosting
ABI can do things like read and write arbitrary files on the host
system).  However, it is sometimes useful to be able to run trusted
guest code which performs semihosting calls from guest userspace,
notably for test code.

This patchset adds a command line suboption to the existing
semihosting-config option group so that you can explicitly opt in to
semihosting from guest userspace with "-semihosting-config

It also brings all our target architectures into line about
how they handle semihosting. Currently these fall into three
different groups:

  * semihosting permitted only in privileged mode and only
    if enabled on the command line:
    - arm
    - m68k
  * semihosting permitted in any mode, if enabled on the command line:
    - mips
    - nios2
    - xtensa
  * semihosting permitted only in privileged mode, but fails
    to honour the existing "enable semihosting" option, instead
    enabling it all the time:
    - riscv

The effect of the new option for group 1 is:
  * user can now optionally also allow semihosting in usermode

For group 2 it is:
  * usermode semihosting used to be permitted, but now changes
    to default-disabled, needing explicit enablement

For group 3 it is:
  * semihosting overall used to be default-enabled and is
    now default-disabled, needing explicit enablement.
    Semihosting in usermode can also be enabled.

That means this is a "things that used to work no longer do
unless you change your commandline" change for groups 2 and 3
(so, mips, nios2. xtensa, riscv). Consensus seems to be that
it's OK to call this "fixing a bug" and note it in the

Changes v1->v2:
  * make riscv check for semihosting being disabled at
    translate time, not runtime

Only patch 7 needs review.

Thanks, queued to semihosting-next.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]