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:   Mon, 14 Feb 2022 15:41:19 -0800 (PST)
From:   Palmer Dabbelt <palmer@...belt.com>
To:     alex@...ti.fr
CC:     jszhang@...nel.org, Paul Walmsley <paul.walmsley@...ive.com>,
        aou@...s.berkeley.edu, linux-riscv@...ts.infradead.org,
        linux-kernel@...r.kernel.org
Subject:     Re: [PATCH] riscv: mm: remove the BUG_ON check of mapping the last 4K bytes of memory

On Tue, 25 Jan 2022 08:10:41 PST (-0800), alex@...ti.fr wrote:
>
> On 1/25/22 16:55, Jisheng Zhang wrote:
>> remove the BUG_ON check of mapping the last 4K bytes of the addressable
>> memory since "this is true for every kernel actually" as pointed out
>> by Alexandre.
>>
>> Signed-off-by: Jisheng Zhang <jszhang@...nel.org>
>> Reviewed-by: Alexandre Ghiti <alex@...ti.fr>
>> ---
>>   arch/riscv/mm/init.c | 8 --------
>>   1 file changed, 8 deletions(-)
>>
>> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
>> index cf4d018b7d66..8347d0fda8cd 100644
>> --- a/arch/riscv/mm/init.c
>> +++ b/arch/riscv/mm/init.c
>> @@ -811,14 +811,6 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa)
>>   	BUG_ON((PAGE_OFFSET % PGDIR_SIZE) != 0);
>>   	BUG_ON((kernel_map.phys_addr % PMD_SIZE) != 0);
>>
>> -#ifdef CONFIG_64BIT
>> -	/*
>> -	 * The last 4K bytes of the addressable memory can not be mapped because
>> -	 * of IS_ERR_VALUE macro.
>> -	 */
>> -	BUG_ON((kernel_map.virt_addr + kernel_map.size) > ADDRESS_SPACE_END - SZ_4K);
>> -#endif
>
>
> This BUG_ON seems pretty legit to me: I re-read the exchanges we had,
> and I see that I didn't notice that in your v2, you actually removed the
> BUG_ON. So that's my bad, what I meant in the first place was that the
> BUG_ON is true for 32-bit and 64-bit kernels actually.

There's actually an ifndef 64BIT above that sort of handles this case 
(though I didn't check to see if we're getting the limits correct, so it 
may not work properly).  That's shrinking the memory, rather than just 
firing a BUG, and it's not really any more code so we should go that way 
for both.  I could see leaving a BUG in there, maybe just explicitly 
using IS_ERR_VALUE as that's really what we're checking for (though if 
that's not 4K a bunch of stuff will break, so maybe it just doesn't 
matter).

> Sorry my RB was not right on this one :(
>
> Alex
>
>
>> -
>>   	pt_ops_set_early();
>>
>>   	/* Setup early PGD for fixmap */

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ