* [PATCH] arm64: add sentinel to kpti_safe_list
@ 2018-04-23 10:41 Mark Rutland
2018-04-23 16:19 ` Suzuki K Poulose
0 siblings, 1 reply; 4+ messages in thread
From: Mark Rutland @ 2018-04-23 10:41 UTC (permalink / raw)
To: linux-arm-kernel
We're missing a sentinel entry in kpti_safe_list. Thus is_midr_in_range_list()
can walk past the end of kpti_safe_list. Depending on the contents of memory,
this could erroneously match a CPU's MIDR, cause a data abort, or other bad
outcomes.
Add the sentinel entry to avoid this.
Fixes: be5b299830c63ed7 ("arm64: capabilities: Add support for checks based on a list of MIDRs")
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Reported-by: Jan Kiszka <jan.kiszka@siemens.com>
Tested-by: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
---
arch/arm64/kernel/cpufeature.c | 1 +
1 file changed, 1 insertion(+)
As discussesd in [1].
Mark.
[1] https://lkml.kernel.org/r/97d99ad9-c5cf-a4d2-126a-2b39ffead0b3 at web.de
diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
index 536d572e5596..9d1b06d67c53 100644
--- a/arch/arm64/kernel/cpufeature.c
+++ b/arch/arm64/kernel/cpufeature.c
@@ -868,6 +868,7 @@ static bool unmap_kernel_at_el0(const struct arm64_cpu_capabilities *entry,
static const struct midr_range kpti_safe_list[] = {
MIDR_ALL_VERSIONS(MIDR_CAVIUM_THUNDERX2),
MIDR_ALL_VERSIONS(MIDR_BRCM_VULCAN),
+ { /* sentinel */ }
};
char const *str = "command line option";
--
2.11.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] arm64: add sentinel to kpti_safe_list
2018-04-23 10:41 [PATCH] arm64: add sentinel to kpti_safe_list Mark Rutland
@ 2018-04-23 16:19 ` Suzuki K Poulose
2018-04-24 10:19 ` Mark Rutland
0 siblings, 1 reply; 4+ messages in thread
From: Suzuki K Poulose @ 2018-04-23 16:19 UTC (permalink / raw)
To: linux-arm-kernel
On 23/04/18 11:41, Mark Rutland wrote:
> We're missing a sentinel entry in kpti_safe_list. Thus is_midr_in_range_list()
> can walk past the end of kpti_safe_list. Depending on the contents of memory,
> this could erroneously match a CPU's MIDR, cause a data abort, or other bad
> outcomes.
>
> Add the sentinel entry to avoid this.
>
> Fixes: be5b299830c63ed7 ("arm64: capabilities: Add support for checks based on a list of MIDRs")
> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> Reported-by: Jan Kiszka <jan.kiszka@siemens.com>
> Tested-by: Jan Kiszka <jan.kiszka@siemens.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
> Cc: Will Deacon <will.deacon@arm.com>
> ---
> arch/arm64/kernel/cpufeature.c | 1 +
> 1 file changed, 1 insertion(+)
>
> As discussesd in [1].
>
> Mark.
>
> [1] https://lkml.kernel.org/r/97d99ad9-c5cf-a4d2-126a-2b39ffead0b3 at web.de
>
> diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
> index 536d572e5596..9d1b06d67c53 100644
> --- a/arch/arm64/kernel/cpufeature.c
> +++ b/arch/arm64/kernel/cpufeature.c
> @@ -868,6 +868,7 @@ static bool unmap_kernel_at_el0(const struct arm64_cpu_capabilities *entry,
> static const struct midr_range kpti_safe_list[] = {
> MIDR_ALL_VERSIONS(MIDR_CAVIUM_THUNDERX2),
> MIDR_ALL_VERSIONS(MIDR_BRCM_VULCAN),
> + { /* sentinel */ }
> };
> char const *str = "command line option";
Thanks for the report and the fix.
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] arm64: add sentinel to kpti_safe_list
2018-04-23 16:19 ` Suzuki K Poulose
@ 2018-04-24 10:19 ` Mark Rutland
2018-04-24 10:24 ` Will Deacon
0 siblings, 1 reply; 4+ messages in thread
From: Mark Rutland @ 2018-04-24 10:19 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Apr 23, 2018 at 05:19:38PM +0100, Suzuki K Poulose wrote:
> On 23/04/18 11:41, Mark Rutland wrote:
> > We're missing a sentinel entry in kpti_safe_list. Thus is_midr_in_range_list()
> > can walk past the end of kpti_safe_list. Depending on the contents of memory,
> > this could erroneously match a CPU's MIDR, cause a data abort, or other bad
> > outcomes.
> >
> > Add the sentinel entry to avoid this.
> >
> > Fixes: be5b299830c63ed7 ("arm64: capabilities: Add support for checks based on a list of MIDRs")
> > Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> > Reported-by: Jan Kiszka <jan.kiszka@siemens.com>
> > Tested-by: Jan Kiszka <jan.kiszka@siemens.com>
> > Cc: Catalin Marinas <catalin.marinas@arm.com>
> > Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
> > Cc: Will Deacon <will.deacon@arm.com>
> > ---
> > arch/arm64/kernel/cpufeature.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > As discussesd in [1].
> >
> > Mark.
> >
> > [1] https://lkml.kernel.org/r/97d99ad9-c5cf-a4d2-126a-2b39ffead0b3 at web.de
> >
> > diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
> > index 536d572e5596..9d1b06d67c53 100644
> > --- a/arch/arm64/kernel/cpufeature.c
> > +++ b/arch/arm64/kernel/cpufeature.c
> > @@ -868,6 +868,7 @@ static bool unmap_kernel_at_el0(const struct arm64_cpu_capabilities *entry,
> > static const struct midr_range kpti_safe_list[] = {
> > MIDR_ALL_VERSIONS(MIDR_CAVIUM_THUNDERX2),
> > MIDR_ALL_VERSIONS(MIDR_BRCM_VULCAN),
> > + { /* sentinel */ }
> > };
> > char const *str = "command line option";
>
> Thanks for the report and the fix.
>
> Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Cheers!
Catalin, are you happy to pick this up as a fix for -rc3?
Thanks,
Mark.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] arm64: add sentinel to kpti_safe_list
2018-04-24 10:19 ` Mark Rutland
@ 2018-04-24 10:24 ` Will Deacon
0 siblings, 0 replies; 4+ messages in thread
From: Will Deacon @ 2018-04-24 10:24 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Apr 24, 2018 at 11:19:55AM +0100, Mark Rutland wrote:
> On Mon, Apr 23, 2018 at 05:19:38PM +0100, Suzuki K Poulose wrote:
> > On 23/04/18 11:41, Mark Rutland wrote:
> > > We're missing a sentinel entry in kpti_safe_list. Thus is_midr_in_range_list()
> > > can walk past the end of kpti_safe_list. Depending on the contents of memory,
> > > this could erroneously match a CPU's MIDR, cause a data abort, or other bad
> > > outcomes.
> > >
> > > Add the sentinel entry to avoid this.
> > >
> > > Fixes: be5b299830c63ed7 ("arm64: capabilities: Add support for checks based on a list of MIDRs")
> > > Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> > > Reported-by: Jan Kiszka <jan.kiszka@siemens.com>
> > > Tested-by: Jan Kiszka <jan.kiszka@siemens.com>
> > > Cc: Catalin Marinas <catalin.marinas@arm.com>
> > > Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
> > > Cc: Will Deacon <will.deacon@arm.com>
> > > ---
> > > arch/arm64/kernel/cpufeature.c | 1 +
> > > 1 file changed, 1 insertion(+)
> > >
> > > As discussesd in [1].
> > >
> > > Mark.
> > >
> > > [1] https://lkml.kernel.org/r/97d99ad9-c5cf-a4d2-126a-2b39ffead0b3 at web.de
> > >
> > > diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
> > > index 536d572e5596..9d1b06d67c53 100644
> > > --- a/arch/arm64/kernel/cpufeature.c
> > > +++ b/arch/arm64/kernel/cpufeature.c
> > > @@ -868,6 +868,7 @@ static bool unmap_kernel_at_el0(const struct arm64_cpu_capabilities *entry,
> > > static const struct midr_range kpti_safe_list[] = {
> > > MIDR_ALL_VERSIONS(MIDR_CAVIUM_THUNDERX2),
> > > MIDR_ALL_VERSIONS(MIDR_BRCM_VULCAN),
> > > + { /* sentinel */ }
> > > };
> > > char const *str = "command line option";
> >
> > Thanks for the report and the fix.
> >
> > Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
>
> Cheers!
>
> Catalin, are you happy to pick this up as a fix for -rc3?
Already got it queued locally.
Will
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-04-24 10:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-23 10:41 [PATCH] arm64: add sentinel to kpti_safe_list Mark Rutland
2018-04-23 16:19 ` Suzuki K Poulose
2018-04-24 10:19 ` Mark Rutland
2018-04-24 10:24 ` Will Deacon
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.