Re: [PATCH] mm: fix lazy vmap purging (use-after-free error)
From: Pekka Enberg
Date: Fri Feb 20 2009 - 08:58:19 EST
On Fri, Feb 20, 2009 at 3:50 PM, Ingo Molnar <mingo@xxxxxxx> wrote:
>> @@ -537,7 +538,7 @@ static void __purge_vmap_area_lazy(unsigned long *start, unsigned long *end,
>>
>> if (nr) {
>> spin_lock(&vmap_area_lock);
>> - list_for_each_entry(va, &valist, purge_list)
>> + list_for_each_entry_safe(va, n_va, &valist, purge_list)
>> __free_vmap_area(va);
>> spin_unlock(&vmap_area_lock);
>
> ah, indeed:
>
> list_del_rcu(&va->list);
>
> i suspect it could be hit big time in a workload that opens more
> than 512 files, as expand_files() uses a vmalloc()+vfree() pair
> in that case.
>
> Nice catch! .29 must-have. The bug was introduced in
> v2.6.27-5616-gdb64fe0:
>
> db64fe0: mm: rewrite vmap layer
>
> So 2.6.28 is affected too.
>
> Acked-by: Ingo Molnar <mingo@xxxxxxx>
Oh, I wish more people would run their code under kmemcheck... ;-)
--
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/