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] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 18 Apr 2020 09:32:54 +0800 (GMT+08:00)
From:   赵军奎 <bernard@...o.com>
To:     Christopher Lameter <cl@...ux.com>
Cc:     Pekka Enberg <penberg@...nel.org>,
        David Rientjes <rientjes@...gle.com>,
        Joonsoo Kim <iamjoonsoo.kim@....com>,
        Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org, kernel@...o.com
Subject: Re:Re: [PATCH] kmalloc_index optimization(add kmalloc max size check)



From: Christopher Lameter <cl@...ux.com>
Date: 2020-04-17 23:59:00
To:  Bernard Zhao <bernard@...o.com>
Cc:  Pekka Enberg <penberg@...nel.org>,David Rientjes <rientjes@...gle.com>,Joonsoo Kim <iamjoonsoo.kim@....com>,Andrew Morton <akpm@...ux-foundation.org>,linux-mm@...ck.org,linux-kernel@...r.kernel.org,kernel@...o.com
Subject: Re: [PATCH] kmalloc_index optimization(add kmalloc max size check)>On Fri, 17 Apr 2020, Bernard Zhao wrote:
>
>> kmalloc size should never exceed KMALLOC_MAX_SIZE.
>> kmalloc_index realise if size is exceed KMALLOC_MAX_SIZE, e.g 64M,
>> kmalloc_index just return index 26, but never check with OS`s max
>> kmalloc config KMALLOC_MAX_SIZE. This index`s kmalloc caches maybe
>> not create in function create_kmalloc_caches.
>> We can throw an warninginfo in kmalloc at the beginning, instead of
>> being guaranteed by the buddy alloc behind.
>
>kmalloc_index(0 already bugs if the allocation is more than 64M
>
>
>...
>
>   if (size <=  64 * 1024 * 1024) return 26;
>        BUG();
>
>
>You could modify that to check for KMALLOC_MAX_SIZE with some more
>conditionals but then kmalloc_index) is written so that the compiler gets
>constant folding right.
>
>If you have a patch like that then please verify that all c compilers in
>use perform correct constant folding and do not add unnecessary code.
>
>

Sorry for the misunderstanding.
What I meant was that the “if”in kmalloc_index should be consistent 
with KMALLOC_MAX_SIZE. For example, if the MAX_ZONEORDER configured 
by the kernel is 11, which is 4M, then size >4M should trigger BUG(). If the 
configuration is smaller, e.g MAX_ZONEORDER is 9, 1M, then the size > 1M 
should be BUG. 
But the current code is not, kmalloc_index will only be BUG() when it exceeds 64M.




Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ