From: "liusong" <liusong@linux.alibaba.com>
To: "Will Deacon" <will@kernel.org>
Cc: "catalin.marinas" <catalin.marinas@arm.com>,
"linux-arm-kernel" <linux-arm-kernel@lists.infradead.org>,
"linux-kernel" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] arm64: cpufeature: make sure cpu_mitigations_off then kpti off
Date: Fri, 24 Jun 2022 09:45:22 +0800 [thread overview]
Message-ID: <75a92083-ccbd-4584-92e3-63df177feb7b.liusong@linux.alibaba.com> (raw)
In-Reply-To: <20220623172730.GA16966@willie-the-truck>
>On Thu, Jun 16, 2022 at 08:35:38PM +0800, Liu Song wrote:
>> From: Liu Song <liusong@linux.alibaba.com>
>>
>> If kaslr is enabled, kpti cannot be turned off even if "mitigations=off",
>> adjust the code order to ensure that kpti is off when "mitigations=off".
>>
>> Signed-off-by: Liu Song <liusong@linux.alibaba.com>
>> ---
>> arch/arm64/kernel/cpufeature.c | 10 +++++-----
>> 1 file changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
>> index 42ea2bd..27d4850 100644
>> --- a/arch/arm64/kernel/cpufeature.c
>> +++ b/arch/arm64/kernel/cpufeature.c
>> @@ -1616,6 +1616,11 @@ static bool unmap_kernel_at_el0(const struct arm64_cpu_capabilities *entry,
>> __kpti_forced = -1;
>> }
>>
>> + if (cpu_mitigations_off() && !__kpti_forced) {
>> + str = "mitigations=off";
>> + __kpti_forced = -1;
>> + }
>> +
>> /* Useful for KASLR robustness */
>> if (kaslr_requires_kpti()) {
>> if (!__kpti_forced) {
>> @@ -1624,11 +1629,6 @@ static bool unmap_kernel_at_el0(const struct arm64_cpu_capabilities *entry,
>> }
>> }
>>
>> - if (cpu_mitigations_off() && !__kpti_forced) {
>> - str = "mitigations=off";
>> - __kpti_forced = -1;
>> - }
>
>The current behaviour is intentional: KASLR is trivial to bypass when kpti
>is disabled.
>
>Will
Hi
According to the description of mitigaions=off in kernel-parameters.txt,
it is equivalent to kpti=0 under ARM64, so the description here will mislead
users. I have proposed a patch to fix this.
Thanks
prev parent reply other threads:[~2022-06-24 1:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-16 12:35 Liu Song
2022-06-23 17:27 ` Will Deacon
2022-06-24 1:45 ` liusong [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=75a92083-ccbd-4584-92e3-63df177feb7b.liusong@linux.alibaba.com \
--to=liusong@linux.alibaba.com \
--cc=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=will@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
all inboxes | Powered by JetHome®