diff mbox series

[for-6.2,4/7] linux-user: Zero out target_siginfo_t in force_sig()

Message ID 20210813131809.28655-5-peter.maydell@linaro.org
State Accepted
Headers show
Series linux-user: Clean up siginfo_t handling for arm, aarch64 | expand

Commit Message

Peter Maydell Aug. 13, 2021, 1:18 p.m. UTC
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>

---
 linux-user/signal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.20.1

Comments

Richard Henderson Aug. 15, 2021, 8 p.m. UTC | #1
On 8/13/21 3:18 AM, Peter Maydell wrote:
> 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>

> ---

>   linux-user/signal.c | 2 +-

>   1 file changed, 1 insertion(+), 1 deletion(-)


Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~
diff mbox series

Patch

diff --git a/linux-user/signal.c b/linux-user/signal.c
index a8faea6f090..fd3c6a3e60d 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -636,7 +636,7 @@  void force_sig(int sig)
 {
     CPUState *cpu = thread_cpu;
     CPUArchState *env = cpu->env_ptr;
-    target_siginfo_t info;
+    target_siginfo_t info = {};
 
     info.si_signo = sig;
     info.si_errno = 0;