Re: [PATCH] proc: fix pagemap_read() error case (was Re: [PATCH]proc: put check_mem_permission before __get_free_page in mem_read)

From: Stephen Wilson
Date: Tue Apr 26 2011 - 12:45:56 EST


On Tue, Apr 26, 2011 at 02:50:16PM +0900, KOSAKI Motohiro wrote:
> I've finished audit other /proc allocation callsite. If my understand
> is correct, only pagemap_read() has the same issue.

I think there is one additional location that might be worth looking at.
We have a kmalloc(struct numa_maps) happening in show_numa_map() (see
mempolicy.c). In this case there is an allocation/free cycle happening
for each vma as we generate the seq_file.

Unfortunately a fix might require a little work. Initial thinking
suggests that we perform a single allocation at numa_maps_open() time.
However, there is an odd layering/dependency issue between mempolicy.c
and task_mmu.c. A "simple clean fix" does not seem obvious to me.

I am very tempted to suggest we move the proc related stuff out of
mempolicy.c. However, see 1a75a6c8.

Thoughts? I can certainly look into this some more if needed.

--
steve

--
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/