• TAKADA Yoshihito's avatar
    ptrace GET/SET FPXREGS broken · 66f10038
    TAKADA Yoshihito authored
    Commit 11dbc963 upstream
    
    ptrace GET/SET FPXREGS broken
    
    When I update kernel 2.6.25 from 2.6.24, gdb does not work.
    On 2.6.25, ptrace(PTRACE_GETFPXREGS, ...) returns ENODEV.
    
    But 2.6.24 kernel's ptrace() returns EIO.
    It is issue of compatibility.
    
    I attached test program as pt.c and patch for fix it.
    
    #include <stdio.h>
    #include <stdlib.h>
    #include <unistd.h>
    #include <signal.h>
    #include <errno.h>
    #include <sys/ptrace.h>
    #include <sys/types.h>
    
    struct user_fxsr_struct {
    	unsigned short	cwd;
    	unsigned short	swd;
    	unsigned short	twd;
    	unsigned short	fop;
    	long	fip;
    	long	fcs;
    	long	foo;
    	long	fos;
    	long	mxcsr;
    	long	reserved;
    	long	st_space[32];	/* 8*16 bytes for each FP-reg = 128 bytes */
    	long	xmm_space[32];	/* 8*16 bytes for each XMM-reg = 128 bytes */
    	long	padding[56];
    };
    
    int main(void)
    {
      pid_t pid;
    
      pid = fork();
    
      switch(pid){
      case -1:/*  error */
        break;
      case 0:/*  child */
        child();
        break;
      default:
        parent(pid);...
    66f10038
i387.c 11.5 KB