[PATCH 0/4] linux-user/arm: Fix BKPT, SVC immediate handling

Peter Maydell posted 4 patches 4 years ago
Test docker-mingw@fedora passed
Test docker-quick@centos7 passed
Test checkpatch passed
Test FreeBSD passed
Test asan passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20200420212206.12776-1-peter.maydell@linaro.org
Maintainers: Riku Voipio <riku.voipio@iki.fi>, Laurent Vivier <laurent@vivier.eu>
linux-user/arm/cpu_loop.c | 145 +++++++++++++++++++++-----------------
1 file changed, 81 insertions(+), 64 deletions(-)
[PATCH 0/4] linux-user/arm: Fix BKPT, SVC immediate handling
Posted by Peter Maydell 4 years ago
This patchseries fixes issues with the code in linux-user/arm/cpu_loop.c:
 * it incorrectly thinks BKPT is a syscall instruction
   (https://bugs.launchpad.net/qemu/+bug/1873898, reported via irc)
 * a stale line of code means we incorrectly NOP SVC #0xf0002
 * we don't implement the distinction between 0x9f0000..0x9f07ff
   (should return -ENOSYS if not implemented) and higher numbers
   (should cause a SIGILL)
 * we abort() for bad immediate values to SVC (ie not the 0 of EABI
   or the >0x9f0000 of OABI); the kernel delivers a SIGILL for these
 * for Thumb mode, we never use the immediate value from the insn,
   but we always read it anyway

This patchseries fixes all those things. (I started out fixing the
BKPT bug; everything else is problems I spotted along the way while
I was reading this bit of code...)

thanks
-- PMM

Peter Maydell (4):
  linux-user/arm: BKPT should cause SIGTRAP, not be a syscall
  linux-user/arm: Remove bogus SVC 0xf0002 handling
  linux-user/arm: Handle invalid arm-specific syscalls correctly
  linux-user/arm: Fix identification of syscall numbers

 linux-user/arm/cpu_loop.c | 145 +++++++++++++++++++++-----------------
 1 file changed, 81 insertions(+), 64 deletions(-)

-- 
2.20.1


Re: [PATCH 0/4] linux-user/arm: Fix BKPT, SVC immediate handling
Posted by Peter Maydell 3 years, 11 months ago
On Mon, 20 Apr 2020 at 22:22, Peter Maydell <peter.maydell@linaro.org> wrote:
>
> This patchseries fixes issues with the code in linux-user/arm/cpu_loop.c:
>  * it incorrectly thinks BKPT is a syscall instruction
>    (https://bugs.launchpad.net/qemu/+bug/1873898, reported via irc)
>  * a stale line of code means we incorrectly NOP SVC #0xf0002
>  * we don't implement the distinction between 0x9f0000..0x9f07ff
>    (should return -ENOSYS if not implemented) and higher numbers
>    (should cause a SIGILL)
>  * we abort() for bad immediate values to SVC (ie not the 0 of EABI
>    or the >0x9f0000 of OABI); the kernel delivers a SIGILL for these
>  * for Thumb mode, we never use the immediate value from the insn,
>    but we always read it anyway
>
> This patchseries fixes all those things. (I started out fixing the
> BKPT bug; everything else is problems I spotted along the way while
> I was reading this bit of code...)

Laurent, do you want me to post a v2 with the -2/-4 thinko fixed
so you can put it via the linux-user tree, or should I just take
this via target-arm.next?

thanks
-- PMM

Re: [PATCH 0/4] linux-user/arm: Fix BKPT, SVC immediate handling
Posted by Peter Maydell 3 years, 11 months ago
On Tue, 12 May 2020 at 13:43, Peter Maydell <peter.maydell@linaro.org> wrote:
>
> On Mon, 20 Apr 2020 at 22:22, Peter Maydell <peter.maydell@linaro.org> wrote:
> >
> > This patchseries fixes issues with the code in linux-user/arm/cpu_loop.c:
> >  * it incorrectly thinks BKPT is a syscall instruction
> >    (https://bugs.launchpad.net/qemu/+bug/1873898, reported via irc)
> >  * a stale line of code means we incorrectly NOP SVC #0xf0002
> >  * we don't implement the distinction between 0x9f0000..0x9f07ff
> >    (should return -ENOSYS if not implemented) and higher numbers
> >    (should cause a SIGILL)
> >  * we abort() for bad immediate values to SVC (ie not the 0 of EABI
> >    or the >0x9f0000 of OABI); the kernel delivers a SIGILL for these
> >  * for Thumb mode, we never use the immediate value from the insn,
> >    but we always read it anyway
> >
> > This patchseries fixes all those things. (I started out fixing the
> > BKPT bug; everything else is problems I spotted along the way while
> > I was reading this bit of code...)
>
> Laurent, do you want me to post a v2 with the -2/-4 thinko fixed
> so you can put it via the linux-user tree, or should I just take
> this via target-arm.next?

I've applied this series (with the fixup) to target-arm.next; thanks.

-- PMM