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]
Message-ID: <d64a4593-c9bd-42c7-81f6-137a22ff5caa@intel.com>
Date: Tue, 29 Apr 2025 09:06:19 -0700
From: Dave Hansen <dave.hansen@...el.com>
To: Mike Rapoport <rppt@...nel.org>
Cc: Changyuan Lyu <changyuanl@...gle.com>, linux-kernel@...r.kernel.org,
 akpm@...ux-foundation.org, anthony.yznaga@...cle.com, arnd@...db.de,
 ashish.kalra@....com, benh@...nel.crashing.org, bp@...en8.de,
 catalin.marinas@....com, corbet@....net, dave.hansen@...ux.intel.com,
 devicetree@...r.kernel.org, dwmw2@...radead.org, ebiederm@...ssion.com,
 graf@...zon.com, hpa@...or.com, jgowans@...zon.com,
 kexec@...ts.infradead.org, krzk@...nel.org,
 linux-arm-kernel@...ts.infradead.org, linux-doc@...r.kernel.org,
 linux-mm@...ck.org, luto@...nel.org, mark.rutland@....com, mingo@...hat.com,
 pasha.tatashin@...een.com, pbonzini@...hat.com, peterz@...radead.org,
 ptyadav@...zon.de, robh@...nel.org, rostedt@...dmis.org,
 saravanak@...gle.com, skinsburskii@...ux.microsoft.com, tglx@...utronix.de,
 thomas.lendacky@....com, will@...nel.org, x86@...nel.org
Subject: Re: [PATCH v6 11/14] x86: add KHO support

On 4/29/25 01:06, Mike Rapoport wrote:
> On Mon, Apr 28, 2025 at 03:05:55PM -0700, Dave Hansen wrote:
>> On 4/10/25 22:37, Changyuan Lyu wrote:
>>> From: Alexander Graf <graf@...zon.com>
>>>
>>> +/*
>>> + * If KHO is active, only process its scratch areas to ensure we are not
>>> + * stepping onto preserved memory.
>>> + */
>>
>> Same thing on the imperative voice here.
>>
>> I'm also not fully understanding the comment. Do these "scratch" regions
>> basically represent all the memory that's not being handed over? It's
>> not obvious.
> 
> Scratch memory represents areas created at the boot of the first kernel and
> it's known that scratch areas won't contain any memory that's being handed
> over.
>  
>>> diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
>>> index 57120f0749cc3..c314212a5ecd5 100644
>>> --- a/arch/x86/kernel/e820.c
>>> +++ b/arch/x86/kernel/e820.c
>>> @@ -1300,6 +1300,24 @@ void __init e820__memblock_setup(void)
>>>  		memblock_add(entry->addr, entry->size);
>>>  	}
>>>  
>>> +	/*
>>> +	 * At this point with KHO we only allocate from scratch memory.
>>> +	 * At the same time, we configure memblock to only allow
>>> +	 * allocations from memory below ISA_END_ADDRESS which is not
>>> +	 * a natural scratch region, because Linux ignores memory below
>>> +	 * ISA_END_ADDRESS at runtime. Beside very few (if any) early
>>> +	 * allocations, we must allocate real-mode trapoline below
>>
>> 						trampoline ^
>>
>>> +	 * ISA_END_ADDRESS.
>>> +	 *
>>> +	 * To make sure that we can actually perform allocations during
>>> +	 * this phase, let's mark memory below ISA_END_ADDRESS as scratch
>>> +	 * so we can allocate from there in a scratch-only world.
>>> +	 *
>>> +	 * After real mode trampoline is allocated, we clear scratch
>>> +	 * marking from the memory below ISA_END_ADDRESS
>>> +	 */
>>> +	memblock_mark_kho_scratch(0, ISA_END_ADDRESS);
>>
>> This isn't making a whole ton of sense to me.
>>
>> Is this *only* to facilitate possible users that need <ISA_END_ADDRESS
>> allocations? If so, please say that.
>>
>> I _think_ this is trying to say that KHO kernels are special and are
>> trying to only allocate from scratch areas. But <ISA_END_ADDRESS
>> allocations are both necessary and not marked by KHO _as_ a scratch area
>> which causes a problem.
> 
> Yes :)

So, on both of these, could the submitters please add or revise the
comments to make it more clear?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ