lkml.org 
[lkml]   [2019]   [Jun]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [BUG]: mm/vmalloc: uninitialized variable access in pcpu_get_vm_areas
On 2019-06-17 16:04, Arnd Bergmann wrote:
> On Mon, Jun 17, 2019 at 3:49 PM Roman Penyaev <rpenyaev@suse.de> wrote:
>> > augment_tree_propagate_from(va);
>> >
>> > - if (type == NE_FIT_TYPE)
>> > - insert_vmap_area_augment(lva, &va->rb_node,
>> > - &free_vmap_area_root, &free_vmap_area_list);
>> > - }
>> > -
>> > return 0;
>> > }
>>
>>
>> Hi Arnd,
>>
>> Seems the proper fix is just setting lva to NULL. The only place
>> where lva is allocated and then used is when type == NE_FIT_TYPE,
>> so according to my shallow understanding of the code everything
>> should be fine.
>
> I don't see how NULL could work here. insert_vmap_area_augment()
> passes the va pointer into find_va_links() and link_va(), both of
> which dereference the pointer, see

Exactly, but insert_vmap_area_augement() accepts 'va', not 'lva',
but in your variant 'va' is already freed (see type == FL_FIT_TYPE
branch, on top of that function). So that should be use-after-free.

--
Roman

\
 
 \ /
  Last update: 2019-06-17 16:41    [W:0.493 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site