Commit 75a559eb authored by Venkatesh Pallipadi's avatar Venkatesh Pallipadi Committed by David Mosberger

[PATCH] ia64: 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.
parent 0320185f
...@@ -1868,7 +1868,7 @@ save_ia32_fpstate (struct task_struct *tsk, struct ia32_user_i387_struct *save) ...@@ -1868,7 +1868,7 @@ save_ia32_fpstate (struct task_struct *tsk, struct ia32_user_i387_struct *save)
ptp = ia64_task_regs(tsk); ptp = ia64_task_regs(tsk);
tos = (tsk->thread.fsr >> 11) & 7; tos = (tsk->thread.fsr >> 11) & 7;
for (i = 0; i < 8; i++) 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; return 0;
} }
...@@ -1901,7 +1901,7 @@ restore_ia32_fpstate (struct task_struct *tsk, struct ia32_user_i387_struct *sav ...@@ -1901,7 +1901,7 @@ restore_ia32_fpstate (struct task_struct *tsk, struct ia32_user_i387_struct *sav
ptp = ia64_task_regs(tsk); ptp = ia64_task_regs(tsk);
tos = (tsk->thread.fsr >> 11) & 7; tos = (tsk->thread.fsr >> 11) & 7;
for (i = 0; i < 8; i++) 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; return 0;
} }
......
...@@ -108,7 +108,8 @@ struct ia32_user_i387_struct { ...@@ -108,7 +108,8 @@ struct ia32_user_i387_struct {
int fcs; int fcs;
int foo; int foo;
int fos; 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 { struct ia32_user_fxsr_struct {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment