Skip to contentSkip to conversation

linux-user/riscv: Use abi type for target_ucontext

PATCH Applied LIU Zhiwei 3 participants 3 messages Aug 11, 2023 RISC-V

lore
Share & tools
lore

LIU Zhiwei

author
#0 lore raw

PATCH v2 1/1 linux-user/riscv: Use abi type for target_ucontext

We should not use types dependend on host arch for target_ucontext. This bug is found when run rv32 applications.

---
v2:
- Use abi_ptr instead of abi_ulong for uc_link. (Suggest by Philippe Mathieu-Daudé)

---
 linux-user/riscv/signal.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
linux-user/riscv/signal.c +2 -2
index eaa168199a..f989f7f51f 100644
@@ -38,8 +38,8 @@ struct target_sigcontext {
 }; /* cf. riscv-linux:arch/riscv/include/uapi/asm/ptrace.h */
 
 struct target_ucontext {
-    unsigned long uc_flags;
-    struct target_ucontext *uc_link;
+    abi_ulong uc_flags;
+    abi_ptr uc_link;
     target_stack_t uc_stack;
     target_sigset_t uc_sigmask;
     uint8_t   __unused[1024 / 8 - sizeof(target_sigset_t)];
Signature · 1 line
2.17.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 6 lines · LIU Zhiwei

We should not use types dependend on host arch for target_ucontext. This bug is found when run rv32 applications.

Quoted 6 lines

---
v2:
- Use abi_ptr instead of abi_ulong for uc_link. (Suggest by Philippe Mathieu-Daudé)

---
  linux-user/riscv/signal.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
#2 lore raw
In reply to LIU Zhiwei
Quoted 7 lines · LIU Zhiwei

We should not use types dependend on host arch for target_ucontext. This bug is found when run rv32 applications.

Thanks!

Applied to riscv-to-apply.next

Alistair

Quoted 26 lines

---
v2:
- Use abi_ptr instead of abi_ulong for uc_link. (Suggest by Philippe Mathieu-Daudé)

---
 linux-user/riscv/signal.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
linux-user/riscv/signal.c +2 -3
index eaa168199a..f989f7f51f 100644
@@ -38,8 +38,8 @@ struct target_sigcontext {
 }; /* cf. riscv-linux:arch/riscv/include/uapi/asm/ptrace.h */
 
 struct target_ucontext {
-    unsigned long uc_flags;
-    struct target_ucontext *uc_link;
+    abi_ulong uc_flags;
+    abi_ptr uc_link;
     target_stack_t uc_stack;
     target_sigset_t uc_sigmask;
     uint8_t   __unused[1024 / 8 - sizeof(target_sigset_t)];
--

2.17.1