linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Hanjun Guo <guohanjun@huawei.com>
To: Will Deacon <will.deacon@arm.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	John Garry <john.garry@huawei.com>,
	Linuxarm <linuxarm@huawei.com>, James Morse <james.morse@arm.com>,
	huangdaode <huangdaode@hisilicon.com>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] arm64: kpti: Update arm64_kernel_use_ng_mappings() when forced on
Date: Fri, 1 Mar 2019 21:34:47 +0800	[thread overview]
Message-ID: <77817698-a37a-1860-8d1f-39344b058260@huawei.com> (raw)
In-Reply-To: <20190301130237.GA23344@fuggles.cambridge.arm.com>

On 2019/3/1 21:02, Will Deacon wrote:
> On Fri, Mar 01, 2019 at 08:59:19PM +0800, Hanjun Guo wrote:
>> On 2019/3/1 19:46, Ard Biesheuvel wrote:
>>> On Fri, 1 Mar 2019 at 12:45, Will Deacon <will.deacon@arm.com> wrote:
>>>>
>>>> On Fri, Mar 01, 2019 at 12:43:01PM +0100, Ard Biesheuvel wrote:
>>>>> On Fri, 1 Mar 2019 at 12:35, Will Deacon <will.deacon@arm.com> wrote:
>>>>>>
>>>>>> On Fri, Mar 01, 2019 at 11:18:21AM +0000, John Garry wrote:
>>>>>>> On 16/01/2019 09:38, John Garry wrote:
>>>>>>>> On 15/01/2019 18:49, James Morse wrote:
>>>>>>>>> Since commit b89d82ef01b3 ("arm64: kpti: Avoid rewriting early page
>>>>>>>>
>>>>>>>> About b89d82ef01b3, I got an *unconfirmed* (emphasis on this, I don't
>>>>>>>> want to cry wolf) report yesterday that the symptom I saw (boot delay)
>>>>>>>> has been seen on 5.0-rc2 on our D06 board. I could not see it.
>>>>>>>>
>>>>>>>> Please note that this would be same board which we saw this on:
>>>>>>>> https://lkml.org/lkml/2018/6/20/589
>>>>>>>>
>>>>>>>> I only witnessed the issue on the predecessor A72-based D05 board.
>>>>>>>>
>>>>>>>> The reporter is very busy, but we'll keep tabs on it.
>>>>>>>>
>>>>>>>
>>>>>>> FYI, this just came in this morning:
>>>>>>
>>>>>> This isn't completely surprising, because the kernel doesn't know about
>>>>>> the CPU in D06:
>>>>>>
>>>>>>> [    0.000000] Booting Linux on physical CPU 0x0000010000 [0x480fd010]
>>>>>>
>>>>>> [...]
>>>>>>
>>>>>>> [    0.000000] CPU features: detected: Kernel page table isolation (KPTI)
>>>>>>
>>>>>> If the CPU is not affected by meltdown, you can add the MIDR above to the
>>>>>> kpti_safe_list[] table. If it *is* affected by meltdown, then I'm afraid
>>>>>> that you're stuck with the delay at boot for !KASLR kernels (which is an
>>>>>> awful lot better than getting pwned by userspace :)
>>>>>>
>>>>>> I think D06 is 8.2, so I would've hoped that you'd implemented
>>>>>> AA64PFR0_EL1.CSV3, which would make this MIDR-based whitelisting
>>>>>> unnecessary.
>>
>> D06 has the function of AA64PFR0_EL1.CSV3 but didn't set the bit, and
>> it's not affected by meltdown...
>>
>>>>>>
>>>>>
>>>>> Note that this is also still tied to the new rodata handling. The new
>>>>> default is rodata=full, and reverting back to rodata=on (which used to
>>>>> be the default in prior releases) or rodata=off (not recommended)
>>>>> should get around this as well.
>>>>
>>>> Or, somewhat perversely, enabling CONFIG_RANDOMIZE_BASE and passing a
>>>> valid kaslr seed. Performance /and/ security!
>>>>
>>>
>>> Yeah but unfortunately, it seems the UEFI on that box does not
>>> implement EFI_RNG_PROTOCOL.
>>
>> Eagle eye :) So if we implement EFI_RNG_PROTOCOL (will take some time) in
>> firmware and enable CONFIG_RANDOMIZE_BASE, the issue will gone, right?
> 
> Yup, but you can also update the MIDR whitelist since you're not affected by
> meltdown.

Thanks for the guidance, Performance /and/ security is what I prefer :)

I take a look at the code, the logic in unmap_kernel_at_el0() shows that
even I add D06's CPU in kpti_safe_list[] table, I can still enable
CONFIG_RANDOMIZE_BASE + UEFI EFI_RNG_PROTOCOL to get performance and
security.

So it would be useful to prepare a patch to add D06 CPU's MIDR to
kpti_safe_list[] table, to prevent some mis-use case such as above.

Thanks
Hanjun


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

      reply	other threads:[~2019-03-01 13:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-15 18:49 [PATCH] arm64: kpti: Update arm64_kernel_use_ng_mappings() when forced on James Morse
2019-01-16  9:38 ` John Garry
2019-01-16 10:33   ` James Morse
     [not found]   ` <835dc899-578c-d914-4ed3-fa8b3b391ae6@huawei.com>
2019-03-01 11:35     ` Will Deacon
2019-03-01 11:43       ` Ard Biesheuvel
2019-03-01 11:45         ` Will Deacon
2019-03-01 11:46           ` Ard Biesheuvel
2019-03-01 12:59             ` Hanjun Guo
2019-03-01 13:02               ` Will Deacon
2019-03-01 13:34                 ` Hanjun Guo [this message]

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=77817698-a37a-1860-8d1f-39344b058260@huawei.com \
    --to=guohanjun@huawei.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=catalin.marinas@arm.com \
    --cc=huangdaode@hisilicon.com \
    --cc=james.morse@arm.com \
    --cc=john.garry@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linuxarm@huawei.com \
    --cc=will.deacon@arm.com \
    /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;
as well as URLs for NNTP newsgroup(s).