mbox series

[v3,0/2] scs: switch to vmapped shadow stacks

Message ID 20201130233442.2562064-1-samitolvanen@google.com (mailing list archive)
Headers show
Series scs: switch to vmapped shadow stacks | expand

Message

Sami Tolvanen Nov. 30, 2020, 11:34 p.m. UTC
As discussed a few months ago [1][2], virtually mapped shadow call stacks
are better for safety and robustness. This series dusts off the VMAP
option from the original SCS patch series and switches the kernel to use
virtually mapped shadow stacks unconditionally when SCS is enabled.

 [1] https://lore.kernel.org/lkml/20200515172355.GD23334@willie-the-truck/
 [2] https://lore.kernel.org/lkml/20200427220942.GB80713@google.com/

Changes in v3:
- Split the actual allocation to __scs_alloc().
- Moved SDEI SCS initialization to init_sdei_scs().

Changes in v2:
- Added SCS_ORDER and used it to define SCS_SIZE, switched vmalloc() to
  use SCS_SIZE and removed the alignment.
- Moved the kasan_unpoison_vmalloc() to scs_alloc() when using a cached
  shadow stack instead of calling it in scs_free().
- Added a comment to scs_free().
- Moved arm64 IRQ and SDEI shadow stack initialization to irq/sdei.c,
  and removed the now unneeded scs.c.

Sami Tolvanen (2):
  scs: switch to vmapped shadow stacks
  arm64: scs: use vmapped IRQ and SDEI shadow stacks

 arch/arm64/kernel/Makefile |  1 -
 arch/arm64/kernel/entry.S  |  6 ++--
 arch/arm64/kernel/irq.c    | 19 ++++++++++
 arch/arm64/kernel/scs.c    | 16 ---------
 arch/arm64/kernel/sdei.c   | 70 +++++++++++++++++++++++++++++++++++++
 include/linux/scs.h        | 16 ++++-----
 kernel/scs.c               | 71 ++++++++++++++++++++++++++++++++------
 7 files changed, 158 insertions(+), 41 deletions(-)
 delete mode 100644 arch/arm64/kernel/scs.c


base-commit: b65054597872ce3aefbc6a666385eabdf9e288da

Comments

Will Deacon Dec. 1, 2020, 11:40 a.m. UTC | #1
On Mon, 30 Nov 2020 15:34:40 -0800, Sami Tolvanen wrote:
> As discussed a few months ago [1][2], virtually mapped shadow call stacks
> are better for safety and robustness. This series dusts off the VMAP
> option from the original SCS patch series and switches the kernel to use
> virtually mapped shadow stacks unconditionally when SCS is enabled.
> 
>  [1] https://lore.kernel.org/lkml/20200515172355.GD23334@willie-the-truck/
>  [2] https://lore.kernel.org/lkml/20200427220942.GB80713@google.com/
> 
> [...]

Applied to arm64 (for-next/scs), thanks!

[1/2] scs: switch to vmapped shadow stacks
      https://git.kernel.org/arm64/c/a2abe7cbd8fe
[2/2] arm64: scs: use vmapped IRQ and SDEI shadow stacks
      https://git.kernel.org/arm64/c/ac20ffbb0279

I also threw a patch on top implementing the suggestion I made on v2, so
please take a look if you get a chance.

Cheers,
Sami Tolvanen Dec. 1, 2020, 6:37 p.m. UTC | #2
On Tue, Dec 1, 2020 at 3:40 AM Will Deacon <will@kernel.org> wrote:
>
> On Mon, 30 Nov 2020 15:34:40 -0800, Sami Tolvanen wrote:
> > As discussed a few months ago [1][2], virtually mapped shadow call stacks
> > are better for safety and robustness. This series dusts off the VMAP
> > option from the original SCS patch series and switches the kernel to use
> > virtually mapped shadow stacks unconditionally when SCS is enabled.
> >
> >  [1] https://lore.kernel.org/lkml/20200515172355.GD23334@willie-the-truck/
> >  [2] https://lore.kernel.org/lkml/20200427220942.GB80713@google.com/
> >
> > [...]
>
> Applied to arm64 (for-next/scs), thanks!
>
> [1/2] scs: switch to vmapped shadow stacks
>       https://git.kernel.org/arm64/c/a2abe7cbd8fe
> [2/2] arm64: scs: use vmapped IRQ and SDEI shadow stacks
>       https://git.kernel.org/arm64/c/ac20ffbb0279
>
> I also threw a patch on top implementing the suggestion I made on v2, so
> please take a look if you get a chance.

Looks good to me, thanks for cleaning that up!

Sami