No description
Find a file
Sami Tolvanen ff301ceb52 cfi: add __cficanonical
With CONFIG_CFI_CLANG, the compiler replaces a function address taken
in C code with the address of a local jump table entry, which passes
runtime indirect call checks. However, the compiler won't replace
addresses taken in assembly code, which will result in a CFI failure
if we later jump to such an address in instrumented C code. The code
generated for the non-canonical jump table looks this:

  <noncanonical.cfi_jt>: /* In C, &noncanonical points here */
	jmp noncanonical
  ...
  <noncanonical>:        /* function body */
	...

This change adds the __cficanonical attribute, which tells the
compiler to use a canonical jump table for the function instead. This
means the compiler will rename the actual function to <function>.cfi
and points the original symbol to the jump table entry instead:

  <canonical>:           /* jump table entry */
	jmp canonical.cfi
  ...
  <canonical.cfi>:       /* function body */
	...

As a result, the address taken in assembly, or other non-instrumented
code always points to the jump table and therefore, can be used for
indirect calls in instrumented code without tripping CFI checks.

Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>   # pci.h
Tested-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20210408182843.1754385-3-samitolvanen@google.com
2021-04-08 16:04:20 -07:00
arch add support for Clang CFI 2021-04-08 16:04:20 -07:00
block block: remove the unused RQF_ALLOCED flag 2021-04-02 11:18:31 -06:00
certs
crypto
Documentation
drivers firewire: nosy: Fix a use-after-free bug in nosy_ioctl() 2021-04-04 14:05:45 -07:00
fs io_uring-5.12-2021-04-03 2021-04-03 14:26:47 -07:00
include cfi: add __cficanonical 2021-04-08 16:04:20 -07:00
init add support for Clang CFI 2021-04-08 16:04:20 -07:00
ipc
kernel add support for Clang CFI 2021-04-08 16:04:20 -07:00
lib XArray: Fix splitting to non-zero orders 2021-03-30 13:42:33 -04:00
LICENSES
mm mm: fix race by making init_zero_pfn() early_initcall 2021-03-30 09:46:12 -07:00
net
samples
scripts add support for Clang CFI 2021-04-08 16:04:20 -07:00
security
sound sound fixes for 5.12-rc6 2021-04-01 10:09:31 -07:00
tools x86: 2021-04-01 12:42:55 -07:00
usr
virt
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS Char/Misc driver fixes for 5.12-rc6 2021-04-03 10:05:16 -07:00
Makefile add support for Clang CFI 2021-04-08 16:04:20 -07:00
README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.