1. 26 Apr, 2022 16 commits
  2. 24 Apr, 2022 14 commits
  3. 22 Apr, 2022 6 commits
  4. 20 Apr, 2022 2 commits
  5. 16 Apr, 2022 1 commit
    • Kees Cook's avatar
      lkdtm: Add CFI_BACKWARD to test ROP mitigations · 2e53b877
      Kees Cook authored
      In order to test various backward-edge control flow integrity methods,
      add a test that manipulates the return address on the stack. Currently
      only arm64 Pointer Authentication and Shadow Call Stack is supported.
      
       $ echo CFI_BACKWARD | cat >/sys/kernel/debug/provoke-crash/DIRECT
      
      Under SCS, successful test of the mitigation is reported as:
      
       lkdtm: Performing direct entry CFI_BACKWARD
       lkdtm: Attempting unchecked stack return address redirection ...
       lkdtm: ok: redirected stack return address.
       lkdtm: Attempting checked stack return address redirection ...
       lkdtm: ok: control flow unchanged.
      
      Under PAC, successful test of the mitigation is reported by the PAC
      exception handler:
      
       lkdtm: Performing direct entry CFI_BACKWARD
       lkdtm: Attempting unchecked stack return address redirection ...
       lkdtm: ok: redirected stack return address.
       lkdtm: Attempting checked stack return address redirection ...
       Unable to handle kernel paging request at virtual address bfffffc0088d0514
       Mem abort info:
         ESR = 0x86000004
         EC = 0x21: IABT (current EL), IL = 32 bits
         SET = 0, FnV = 0
         EA = 0, S1PTW = 0
         FSC = 0x04: level 0 translation fault
       [bfffffc0088d0514] address between user and kernel address ranges
       ...
      
      If the CONFIGs are missing (or the mitigation isn't working), failure
      is reported as:
      
       lkdtm: Performing direct entry CFI_BACKWARD
       lkdtm: Attempting unchecked stack return address redirection ...
       lkdtm: ok: redirected stack return address.
       lkdtm: Attempting checked stack return address redirection ...
       lkdtm: FAIL: stack return address was redirected!
       lkdtm: This is probably expected, since this kernel was built *without* CONFIG_ARM64_PTR_AUTH_KERNEL=y nor CONFIG_SHADOW_CALL_STACK=y
      Co-developed-by: default avatarDan Li <ashimida@linux.alibaba.com>
      Signed-off-by: default avatarDan Li <ashimida@linux.alibaba.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Link: https://lore.kernel.org/lkml/20220416001103.1524653-1-keescook@chromium.org
      2e53b877
  6. 12 Apr, 2022 1 commit
    • Kees Cook's avatar
      lkdtm: Move crashtype definitions into each category · 73f62e60
      Kees Cook authored
      It's long been annoying that to add a new LKDTM test one had to update
      lkdtm.h and core.c to get it "registered". Switch to a per-category
      list and update the crashtype walking code in core.c to handle it.
      
      This also means that all the lkdtm_* tests themselves can be static now.
      
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      73f62e60