[v4.9.y,00/27] arm64 meltdown patches

Message ID 20180403110923.43575-1-mark.rutland@arm.com
Headers show
Series
  • arm64 meltdown patches
Related show

Message

Mark Rutland April 3, 2018, 11:08 a.m.
Hi Greg,

These patches backport KPTI to v4.9.y (based on v4.9.92), providing protection
against meltdown on arm64 platforms.

I picked up Alex Shi's backport for review and testing, and as I found a couple
of issues to fix up, I'm sending this with my Signed-off-by in the chain, with
those fixups applied and noted.

To the best of my understanding the code is correct, in the context of the
v4.9.y kernel, and I've tested the seires on arm64 hardware available to me.
i.e. if this didn't have my Signed-off-by it would have my Reviewed-by and
Tested-by tags.

Are you happy to pick these up for v4.9.93?

Thanks,
Mark.

AKASHI Takahiro (1):
  module: extend 'rodata=off' boot cmdline parameter to module mappings

Jayachandran C (2):
  arm64: cputype: Add MIDR values for Cavium ThunderX2 CPUs
  arm64: Turn on KPTI only on CPUs that need it

Marc Zyngier (2):
  arm64: Allow checking of a CPU-local erratum
  arm64: Force KPTI to be disabled on Cavium ThunderX

Mark Rutland (1):
  arm64: factor out entry stack manipulation

Suzuki K Poulose (1):
  arm64: capabilities: Handle duplicate entries for a capability

Will Deacon (20):
  arm64: mm: Use non-global mappings for kernel space
  arm64: mm: Move ASID from TTBR0 to TTBR1
  arm64: mm: Allocate ASIDs in pairs
  arm64: mm: Add arm64_kernel_unmapped_at_el0 helper
  arm64: mm: Invalidate both kernel and user ASIDs when performing TLBI
  arm64: entry: Add exception trampoline page for exceptions from EL0
  arm64: mm: Map entry trampoline into trampoline and kernel page tables
  arm64: entry: Explicitly pass exception level to kernel_ventry macro
  arm64: entry: Hook up entry trampoline to exception vectors
  arm64: tls: Avoid unconditional zeroing of tpidrro_el0 for native
    tasks
  arm64: entry: Add fake CPU feature for unmapping the kernel at EL0
  arm64: kaslr: Put kernel vectors address in separate data page
  arm64: use RET instruction for exiting the trampoline
  arm64: Kconfig: Add CONFIG_UNMAP_KERNEL_AT_EL0
  arm64: Kconfig: Reword UNMAP_KERNEL_AT_EL0 kconfig entry
  arm64: Take into account ID_AA64PFR0_EL1.CSV3
  arm64: kpti: Make use of nG dependent on
    arm64_kernel_unmapped_at_el0()
  arm64: kpti: Add ->enable callback to remap swapper using nG mappings
  arm64: entry: Reword comment about post_ttbr_update_workaround
  arm64: idmap: Use "awx" flags for .idmap.text .pushsection directives

 arch/arm64/Kconfig                     |  12 ++
 arch/arm64/include/asm/assembler.h     |   3 +
 arch/arm64/include/asm/cpucaps.h       |   3 +-
 arch/arm64/include/asm/cputype.h       |   3 +
 arch/arm64/include/asm/fixmap.h        |   6 +
 arch/arm64/include/asm/mmu.h           |  11 ++
 arch/arm64/include/asm/mmu_context.h   |   7 ++
 arch/arm64/include/asm/pgtable-hwdef.h |   1 +
 arch/arm64/include/asm/pgtable-prot.h  |  35 +++---
 arch/arm64/include/asm/pgtable.h       |   1 +
 arch/arm64/include/asm/proc-fns.h      |   6 -
 arch/arm64/include/asm/sysreg.h        |   1 +
 arch/arm64/include/asm/tlbflush.h      |  16 ++-
 arch/arm64/kernel/asm-offsets.c        |   6 +-
 arch/arm64/kernel/cpu-reset.S          |   2 +-
 arch/arm64/kernel/cpufeature.c         | 135 ++++++++++++++++++---
 arch/arm64/kernel/entry.S              | 188 ++++++++++++++++++++++++----
 arch/arm64/kernel/head.S               |   2 +-
 arch/arm64/kernel/process.c            |  12 +-
 arch/arm64/kernel/sleep.S              |   2 +-
 arch/arm64/kernel/vmlinux.lds.S        |  22 +++-
 arch/arm64/mm/context.c                |  25 ++--
 arch/arm64/mm/mmu.c                    |  31 +++++
 arch/arm64/mm/proc.S                   | 216 +++++++++++++++++++++++++++++++--
 include/linux/init.h                   |   3 +
 init/main.c                            |   7 +-
 kernel/module.c                        |  20 ++-
 27 files changed, 675 insertions(+), 101 deletions(-)

-- 
2.11.0

Comments

Greg KH April 4, 2018, 3:07 p.m. | #1
On Tue, Apr 03, 2018 at 12:08:56PM +0100, Mark Rutland wrote:
> Hi Greg,

> 

> These patches backport KPTI to v4.9.y (based on v4.9.92), providing protection

> against meltdown on arm64 platforms.

> 

> I picked up Alex Shi's backport for review and testing, and as I found a couple

> of issues to fix up, I'm sending this with my Signed-off-by in the chain, with

> those fixups applied and noted.

> 

> To the best of my understanding the code is correct, in the context of the

> v4.9.y kernel, and I've tested the seires on arm64 hardware available to me.

> i.e. if this didn't have my Signed-off-by it would have my Reviewed-by and

> Tested-by tags.

> 

> Are you happy to pick these up for v4.9.93?


Thank you for doing this work, it's much appreciated.  I'd like to get
some "tested-by" from some people with this hardware (like Linaro or
others that I have pointed this patch series to), before I queue it up.

That way we have some people we can rely on to ensure that this actually
works if something goes wrong :)

thanks,

greg k-h
Will Deacon April 5, 2018, 10:04 a.m. | #2
On Wed, Apr 04, 2018 at 05:07:20PM +0200, Greg KH wrote:
> On Tue, Apr 03, 2018 at 12:08:56PM +0100, Mark Rutland wrote:

> > These patches backport KPTI to v4.9.y (based on v4.9.92), providing protection

> > against meltdown on arm64 platforms.

> > 

> > I picked up Alex Shi's backport for review and testing, and as I found a couple

> > of issues to fix up, I'm sending this with my Signed-off-by in the chain, with

> > those fixups applied and noted.

> > 

> > To the best of my understanding the code is correct, in the context of the

> > v4.9.y kernel, and I've tested the seires on arm64 hardware available to me.

> > i.e. if this didn't have my Signed-off-by it would have my Reviewed-by and

> > Tested-by tags.

> > 

> > Are you happy to pick these up for v4.9.93?

> 

> Thank you for doing this work, it's much appreciated.  I'd like to get

> some "tested-by" from some people with this hardware (like Linaro or

> others that I have pointed this patch series to), before I queue it up.


I can give it a spin if Mark points me at a branch to use.

Will
Mark Rutland April 5, 2018, 10:15 a.m. | #3
On Thu, Apr 05, 2018 at 11:04:23AM +0100, Will Deacon wrote:
> On Wed, Apr 04, 2018 at 05:07:20PM +0200, Greg KH wrote:

> > On Tue, Apr 03, 2018 at 12:08:56PM +0100, Mark Rutland wrote:

> > > These patches backport KPTI to v4.9.y (based on v4.9.92), providing protection

> > > against meltdown on arm64 platforms.

> > > 

> > > I picked up Alex Shi's backport for review and testing, and as I found a couple

> > > of issues to fix up, I'm sending this with my Signed-off-by in the chain, with

> > > those fixups applied and noted.

> > > 

> > > To the best of my understanding the code is correct, in the context of the

> > > v4.9.y kernel, and I've tested the seires on arm64 hardware available to me.

> > > i.e. if this didn't have my Signed-off-by it would have my Reviewed-by and

> > > Tested-by tags.

> > > 

> > > Are you happy to pick these up for v4.9.93?

> > 

> > Thank you for doing this work, it's much appreciated.  I'd like to get

> > some "tested-by" from some people with this hardware (like Linaro or

> > others that I have pointed this patch series to), before I queue it up.

> 

> I can give it a spin if Mark points me at a branch to use.


I've pushed that to:

  git://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git stable/4.9.y/meltdown

... that has my Signed-off-by fixed up on patch 9, but is otherwise
identical to this posting.

Thanks,
Mark.
Will Deacon April 5, 2018, 11:46 a.m. | #4
On Wed, Apr 04, 2018 at 05:07:20PM +0200, Greg KH wrote:
> On Tue, Apr 03, 2018 at 12:08:56PM +0100, Mark Rutland wrote:

> > These patches backport KPTI to v4.9.y (based on v4.9.92), providing protection

> > against meltdown on arm64 platforms.

> > 

> > I picked up Alex Shi's backport for review and testing, and as I found a couple

> > of issues to fix up, I'm sending this with my Signed-off-by in the chain, with

> > those fixups applied and noted.

> > 

> > To the best of my understanding the code is correct, in the context of the

> > v4.9.y kernel, and I've tested the seires on arm64 hardware available to me.

> > i.e. if this didn't have my Signed-off-by it would have my Reviewed-by and

> > Tested-by tags.

> > 

> > Are you happy to pick these up for v4.9.93?

> 

> Thank you for doing this work, it's much appreciated.  I'd like to get

> some "tested-by" from some people with this hardware (like Linaro or

> others that I have pointed this patch series to), before I queue it up.

> 

> That way we have some people we can rely on to ensure that this actually

> works if something goes wrong :)


Tested-by: Will Deacon <will.deacon@arm.com>


Will
Greg Hackmann April 5, 2018, 5:34 p.m. | #5
On 04/03/2018 04:08 AM, Mark Rutland wrote:
> Hi Greg,

> 

> These patches backport KPTI to v4.9.y (based on v4.9.92), providing protection

> against meltdown on arm64 platforms.

> 

> I picked up Alex Shi's backport for review and testing, and as I found a couple

> of issues to fix up, I'm sending this with my Signed-off-by in the chain, with

> those fixups applied and noted.

> 

> To the best of my understanding the code is correct, in the context of the

> v4.9.y kernel, and I've tested the seires on arm64 hardware available to me.

> i.e. if this didn't have my Signed-off-by it would have my Reviewed-by and

> Tested-by tags.

> 

> Are you happy to pick these up for v4.9.93?

> 

> Thanks,

> Mark.

> 

> AKASHI Takahiro (1):

>   module: extend 'rodata=off' boot cmdline parameter to module mappings

> 

> Jayachandran C (2):

>   arm64: cputype: Add MIDR values for Cavium ThunderX2 CPUs

>   arm64: Turn on KPTI only on CPUs that need it

> 

> Marc Zyngier (2):

>   arm64: Allow checking of a CPU-local erratum

>   arm64: Force KPTI to be disabled on Cavium ThunderX

> 

> Mark Rutland (1):

>   arm64: factor out entry stack manipulation

> 

> Suzuki K Poulose (1):

>   arm64: capabilities: Handle duplicate entries for a capability

> 

> Will Deacon (20):

>   arm64: mm: Use non-global mappings for kernel space

>   arm64: mm: Move ASID from TTBR0 to TTBR1

>   arm64: mm: Allocate ASIDs in pairs

>   arm64: mm: Add arm64_kernel_unmapped_at_el0 helper

>   arm64: mm: Invalidate both kernel and user ASIDs when performing TLBI

>   arm64: entry: Add exception trampoline page for exceptions from EL0

>   arm64: mm: Map entry trampoline into trampoline and kernel page tables

>   arm64: entry: Explicitly pass exception level to kernel_ventry macro

>   arm64: entry: Hook up entry trampoline to exception vectors

>   arm64: tls: Avoid unconditional zeroing of tpidrro_el0 for native

>     tasks

>   arm64: entry: Add fake CPU feature for unmapping the kernel at EL0

>   arm64: kaslr: Put kernel vectors address in separate data page

>   arm64: use RET instruction for exiting the trampoline

>   arm64: Kconfig: Add CONFIG_UNMAP_KERNEL_AT_EL0

>   arm64: Kconfig: Reword UNMAP_KERNEL_AT_EL0 kconfig entry

>   arm64: Take into account ID_AA64PFR0_EL1.CSV3

>   arm64: kpti: Make use of nG dependent on

>     arm64_kernel_unmapped_at_el0()

>   arm64: kpti: Add ->enable callback to remap swapper using nG mappings

>   arm64: entry: Reword comment about post_ttbr_update_workaround

>   arm64: idmap: Use "awx" flags for .idmap.text .pushsection directives

> 

>  arch/arm64/Kconfig                     |  12 ++

>  arch/arm64/include/asm/assembler.h     |   3 +

>  arch/arm64/include/asm/cpucaps.h       |   3 +-

>  arch/arm64/include/asm/cputype.h       |   3 +

>  arch/arm64/include/asm/fixmap.h        |   6 +

>  arch/arm64/include/asm/mmu.h           |  11 ++

>  arch/arm64/include/asm/mmu_context.h   |   7 ++

>  arch/arm64/include/asm/pgtable-hwdef.h |   1 +

>  arch/arm64/include/asm/pgtable-prot.h  |  35 +++---

>  arch/arm64/include/asm/pgtable.h       |   1 +

>  arch/arm64/include/asm/proc-fns.h      |   6 -

>  arch/arm64/include/asm/sysreg.h        |   1 +

>  arch/arm64/include/asm/tlbflush.h      |  16 ++-

>  arch/arm64/kernel/asm-offsets.c        |   6 +-

>  arch/arm64/kernel/cpu-reset.S          |   2 +-

>  arch/arm64/kernel/cpufeature.c         | 135 ++++++++++++++++++---

>  arch/arm64/kernel/entry.S              | 188 ++++++++++++++++++++++++----

>  arch/arm64/kernel/head.S               |   2 +-

>  arch/arm64/kernel/process.c            |  12 +-

>  arch/arm64/kernel/sleep.S              |   2 +-

>  arch/arm64/kernel/vmlinux.lds.S        |  22 +++-

>  arch/arm64/mm/context.c                |  25 ++--

>  arch/arm64/mm/mmu.c                    |  31 +++++

>  arch/arm64/mm/proc.S                   | 216 +++++++++++++++++++++++++++++++--

>  include/linux/init.h                   |   3 +

>  init/main.c                            |   7 +-

>  kernel/module.c                        |  20 ++-

>  27 files changed, 675 insertions(+), 101 deletions(-)

> 


I ran this series on the 1st gen hikey dev board and it works fine for me.

On top of mainline v4.9.92, tip-of-tree AOSP userspace boots to a serial
shell.

On top of the android-linaro-hikey-4.9 branch on AOSP, it boots to the
home screen without issues.  (android-4.9 has an out-of-tree SW PAN
backport which I reverted locally for testing purposes.)

So for the series:

Tested-by: Greg Hackmann <ghackmann@google.com>
Greg KH April 5, 2018, 7:15 p.m. | #6
On Thu, Apr 05, 2018 at 10:34:30AM -0700, Greg Hackmann wrote:
> On 04/03/2018 04:08 AM, Mark Rutland wrote:

> > Hi Greg,

> > 

> > These patches backport KPTI to v4.9.y (based on v4.9.92), providing protection

> > against meltdown on arm64 platforms.

> > 

> > I picked up Alex Shi's backport for review and testing, and as I found a couple

> > of issues to fix up, I'm sending this with my Signed-off-by in the chain, with

> > those fixups applied and noted.

> > 

> > To the best of my understanding the code is correct, in the context of the

> > v4.9.y kernel, and I've tested the seires on arm64 hardware available to me.

> > i.e. if this didn't have my Signed-off-by it would have my Reviewed-by and

> > Tested-by tags.

> > 

> > Are you happy to pick these up for v4.9.93?

> > 

> > Thanks,

> > Mark.

> > 

> > AKASHI Takahiro (1):

> >   module: extend 'rodata=off' boot cmdline parameter to module mappings

> > 

> > Jayachandran C (2):

> >   arm64: cputype: Add MIDR values for Cavium ThunderX2 CPUs

> >   arm64: Turn on KPTI only on CPUs that need it

> > 

> > Marc Zyngier (2):

> >   arm64: Allow checking of a CPU-local erratum

> >   arm64: Force KPTI to be disabled on Cavium ThunderX

> > 

> > Mark Rutland (1):

> >   arm64: factor out entry stack manipulation

> > 

> > Suzuki K Poulose (1):

> >   arm64: capabilities: Handle duplicate entries for a capability

> > 

> > Will Deacon (20):

> >   arm64: mm: Use non-global mappings for kernel space

> >   arm64: mm: Move ASID from TTBR0 to TTBR1

> >   arm64: mm: Allocate ASIDs in pairs

> >   arm64: mm: Add arm64_kernel_unmapped_at_el0 helper

> >   arm64: mm: Invalidate both kernel and user ASIDs when performing TLBI

> >   arm64: entry: Add exception trampoline page for exceptions from EL0

> >   arm64: mm: Map entry trampoline into trampoline and kernel page tables

> >   arm64: entry: Explicitly pass exception level to kernel_ventry macro

> >   arm64: entry: Hook up entry trampoline to exception vectors

> >   arm64: tls: Avoid unconditional zeroing of tpidrro_el0 for native

> >     tasks

> >   arm64: entry: Add fake CPU feature for unmapping the kernel at EL0

> >   arm64: kaslr: Put kernel vectors address in separate data page

> >   arm64: use RET instruction for exiting the trampoline

> >   arm64: Kconfig: Add CONFIG_UNMAP_KERNEL_AT_EL0

> >   arm64: Kconfig: Reword UNMAP_KERNEL_AT_EL0 kconfig entry

> >   arm64: Take into account ID_AA64PFR0_EL1.CSV3

> >   arm64: kpti: Make use of nG dependent on

> >     arm64_kernel_unmapped_at_el0()

> >   arm64: kpti: Add ->enable callback to remap swapper using nG mappings

> >   arm64: entry: Reword comment about post_ttbr_update_workaround

> >   arm64: idmap: Use "awx" flags for .idmap.text .pushsection directives

> > 

> >  arch/arm64/Kconfig                     |  12 ++

> >  arch/arm64/include/asm/assembler.h     |   3 +

> >  arch/arm64/include/asm/cpucaps.h       |   3 +-

> >  arch/arm64/include/asm/cputype.h       |   3 +

> >  arch/arm64/include/asm/fixmap.h        |   6 +

> >  arch/arm64/include/asm/mmu.h           |  11 ++

> >  arch/arm64/include/asm/mmu_context.h   |   7 ++

> >  arch/arm64/include/asm/pgtable-hwdef.h |   1 +

> >  arch/arm64/include/asm/pgtable-prot.h  |  35 +++---

> >  arch/arm64/include/asm/pgtable.h       |   1 +

> >  arch/arm64/include/asm/proc-fns.h      |   6 -

> >  arch/arm64/include/asm/sysreg.h        |   1 +

> >  arch/arm64/include/asm/tlbflush.h      |  16 ++-

> >  arch/arm64/kernel/asm-offsets.c        |   6 +-

> >  arch/arm64/kernel/cpu-reset.S          |   2 +-

> >  arch/arm64/kernel/cpufeature.c         | 135 ++++++++++++++++++---

> >  arch/arm64/kernel/entry.S              | 188 ++++++++++++++++++++++++----

> >  arch/arm64/kernel/head.S               |   2 +-

> >  arch/arm64/kernel/process.c            |  12 +-

> >  arch/arm64/kernel/sleep.S              |   2 +-

> >  arch/arm64/kernel/vmlinux.lds.S        |  22 +++-

> >  arch/arm64/mm/context.c                |  25 ++--

> >  arch/arm64/mm/mmu.c                    |  31 +++++

> >  arch/arm64/mm/proc.S                   | 216 +++++++++++++++++++++++++++++++--

> >  include/linux/init.h                   |   3 +

> >  init/main.c                            |   7 +-

> >  kernel/module.c                        |  20 ++-

> >  27 files changed, 675 insertions(+), 101 deletions(-)

> > 

> 

> I ran this series on the 1st gen hikey dev board and it works fine for me.

> 

> On top of mainline v4.9.92, tip-of-tree AOSP userspace boots to a serial

> shell.

> 

> On top of the android-linaro-hikey-4.9 branch on AOSP, it boots to the

> home screen without issues.  (android-4.9 has an out-of-tree SW PAN

> backport which I reverted locally for testing purposes.)

> 

> So for the series:

> 

> Tested-by: Greg Hackmann <ghackmann@google.com>


Great, thanks for testing this and letting me know.

greg k-h