Commit 44b6ed4c authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'clang-features-v5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux

Pull clang feature updates from Kees Cook:

 - Add CC_HAS_NO_PROFILE_FN_ATTR in preparation for PGO support in the
   face of the noinstr attribute, paving the way for PGO and fixing
   GCOV. (Nick Desaulniers)

 - x86_64 LTO coverage is expanded to 32-bit x86. (Nathan Chancellor)

 - Small fixes to CFI. (Mark Rutland, Nathan Chancellor)

* tag 'clang-features-v5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
  qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
  Kconfig: Introduce ARCH_WANTS_NO_INSTR and CC_HAS_NO_PROFILE_FN_ATTR
  compiler_attributes.h: cleanups for GCC 4.9+
  compiler_attributes.h: define __no_profile, add to noinstr
  x86, lto: Enable Clang LTO for 32-bit as well
  CFI: Move function_nocfi() into compiler.h
  MAINTAINERS: Add Clang CFI section
parents 44046219 fca41af1
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -4447,6 +4447,18 @@ F: include/linux/compiler-clang.h
F:	scripts/clang-tools/
K:	\b(?i:clang|llvm)\b
CLANG CONTROL FLOW INTEGRITY SUPPORT
M:	Sami Tolvanen <samitolvanen@google.com>
M:	Kees Cook <keescook@chromium.org>
R:	Nathan Chancellor <nathan@kernel.org>
R:	Nick Desaulniers <ndesaulniers@google.com>
L:	clang-built-linux@googlegroups.com
S:	Supported
B:	https://github.com/ClangBuiltLinux/linux/issues
T:	git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/clang/features
F:	include/linux/cfi.h
F:	kernel/cfi.c
CLEANCACHE API
M:	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
L:	linux-kernel@vger.kernel.org
+7 −0
Original line number Diff line number Diff line
@@ -285,6 +285,13 @@ config ARCH_THREAD_STACK_ALLOCATOR
config ARCH_WANTS_DYNAMIC_TASK_STRUCT
	bool

config ARCH_WANTS_NO_INSTR
	bool
	help
	  An architecture should select this if the noinstr macro is being used on
	  functions to denote that the toolchain should avoid instrumenting such
	  functions and is required for correctness.

config ARCH_32BIT_OFF_T
	bool
	depends on !64BIT
+1 −0
Original line number Diff line number Diff line
@@ -93,6 +93,7 @@ config ARM64
	select ARCH_WANT_FRAME_POINTERS
	select ARCH_WANT_HUGE_PMD_SHARE if ARM64_4K_PAGES || (ARM64_16K_PAGES && !ARM64_VA_BITS_36)
	select ARCH_WANT_LD_ORPHAN_WARN
	select ARCH_WANTS_NO_INSTR
	select ARCH_HAS_UBSAN_SANITIZE_ALL
	select ARM_AMBA
	select ARM_ARCH_TIMER
+16 −0
Original line number Diff line number Diff line
@@ -23,4 +23,20 @@
#define __builtin_return_address(val)					\
	(void *)(ptrauth_clear_pac((unsigned long)__builtin_return_address(val)))

#ifdef CONFIG_CFI_CLANG
/*
 * With CONFIG_CFI_CLANG, the compiler replaces function address
 * references with the address of the function's CFI jump table
 * entry. The function_nocfi macro always returns the address of the
 * actual function instead.
 */
#define function_nocfi(x) ({						\
	void *addr;							\
	asm("adrp %0, " __stringify(x) "\n\t"				\
	    "add  %0, %0, :lo12:" __stringify(x)			\
	    : "=r" (addr));						\
	addr;								\
})
#endif

#endif /* __ASM_COMPILER_H */
+0 −16
Original line number Diff line number Diff line
@@ -321,22 +321,6 @@ static inline void *phys_to_virt(phys_addr_t x)
#define virt_to_pfn(x)		__phys_to_pfn(__virt_to_phys((unsigned long)(x)))
#define sym_to_pfn(x)		__phys_to_pfn(__pa_symbol(x))

#ifdef CONFIG_CFI_CLANG
/*
 * With CONFIG_CFI_CLANG, the compiler replaces function address
 * references with the address of the function's CFI jump table
 * entry. The function_nocfi macro always returns the address of the
 * actual function instead.
 */
#define function_nocfi(x) ({						\
	void *addr;							\
	asm("adrp %0, " __stringify(x) "\n\t"				\
	    "add  %0, %0, :lo12:" __stringify(x)			\
	    : "=r" (addr));						\
	addr;								\
})
#endif

/*
 *  virt_to_page(x)	convert a _valid_ virtual address to struct page *
 *  virt_addr_valid(x)	indicates whether a virtual address is valid
Loading