[parisc-linux-cvs] kernel patches

John Marvin jsm@udlkern.fc.hp.com
Wed, 30 May 2001 08:06:13 -0600 (MDT)


The following are two patches to fix two different kernel bugs.
The patch to mmap.c fixes a problem with get_shared_area() which was
causing it to allocate address ranges that overlapped existing ranges.
Note: this bug was causing a problem with apt-get.

The second patch (entry.S) fixes a bug where a signal handler would get
called with the wrong space if an interrupt came in while executing the
delay slot of a branch to the gateway page.

John

--- mmap.c.old	Wed May 30 02:54:02 2001
+++ mmap.c	Wed May 30 07:39:37 2001
@@ -388,7 +388,7 @@ free_vma:
  */
 #ifndef HAVE_ARCH_UNMAPPED_AREA
 
-#define DCACHE_ALIGN(addr) ((addr) &~ (SHMLBA - 1))
+#define DCACHE_ALIGN(addr) (((addr) + (SHMLBA - 1)) &~ (SHMLBA - 1))
 
 unsigned long get_shared_area(unsigned long addr, unsigned long len, unsigned int offset)
 {
@@ -408,6 +408,8 @@ unsigned long get_shared_area(unsigned l
 		if (!vmm || addr + len <= vmm->vm_start)
 			return addr;
 		addr = DCACHE_ALIGN(vmm->vm_end - offset) + offset;
+		if (addr < vmm->vm_end) /* handle wraparound */
+			return 0;
 	}
 }
 
--- entry.S.old	Tue May 22 05:06:30 2001
+++ entry.S	Wed May 30 07:07:30 2001
@@ -772,6 +772,9 @@ intr_do_signal:
 	LDREG   PT_IASQ0(%r16), %r20
 	CMPIB= 0,%r20,intr_restore /* backward */
 	nop
+	LDREG   PT_IASQ1(%r16), %r20
+	CMPIB= 0,%r20,intr_restore /* backward */
+	nop
 
 	copy	%r0, %r24			/* unsigned long in_syscall */
 	copy	%r16, %r25			/* struct pt_regs *regs */