public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrey Ryabinin <a.ryabinin@samsung.com>
To: Alexander Popov <alpopov@ptsecurity.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	Andrey Konovalov <adech.fo@gmail.com>,
	Denys Vlasenko <dvlasenk@redhat.com>,
	Andy Lutomirski <luto@amacapital.net>,
	Alexander Kuleshov <kuleshovmail@gmail.com>,
	Sergey Kovalev <SKovalev@ptsecurity.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] x86_64: fix KASan shadow region page tables
Date: Tue, 26 May 2015 11:52:26 +0300	[thread overview]
Message-ID: <5564344A.9060005@samsung.com> (raw)
In-Reply-To: <556326EA.10807@ptsecurity.com>

On 05/25/2015 04:43 PM, Alexander Popov wrote:
> On 25.05.2015 11:12, Andrey Ryabinin wrote:
>> On 05/22/2015 07:03 PM, Alexander Popov wrote:
>>> Physical addresses in KASan shadow region page tables need fixup:
>>> kernel halts without it if phys_base is not zero.
>>>
>>
>> Indeed.
>> Since we have to patch page tables anyway, compile-time created kasan
>> page tables become pointless.
>> So, I'd suggest to create them in runtime. This could be done in plain C
>> in kasan_map_early_shadow().
>>
> 
> Thanks for your reply, Andrey.
> 
> Creating kasan_zero_pud, kasan_zero_pmd and kasan_zero_pte in
> kasan_map_early_shadow() doesn't look handy for me because this function
> is called twice in x86_64_start_kernel().
> 
> What do you think about leaving the initialization of KASan shadow region
> page tables in arch/x86/kernel/head_64.S and calling something like
> kasan_fixup_early_shadow() before calling kasan_map_early_shadow()
> for the first time?
> 

Why do we have initialize + fixup later if we could simply initialize page tables properly?

Just move everything into kasan_init_64.c
kasan_zero_p* could be a normal C arrays (with __page_aligned_bss attribute).
Initialize these page tables in something like kasan_early_init() before kasan_map_early_shadow()
call.


> Best regards,
> Alexander
> 
> 


  reply	other threads:[~2015-05-26 15:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-22 16:03 [PATCH 1/1] x86_64: fix KASan shadow region page tables Alexander Popov
2015-05-25  8:12 ` Andrey Ryabinin
2015-05-25 13:43   ` Alexander Popov
2015-05-26  8:52     ` Andrey Ryabinin [this message]
2015-05-28  8:56       ` Alexander Popov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5564344A.9060005@samsung.com \
    --to=a.ryabinin@samsung.com \
    --cc=SKovalev@ptsecurity.com \
    --cc=adech.fo@gmail.com \
    --cc=alpopov@ptsecurity.com \
    --cc=dvlasenk@redhat.com \
    --cc=hpa@zytor.com \
    --cc=kuleshovmail@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox