> There is a problem with debugging processes in gdb under
> linux-2.0.34-pre2:
>
> blp:~$ cat > test.c
> main(){}
> blp:~$ gcc test.c
> blp:~$ gdb ./a.out
> GDB is free software and you are welcome to distribute copies of it
> under certain conditions; type "show copying" to see the conditions.
> There is absolutely no warranty for GDB; type "show warranty" for
> details.
> GDB 4.16.patched (i586-debian-linux), Copyright 1996 Free Software
> Foundation, Inc...(no debugging symbols found)...
> (gdb) r
> general protection: 0000
> CPU: 0
> EIP: 0010:[<0010f0b6>]
> EFLAGS: 00010292
> eax: c00f6880 ebx: 07191f9c ecx: bfff002b edx: 00000040
^^^^^^^^
This was the selector that was being checked, the low order 16
bits are ok. But when using it as a 32 bit index into the GDT, it caused
the GPF.
This seems to be a small thinko. The selectors should always be
masked to 16 bits before doing anything with them. Especially since
there are differences between processors wrt 32 bit pushes.
After applying the patch there is a the following line, in
linux/arch/i386/kernel/ptrace.c:
selector = get_stack_long(p, sizeof(long)*index - MAGICNUMBER);
change it to
selector = get_stack_long(p, sizeof(long)*index - MAGICNUMBER) & 0xffff;
(I can't send a full patch because my source tree is completely clobbered
in this area).
Gabriel.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu