qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] 1fb6a8: linux-user/aarch64: Set siginfo_t add


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] 1fb6a8: linux-user/aarch64: Set siginfo_t addr field for S...
Date: Fri, 24 Sep 2021 08:20:38 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 1fb6a87d0bc3a730ec90578cfdfb2ef7ac5b5d11
      
https://github.com/qemu/qemu/commit/1fb6a87d0bc3a730ec90578cfdfb2ef7ac5b5d11
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2021-09-23 (Thu, 23 Sep 2021)

  Changed paths:
    M linux-user/aarch64/cpu_loop.c

  Log Message:
  -----------
  linux-user/aarch64: Set siginfo_t addr field for SIGTRAP signals

When generating a TRAP_BRKPT SIGTRAP, set the siginfo_t addr field
to the PC where the breakpoint/singlestep trap occurred; this is
what the kernel does for this signal for this architecture.

Fixes: Coverity 1459154
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20210813131809.28655-2-peter.maydell@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>


  Commit: 1af354120dc4d9187ee1162b95ac84aafd7c4df0
      
https://github.com/qemu/qemu/commit/1af354120dc4d9187ee1162b95ac84aafd7c4df0
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2021-09-23 (Thu, 23 Sep 2021)

  Changed paths:
    M linux-user/arm/cpu_loop.c

  Log Message:
  -----------
  linux-user/arm: Set siginfo_t addr field for SIGTRAP signals

When generating a TRAP_BRKPT SIGTRAP, set the siginfo_t addr field
to the PC where the breakpoint/singlestep trap occurred; this is
what the kernel does for this signal for this architecture.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20210813131809.28655-3-peter.maydell@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>


  Commit: babe6d5c88b587d30f72f31a81ce87610b68e952
      
https://github.com/qemu/qemu/commit/babe6d5c88b587d30f72f31a81ce87610b68e952
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2021-09-23 (Thu, 23 Sep 2021)

  Changed paths:
    M linux-user/arm/cpu_loop.c

  Log Message:
  -----------
  linux-user/arm: Use force_sig() to deliver fpa11 emulation SIGFPE

In the Arm target code, when the fpa11 emulation code tells us we
need to send the guest a SIGFPE, we do this with queue_signal(), but
we are using the wrong si_type, and we aren't setting the _sifields
union members corresponding to either the si_type we are using or the
si_type we should be using.

As the existing comment notes, the kernel code for this calls the old
send_sig() function to deliver the signal.  This eventually results
in the kernel's signal handling code fabricating a siginfo_t with a
SI_KERNEL code and a zero pid and uid.  For QEMU this means we need
to use QEMU_SI_KILL.  We already have a function for that:
force_sig() sets up the whole target_siginfo_t the way we need it.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20210813131809.28655-4-peter.maydell@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>


  Commit: 819121b9b08a41ccfcde2e18eb782f8f6b2912f1
      
https://github.com/qemu/qemu/commit/819121b9b08a41ccfcde2e18eb782f8f6b2912f1
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2021-09-23 (Thu, 23 Sep 2021)

  Changed paths:
    M linux-user/signal.c

  Log Message:
  -----------
  linux-user: Zero out target_siginfo_t in force_sig()

The target_siginfo_t we populate in force_sig() will eventually
get copied onto the target's stack. Zero it out so that any extra
padding in the sifields union is consistently zero when the guest
sees it.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20210813131809.28655-5-peter.maydell@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>


  Commit: af7969605eed067320fe9eca80f1aa35b67ec46d
      
https://github.com/qemu/qemu/commit/af7969605eed067320fe9eca80f1aa35b67ec46d
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2021-09-23 (Thu, 23 Sep 2021)

  Changed paths:
    M linux-user/signal-common.h
    M linux-user/signal.c

  Log Message:
  -----------
  linux-user: Provide new force_sig_fault() function

In many places in the linux-user code we need to queue a signal for
the guest using the QEMU_SI_FAULT si_type.  This requires that the
caller sets up and passes us a target_siginfo, including setting the
appropriate part of the _sifields union for the si_type. In a number
of places the code forgets to set the _sifields union field.

Provide a new force_sig_fault() function, which does the same thing
as the Linux kernel function of that name -- it takes the signal
number, the si_code value and the address to use in
_sifields._sigfault, and assembles the target_siginfo itself.  This
makes the callsites simpler and means it's harder to forget to pass
in an address value.

We follow force_sig() and the kernel's force_sig_fault() in not
requiring the caller to pass in the CPU pointer but always acting
on the CPU of the current thread.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20210813131809.28655-6-peter.maydell@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>


  Commit: 4c90f0ba9d949073935b320aefd133b4d369f70a
      
https://github.com/qemu/qemu/commit/4c90f0ba9d949073935b320aefd133b4d369f70a
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2021-09-23 (Thu, 23 Sep 2021)

  Changed paths:
    M linux-user/arm/cpu_loop.c

  Log Message:
  -----------
  linux-user/arm: Use force_sig_fault()

Use the new force_sig_fault() function instead of setting up
a target_siginfo_t and calling queue_signal().

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20210813131809.28655-7-peter.maydell@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>


  Commit: fce9608d02b665fdc3ab7b23f1a911ba6c66775b
      
https://github.com/qemu/qemu/commit/fce9608d02b665fdc3ab7b23f1a911ba6c66775b
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2021-09-23 (Thu, 23 Sep 2021)

  Changed paths:
    M linux-user/aarch64/cpu_loop.c

  Log Message:
  -----------
  linux-user/aarch64: Use force_sig_fault()

Use the new force_sig_fault() function instead of setting up
a target_siginfo_t and calling queue_signal().

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20210813131809.28655-8-peter.maydell@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>


  Commit: e749ea24791e40d22fc9d21e248a30d69dd847db
      
https://github.com/qemu/qemu/commit/e749ea24791e40d22fc9d21e248a30d69dd847db
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2021-09-24 (Fri, 24 Sep 2021)

  Changed paths:
    M linux-user/aarch64/cpu_loop.c
    M linux-user/arm/cpu_loop.c
    M linux-user/signal-common.h
    M linux-user/signal.c

  Log Message:
  -----------
  Merge remote-tracking branch 
'remotes/vivier2/tags/linux-user-for-6.2-pull-request' into staging

Pull request linux-user 20210924

Clean up siginfo_t handling for arm, aarch64

# gpg: Signature made Fri 24 Sep 2021 14:56:12 BST
# gpg:                using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C
# gpg:                issuer "laurent@vivier.eu"
# gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full]
# gpg:                 aka "Laurent Vivier <laurent@vivier.eu>" [full]
# gpg:                 aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" 
[full]
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* remotes/vivier2/tags/linux-user-for-6.2-pull-request:
  linux-user/aarch64: Use force_sig_fault()
  linux-user/arm: Use force_sig_fault()
  linux-user: Provide new force_sig_fault() function
  linux-user: Zero out target_siginfo_t in force_sig()
  linux-user/arm: Use force_sig() to deliver fpa11 emulation SIGFPE
  linux-user/arm: Set siginfo_t addr field for SIGTRAP signals
  linux-user/aarch64: Set siginfo_t addr field for SIGTRAP signals

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Compare: https://github.com/qemu/qemu/compare/73257aa02376...e749ea24791e



reply via email to

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