lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f4884091-8448-bebc-61f1-4af3226ca00d@redhat.com>
Date:   Wed, 29 Sep 2021 18:10:24 +0200
From:   David Hildenbrand <david@...hat.com>
To:     Uladzislau Rezki <urezki@...il.com>
Cc:     LKML <linux-kernel@...r.kernel.org>, Ping Fang <pifang@...hat.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Roman Gushchin <guro@...com>, Michal Hocko <mhocko@...e.com>,
        Oscar Salvador <osalvador@...e.de>,
        Linux Memory Management List <linux-mm@...ck.org>
Subject: Re: [PATCH v1] mm/vmalloc: fix exact allocations with an alignment >
 1

On 29.09.21 18:08, Uladzislau Rezki wrote:
>>> Could you please to be more specific? I mean how is it connected with huge
>>> pages mappings? Huge-pages are which have order > 0. Or you mean that
>>> a special alignments are needed for mapping huge pages?
>>
>> Let me try to clarify:
>>
>>
>> KASAN does an exact allocation when onlining a memory block,
>> __vmalloc_node_range() will try placing huge pages first, increasing the
>> alignment to e.g., "1 << PMD_SHIFT".
>>
>> If we increase the search length in find_vmap_lowest_match(), that
>> search will fail if the exact allocation is surrounded by other
>> allocations. In that case, we won't place a huge page although we could
>> -- because find_vmap_lowest_match() would be imprecise for alignments >
>> PAGE_SIZE.
>>
>>
>> Memory blocks we online/offline on x86 are at least 128MB. The KASAN
>> "overhead" we have to allocate is 1/8 of that -- 16 MB, so essentially 8
>> huge pages.
>>
>> __vmalloc_node_range() will increase the alignment to 2MB to try placing
>> huge pages first. find_vmap_lowest_match() will search within the given
>> exact 16MB are a 18MB area (size + align), which won't work. So
>> __vmalloc_node_range() will fallback to the original PAGE_SIZE alignment
>> and shift=PAGE_SHIFT.
>>
>> __vmalloc_area_node() will set the set_vm_area_page_order effectively to
>> 0 --  small pages.
>>
>> Does that make sense or am I missing something?
>>
> Thank you for clarification. OK, we come back anyway to the "problem" with fixed
> range and an exact allocation plus a special alignment > PAGE_SIZE. Thus the
> KASAN will not make use of huge pages mappings and go with regular instead
> as a fallback path. But we would like to utilize huge-mappings for KASAN.
> 
> I will send the patch you tested and add your "tested-by" tag. Does it
> sound good?

Feel free to add

Tested-by: David Hildenbrand <david@...hat.com>
Reviewed-by: David Hildenbrand <david@...hat.com>

Thanks!

-- 
Thanks,

David / dhildenb

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ