[linux-mm-cc] [PATCH] Fix integer overflow bug (was: module param size too big fix up)

John McCabe-Dansted gmatht at gmail.com
Tue Apr 29 03:08:30 EDT 2008


On Tue, Apr 29, 2008 at 12:30 PM, Nitin Gupta <nitingupta910 at gmail.com>
wrote:
>
> > We could probably eliminate the need for compcache.size by going direct
> from
> > _kbytes to num_pages, allowing ~4TB devices. Using only num_pages  would
> > increase the max size of compcache to ~16TB and simplify the compcache
> code
> > somewhat. Unfortunately it seem  hard to get at PAGE_SIZE from
> userspace.
>
> There are lot more issues with increasing size to such huge values.
> For e.g. table[] is currently a simple array


I was thinking that this should be converted to an array of void*. All extra
information could be stored in the tlsf allocated chunk. However this won't
do much good until we are able to page out to disk.


> which will eat all memory
> for such large
> compcache device sizes


Not necessarily. Current AMD processors support 256 exabytes of physical
ram, (rather than the mere 1TB of early AMD64 processors). On such machines
these sizes could be feasible.

In any case there is an integer overflow that can cause the compcache module
to become broken. I have attached a patch that will cap the compcache size
to avoid integer overflow.

--

An confusing and perhaps amusing fact:
linux-headers-2.6.24-16/include/linux/reiserfs_fs.h
contains:

#define MAX_UL_INT 0xffffffff
#define MAX_INT    0x7ffffff
#define MAX_US_INT 0xffff

I don't know why reiserfs sets MAX_INT to  0x7ffffff. Is it meant to be
portable to 28-bit architectures or what?

-- 
John C. McCabe-Dansted
PhD Student
University of Western Australia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.laptop.org/pipermail/linux-mm-cc/attachments/20080429/15913bf1/attachment.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix_compcachesize_overflow.patch
Type: text/x-diff
Size: 1221 bytes
Desc: not available
Url : http://lists.laptop.org/pipermail/linux-mm-cc/attachments/20080429/15913bf1/attachment.patch 


More information about the linux-mm-cc mailing list