qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] linux-user: fix incorrect alignment of pretcode


From: Richard Henderson
Subject: Re: [PATCH] linux-user: fix incorrect alignment of pretcode
Date: Sat, 13 May 2023 12:57:19 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0

On 5/12/23 16:38, fanwj@mail.ustc.edu.cn wrote:
sigframe::pretcode & rt_sigframe::pretcode must align of 16n-sizeof(void*) instead of 16n, Because rsp align 
of 16n before instruction "call" in caller, After "call", push address of "call" in 
caller. sp of begin in callee is 16n-sizeof(void*)

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1648
Signed-off-by: Fan WenJie <fanwj@mail.ustc.edu.cn>

---
  linux-user/i386/signal.c | 9 ++++++---
  1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/linux-user/i386/signal.c b/linux-user/i386/signal.c
index 60fa07d6f9c..1f019689ae7 100644
--- a/linux-user/i386/signal.c
+++ b/linux-user/i386/signal.c
@@ -197,7 +197,8 @@ struct sigframe {
       * to it ensures that the base of the frame has an appropriate alignment
       * too.
       */
-    struct target_fpstate fpstate QEMU_ALIGNED(8);
+    abi_ulong unused QEMU_ALIGNED(8);
+    struct target_fpstate fpstate;
  };

This is not the correct way to fix this problem.

You need to adjust get_sigframe(), for one, to give you the allocation desired.


r~



reply via email to

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