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: <556F0ACA.6020402@ptsecurity.com>
Date:	Wed, 3 Jun 2015 17:10:18 +0300
From:	Alexander Popov <alpopov@...ecurity.com>
To:	Andrey Ryabinin <a.ryabinin@...sung.com>,
	Ingo Molnar <mingo@...nel.org>
CC:	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>,
	Andrey Konovalov <adech.fo@...il.com>,
	"Andrew Morton" <akpm@...ux-foundation.org>,
	Kees Cook <keescook@...omium.org>,
	"Peter Zijlstra (Intel)" <peterz@...radead.org>,
	Andy Lutomirski <luto@...capital.net>,
	Alexander Kuleshov <kuleshovmail@...il.com>,
	"Borislav Petkov" <bp@...e.de>,
	Denys Vlasenko <dvlasenk@...hat.com>, <x86@...nel.org>,
	<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 1/1] x86_64: fix KASan shadow region page tables

On 03.06.2015 11:44, Andrey Ryabinin wrote:
> On 06/03/2015 10:44 AM, Ingo Molnar wrote:
>>
>> * Alexander Popov <alpopov@...ecurity.com> wrote:
>>
>>>  #ifdef CONFIG_KASAN
>>>  void __init kasan_map_early_shadow(pgd_t *pgd);
>>> +void __init kasan_early_init(void);
>>>  void __init kasan_init(void);
>>>  #else
>>>  static inline void kasan_map_early_shadow(pgd_t *pgd) { }
>>> +static inline void kasan_early_init(void) { }
>>>  static inline void kasan_init(void) { }
>>>  #endif
>>>  
>>> diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
>>> index 2b55ee6..e9a84a1 100644
>>> --- a/arch/x86/kernel/head64.c
>>> +++ b/arch/x86/kernel/head64.c
>>> @@ -161,11 +161,15 @@ asmlinkage __visible void __init x86_64_start_kernel(char * real_mode_data)
>>>  	/* Kill off the identity-map trampoline */
>>>  	reset_early_page_tables();
>>>  
>>> -	kasan_map_early_shadow(early_level4_pgt);
>>> -
>>> -	/* clear bss before set_intr_gate with early_idt_handler */
>>> +	/*
>>> +	 * Clear bss before kasan_early_init and set_intr_gate
>>> +	 * with early_idt_handler
>>> +	 */
>>>  	clear_bss();
>>>  
>>> +	kasan_early_init();
>>> +	kasan_map_early_shadow(early_level4_pgt);
>>
>> So why isn't kasan_map_early_shadow() called in kasan_early_init()?
>>
>> High level x86 init code should not be polluted with too many low level details.
>>
> 
> Agreed. Eventually, with the patch bellow, we could get rid of the second
> kasan_map_early_shadow(init_level4_pgt) call in x86_64_start_kernel().
> Make it static, and call it from kasan_early_init() only.
> 
> ------------------------------------------------------
> From: Andrey Ryabinin <a.ryabinin@...sung.com>
> Subject: [PATCH] x86_64: remove not needed clear_page for init_level4_page
> 
> Commit 8170e6bed465 ("x86, 64bit: Use a #PF handler to materialize
> early mappings on demand") introduced clear_page(init_level4_pgt);
> call in x86_64_start_kernel(). However, this clear_page is useless
> because init_level4_page already filled with zeroes in head_64.S
> 
> Commit message in 8170e6bed465 says that this clear_page() was
> dropped in v7, but it accidentally reappeared in later versions
> of that patchset.
> 
> Signed-off-by: Andrey Ryabinin <a.ryabinin@...sung.com>
> ---
>  arch/x86/kernel/head64.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
> index 5a46681..6a6eefd 100644
> --- a/arch/x86/kernel/head64.c
> +++ b/arch/x86/kernel/head64.c
> @@ -177,7 +177,6 @@ asmlinkage __visible void __init x86_64_start_kernel(char * real_mode_data)
>  	 */
>  	load_ucode_bsp();
> 
> -	clear_page(init_level4_pgt);
>  	/* set init_level4_pgt kernel high mapping*/
>  	init_level4_pgt[511] = early_level4_pgt[511];
> 

Hello Ingo and Andrey.

Should I make a "patch series" containing Andrey's patch and the 5'th version
of my patch or just include changes from Andrey's patch into mine?

Best regards,
Alexander
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ