Re: *sigh* /proc/*/pagemap

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <akpm@...>, <mpm@...>
Cc: <linux-kernel@...>, <pagexec@...>
Date: Thursday, July 17, 2008 - 4:17 pm

> > >> 5) check with microscope allocation there -- page-aligned address and

Now that I unsuccessfully tried to reproduce multiplication wraparound (on 32-bit),
integer wraparound in kmalloc() simply can't happen here.

Relevant code from pagemap_read():

	uaddr = (unsigned long)buf & PAGE_MASK;
	uend = (unsigned long)(buf + count);
	pagecount = (PAGE_ALIGN(uend) - uaddr) / PAGE_SIZE;
	pages = kmalloc(pagecount * sizeof(struct page *), GFP_KERNEL);


pagecount is effectively "count / PAGE_SIZE", where "count" is size_t.
kmalloc() takes size_t as first argument, so one has to overflow

	count / PAGE_SIZE * sizeof(pointer).

For sure, page is bigger than pointer.

Anyone still see holes?

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: *sigh* /proc/*/pagemap, Alexey Dobriyan, (Thu Jul 17, 4:17 pm)