Re: new procfs memory analysis feature

From: david singleton
Date: Thu Dec 07 2006 - 20:53:27 EST



On Dec 7, 2006, at 5:46 PM, Andrew Morton wrote:

On Thu, 7 Dec 2006 17:07:22 -0800
david singleton <dsingleton@xxxxxxxxxx> wrote:

Attached is the 2.6.19 patch.

It still has the overflow bug.
+ do {
+ ptent = *pte;
+ if (pte_present(ptent)) {
+ page = vm_normal_page(vma, addr, ptent);
+ if (page) {
+ if (pte_dirty(ptent))
+ mapcount = -page_mapcount(page);
+ else
+ mapcount = page_mapcount(page);
+ } else {
+ mapcount = 1;
+ }
+ }
+ seq_printf(m, " %d", mapcount);
+
+ } while (pte++, addr += PAGE_SIZE, addr != end);

Well that's cute. As long as both seq_file and pte-pages are of size
PAGE_SIZE, and as long as pte's are more than three bytes, this will not
overflow the seq_file output buffer.

hm. Unless the pages are all dirty and the mapcounts are all 10000. I
think it will overflow then?


I guess that could happen? Any suggestions?

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/