linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/4] pmap: fix integer overflow
@ 2006-01-22 22:17 Albert D. Cahalan
  0 siblings, 0 replies; only message in thread
From: Albert D. Cahalan @ 2006-01-22 22:17 UTC (permalink / raw)
  To: linux-kernel, akpm, arjan


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 <acahalan@gmail.com>

---

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);
 
 	/*

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-01-22 22:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-22 22:17 [PATCH 3/4] pmap: fix integer overflow Albert D. Cahalan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).