IA-32 emulation patch: ptrace get_FPREGS bug fix
PATCH 1/1 IA-32 emulation patch: ptrace get_FPREGS bug fix
A bug-fix in IA-32 emulation ptrace code. The bug originally got introduced with the addition of FPXREGS support in ptrace.
The bug is in ptrace get/set FPREGS routine. gdb by default will not use FPREGS routines when FPXREGS routines are supported. So we may not see this bug during normal gdb operations. But, if gdb (or any other app) directly tries to get/set FPREGS (probably an old version of gdb), it will end with an segmentation fault due to this bug.
Attached patch fixes the issue. The patch is taken against 2.5.69. But it applies to 2.4 tree as well.
Please let me know, if you need any more information on this.
Thanks,
-Venkatesh
arch/ia64/ia32/sys_ia32.c +2 -2
@@ -1860,7 +1860,7 @@ ptp =ia64_task_regs (tsk); tos = (tsk->thread.fsr >>11 ) &7 ;for (i =0 ; i <8 ; i++) -put_fpreg (i, (struct _fpreg_ia32 *)&save->st_space[4 *i], ptp, swp, tos); +put_fpreg (i, &save->st_space[i], ptp, swp, tos);return 0 ; }
@@ -1893,7 +1893,7 @@ ptp =ia64_task_regs (tsk); tos = (tsk->thread.fsr >>11 ) &7 ;for (i =0 ; i <8 ; i++) -get_fpreg (i, (struct _fpreg_ia32 *)&save->st_space[4 *i], ptp, swp, tos); +get_fpreg (i, &save->st_space[i], ptp, swp, tos);return 0 ; }
include/asm-ia64/ia32.h +2 -1
@@ -108,7 +108,8 @@int fcs;int foo;int fos; -int st_space[20 ];/* 8*10 bytes for each FP-reg = 80 bytes */ +/* 8*10 bytes for each FP-reg = 80 bytes */ +struct _fpreg_ia32 st_space[8 ]; };struct ia32_user_fxsr_struct {
David Mosberger
AppliedQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Venkatesh
Venkatesh> A bug-fix in IA-32 emulation ptrace code. The bug Venkatesh> originally got introduced with the addition of FPXREGS Venkatesh> support in ptrace.
Applied, thanks.
--david
Bjorn Helgaas
AppliedQuoted 2 lines · Venkatesh
A bug-fix in IA-32 emulation ptrace code. The bug originally got introduced with the addition of FPXREGS support in ptrace.
I applied this for 2.4. Thanks!