[PATCH 3/4] pmap: fix integer overflow

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This fixes an integer overflow in the /proc/*/maps files.
The size of a file may exceed the limit of unsigned long
on a 32-bit platform.

Some parsers will break if they encounter a mapping of a
file that has an offset which doesn't fit into unsigned long.
Parsers which need the offset to be correct will break
without this change though. Parsers which can not handle
large numbers are likely to get LONG_MAX from strtol().

Signed-off-by: Albert Cahalan <[email protected]>

---

This applies to -git4, grabbed Saturday night.


diff -Naurd 2/fs/proc/task_mmu.c 3/fs/proc/task_mmu.c
--- 2/fs/proc/task_mmu.c	2006-01-22 15:20:24.000000000 -0500
+++ 3/fs/proc/task_mmu.c	2006-01-22 15:26:54.000000000 -0500
@@ -135,14 +135,14 @@
 		ino = inode->i_ino;
 	}
 
-	seq_printf(m, "%08lx-%08lx %c%c%c%c %08lx %02x:%02x %lu %n",
+	seq_printf(m, "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu %n",
 			vma->vm_start,
 			vma->vm_end,
 			flags & VM_READ ? 'r' : '-',
 			flags & VM_WRITE ? 'w' : '-',
 			flags & VM_EXEC ? 'x' : '-',
 			flags & VM_MAYSHARE ? 's' : 'p',
-			vma->vm_pgoff << PAGE_SHIFT,
+			(unsigned long long)vma->vm_pgoff << PAGE_SHIFT,
 			MAJOR(dev), MINOR(dev), ino, &len);
 
 	/*
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux