Re: 1.3.17 breaks gdb-4.14-elf (?)

Linus Torvalds (Linus.Torvalds@cs.Helsinki.FI)
Fri, 11 Aug 1995 12:50:21 +0300


Harald Evensen: "1.3.17 breaks gdb-4.14-elf (?)" (Aug 10, 17:38):
> When I upgraded from 1.3.15 to 1.3.17, gdb 4.14-elf stopped working.
> I haven't had time to "investigate" what the problem is,
> but all programs segfaults when run from gdb. (They run ok when
> not started from within gdb). My system is 100% elf with the kernel
> compiled as elf (libc5.2.5, binutils2.5.2l.20, gcc-2.7.0/1, ld-so-1.7.5).
> When I "downgraded" to 1.3.15, it worked like a charm again.

Whee.. This was an old bug, and it seems the 1.3.16-17 kernels catch it
only because the new Pentium MM code enables some more hardware checking
of the page table entry (at the same time it enables the 4MB page tables
for the kernel).

This small patch should fix it (it is against 1.3.17, but it should
actually apply to all versions 1.2.x and 1.3.x, and I will put it in my
1.2.x tree as well in case I release any more 1.2.x versions).

Linus
----------
diff -u --recursive --new-file v1.3.17/linux/arch/i386/kernel/ptrace.c linux/arch/i386/kernel/ptrace.c
--- v1.3.17/linux/arch/i386/kernel/ptrace.c Tue Jul 18 16:28:56 1995
+++ linux/arch/i386/kernel/ptrace.c Fri Aug 11 11:52:56 1995
@@ -173,10 +173,8 @@
goto repeat;
}
/* this is a hack for non-kernel-mapped video buffers and similar */
- if (page < high_memory) {
- page += addr & ~PAGE_MASK;
- *(unsigned long *) page = data;
- }
+ if (page < high_memory)
+ *(unsigned long *) (page + (addr & ~PAGE_MASK)) = data;
/* we're bypassing pagetables, so we have to set the dirty bit ourselves */
/* this should also re-instate whatever read-only mode there was before */
*pgtable = pte_mkdirty(mk_pte(page, vma->vm_page_prot));
----------