Skip to content

Commit

Permalink
fixup signal handling
Browse files Browse the repository at this point in the history
  • Loading branch information
thehajime committed Jan 15, 2025
1 parent efaa665 commit e4ca7c9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions arch/x86/um/nommu/do_syscall_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ __visible void do_syscall_64(struct pt_regs *regs)
/* set fs register to the original host one */
os_x86_arch_prctl(0, ARCH_SET_FS, (void *)host_fs);

/* save fp registers */
asm volatile("fxsaveq %0" : "=m"(*(struct _xstate *)regs->regs.fp));

if (likely(syscall < NR_syscalls)) {
PT_REGS_SET_SYSCALL_RETURN(regs,
EXECUTE_SYSCALL(syscall, regs));
Expand All @@ -66,6 +69,9 @@ __visible void do_syscall_64(struct pt_regs *regs)
set_thread_flag(TIF_SIGPENDING);
interrupt_end();

/* restore fp registers */
asm volatile("fxrstorq %0" : : "m"((current->thread.regs.regs.fp)));

/* restore back fs register to userspace configured one */
os_x86_arch_prctl(0, ARCH_SET_FS,
(void *)(current->thread.regs.regs.gp[FS_BASE
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/um/shared/sysdep/ptrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ struct uml_pt_regs {
int is_user;

/* Dynamically sized FP registers (holds an XSTATE) */
unsigned long fp[];
unsigned long fp[] __attribute__((aligned(16)));
};

#define EMPTY_UML_PT_REGS { }
Expand Down

0 comments on commit e4ca7c9

Please sign in to comment.