This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/1468] AMD64 {get,set,swap,make}context use wrong offsets into ucontext_t


------- Additional Comments From nmiell at comcast dot net  2005-10-12 05:59 -------
Even with this patch, the the context functions still use the wrong offsets.

The problem is that FNSTENV and FLDENV operate on memory with the following layout:

struct fpenv
{
  uint16_t cwd;
  uint16_t __pad0;
  uint16_t swd;
  uint16_t __pad1;
  uint16_t ftw;
  uint16_t __pad2;
  uint32_t eip;
  uint16_t cs;
  uint16_t opcode;
  uint32_t edi;
  uint16_t ds;
  uint16_t __pad3
}; 

while struct _libc_fpstate uses the 64-bit FXSAVE/FXRSTOR format, which starts
like this:

struct _libc_fpstate
{
  __uint16_t cwd;
  __uint16_t swd;
  __uint16_t ftw;
  __uint16_t fop;
  __uint64_t rip;
  __uint64_t rdp;
  __uint32_t mxcsr;
  /* ... */
}

Which means that the existing code which does FNSTENV to uc.__fpregs_mem will
store members in the wrong locations and will corrupt the saved %mxcsr (assuming
the struct offsets in ucontext_i.h are corrected without any other updates to
the context functions).

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=1468

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]