lkml.org 
[lkml]   [2017]   [Aug]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] lkdtm: Test VMAP_STACK allocates leading/trailing guard pages
On Mon, Aug 07, 2017 at 03:55:22PM -0700, Laura Abbott wrote:
> On 08/07/2017 03:00 PM, Mark Rutland wrote:
> > On Mon, Aug 07, 2017 at 01:39:48PM -0700, Kees Cook wrote:

> >> Do these tests both trip with the new arm64 VMAP_STACK code?
> >
> >> +/* Test that VMAP_STACK is actually allocating with a leading guard page */
> >> +void lkdtm_STACK_GUARD_PAGE_LEADING(void)

> >> +/* Test that VMAP_STACK is actually allocating with a trailing guard page */
> >> +void lkdtm_STACK_GUARD_PAGE_TRAILING(void)

> > I can give these a go tomorrow.
> >
> > These *should* fault, and IIUC should trigger the usual "Unable to handle
> > kernel %s at virtual address %08lx\n" splat from arm64's __do_kernel_fault(),
> > which should end up with an Oops().

> I gave these a quick test in QEMU and they seem to do the correct thing:

> # echo STACK_GUARD_PAGE_LEADING > /sys/kernel/debug/provoke-crash/DIRECT
> [ 24.593306] lkdtm: Performing direct entry STACK_GUARD_PAGE_LEADING
> [ 24.593780] lkdtm: attempting bad read from page below current stack
> [ 24.594289] Unable to handle kernel paging request at virtual address ffff000009b77fff
> [ 24.594747] swapper pgtable: 4k pages, 48-bit VAs, pgd = ffff000009050000
> [ 24.595443] [ffff000009b77fff] *pgd=000000007effe003, *pud=000000007effd003, *pmd=000000007cc43003, *pte=0000000000000000
> [ 24.596743] Internal error: Oops: 96000007 [#1] PREEMPT SMP

> # echo STACK_GUARD_PAGE_TRAILING > /sys/kernel/debug/provoke-crash/DIRECT
> [ 103.144313] lkdtm: Performing direct entry STACK_GUARD_PAGE_TRAILING
> [ 103.144749] lkdtm: attempting bad read from page above current stack
> [ 103.145100] Unable to handle kernel paging request at virtual address ffff000009c2c000
> [ 103.145477] swapper pgtable: 4k pages, 48-bit VAs, pgd = ffff000009050000
> [ 103.145836] [ffff000009c2c000] *pgd=000000007effe003, *pud=000000007effd003, *pmd=000000007d014003, *pte=0000000000000000
> [ 103.146445] Internal error: Oops: 96000007 [#2] PREEMPT SMP

Great! thanks for giving those a spin.

I can confirm likewise on Juno with 64K pages (not that this should make
any difference).

Mark.

\
 
 \ /
  Last update: 2017-08-08 11:25    [W:0.040 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site