Skip to content

Commit

Permalink
i#3544, i#1551, i#1569 signal: Remove a non-existing field in sigfram…
Browse files Browse the repository at this point in the history
…e_rt_t (#6554)

The `retcode` field in `sigframe_rt_t` is only available in x86 and
AArch32, this fixes a buffer overflow in `memcpy_rt_frame()` on RISC-V.

Issue: #3544 #1551 #1569
  • Loading branch information
ksco authored Jan 13, 2024
1 parent 2053f9f commit a8c4f6f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions core/unix/signal_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,11 @@ typedef _STRUCT_UCONTEXT /* == __darwin_ucontext */ kernel_ucontext_t;
* (these are from /usr/src/linux/arch/i386/kernel/signal.c for kernel 2.4.17)
*/

# define RETCODE_SIZE 8
# if defined(X86)
# define RETCODE_SIZE 8
# elif defined(ARM)
# define RETCODE_SIZE 16
# endif

typedef struct sigframe {
# ifdef X86
Expand Down Expand Up @@ -280,11 +284,12 @@ typedef struct rt_sigframe {
# elif defined(AARCHXX)
kernel_siginfo_t info;
kernel_ucontext_t uc;
# ifdef ARM
char retcode[RETCODE_SIZE];
# endif
# elif defined(RISCV64)
kernel_siginfo_t info;
kernel_ucontext_t uc;
char retcode[RETCODE_SIZE];
# endif

#elif defined(MACOS)
Expand Down

0 comments on commit a8c4f6f

Please sign in to comment.