linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Albert D. Cahalan" <acahalan@cs.uml.edu>
To: linux-kernel@vger.kernel.org, akpm@osdl.org, arjan@infradead.org
Subject: [PATCH 3/4] pmap: fix integer overflow
Date: Sun, 22 Jan 2006 17:17:58 -0500 (EST)	[thread overview]
Message-ID: <200601222217.k0MMHw1D216186@saturn.cs.uml.edu> (raw)


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

                 reply	other threads:[~2006-01-22 22:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200601222217.k0MMHw1D216186@saturn.cs.uml.edu \
    --to=acahalan@cs.uml.edu \
    --cc=akpm@osdl.org \
    --cc=arjan@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).