Linux 4.9.106
Greg KH
maintainerI'm announcing the release of the 4.9.106 kernel.
Not everyone who uses 4.9 needs to upgrade here, it's a big sync of the objtool codebase to make future maintenance of 4.9.y easier over time, that's all. But of course, updating and verifying that nothing broke is always appreciated :)
The updated 4.9.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-4.9.y
and can be browsed at the normal kernel.org git web browser:
http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary
thanks,
greg k-h
------------
Makefile | 2 arch/x86/crypto/Makefile | 2 arch/x86/crypto/sha1-mb/Makefile | 2 arch/x86/crypto/sha256-mb/Makefile | 2 arch/x86/include/asm/orc_types.h | 107 + arch/x86/include/asm/unwind_hints.h | 103 arch/x86/kernel/Makefile | 1 arch/x86/kernel/acpi/Makefile | 2 arch/x86/kernel/kprobes/opt.c | 9 arch/x86/kernel/reboot.c | 2 arch/x86/kernel/vmlinux.lds.S | 1 arch/x86/kvm/svm.c | 2 arch/x86/kvm/vmx.c | 3 arch/x86/lib/msr-reg.S | 8 arch/x86/net/Makefile | 2 arch/x86/platform/efi/Makefile | 1 arch/x86/power/Makefile | 2 arch/x86/xen/Makefile | 3 arch/x86/xen/enlighten.c | 5 include/linux/compiler-gcc.h | 14 kernel/kexec_core.c | 4 tools/arch/arm/include/uapi/asm/kvm.h | 13 tools/arch/arm64/include/uapi/asm/kvm.h | 6 tools/arch/powerpc/include/uapi/asm/kvm.h | 1 tools/arch/s390/include/uapi/asm/kvm.h | 5 tools/arch/x86/include/asm/cpufeatures.h | 44 tools/arch/x86/include/asm/disabled-features.h | 7 tools/arch/x86/include/asm/required-features.h | 3 tools/include/asm-generic/bitops.h | 1 tools/include/asm-generic/bitops/__ffz.h | 12 tools/include/asm-generic/bitops/find.h | 28 tools/include/linux/atomic.h | 6 tools/include/linux/bitmap.h | 26 tools/include/linux/bitops.h | 5 tools/include/linux/bug.h | 10 tools/include/linux/compiler-gcc.h | 21 tools/include/linux/compiler.h | 23 tools/include/linux/hashtable.h | 4 tools/include/linux/kernel.h | 7 tools/include/linux/log2.h | 3 tools/include/linux/refcount.h | 151 + tools/include/linux/spinlock.h | 5 tools/include/linux/types.h | 5 tools/include/uapi/asm-generic/mman-common.h | 5 tools/include/uapi/linux/bpf.h | 51 tools/include/uapi/linux/fcntl.h | 67 tools/include/uapi/linux/stat.h | 45 tools/lib/find_bit.c | 25 tools/objtool/Build | 4 tools/objtool/Documentation/stack-validation.txt | 195 - tools/objtool/Makefile | 35 tools/objtool/arch.h | 66 tools/objtool/arch/x86/Build | 10 tools/objtool/arch/x86/decode.c | 407 +++ tools/objtool/arch/x86/include/asm/inat.h | 234 ++ tools/objtool/arch/x86/include/asm/inat_types.h | 29 tools/objtool/arch/x86/include/asm/insn.h | 211 ++ tools/objtool/arch/x86/include/asm/orc_types.h | 107 + tools/objtool/arch/x86/insn/gen-insn-attr-x86.awk | 392 --- tools/objtool/arch/x86/insn/inat.c | 97 tools/objtool/arch/x86/insn/inat.h | 234 -- tools/objtool/arch/x86/insn/inat_types.h | 29 tools/objtool/arch/x86/insn/insn.c | 606 ----- tools/objtool/arch/x86/insn/insn.h | 211 -- tools/objtool/arch/x86/insn/x86-opcode-map.txt | 1063 ---------- tools/objtool/arch/x86/lib/inat.c | 97 tools/objtool/arch/x86/lib/insn.c | 606 +++++ tools/objtool/arch/x86/lib/x86-opcode-map.txt | 1063 ++++++++++ tools/objtool/arch/x86/tools/gen-insn-attr-x86.awk | 392 +++ tools/objtool/builtin-check.c | 1297 ------------ tools/objtool/builtin-orc.c | 68 tools/objtool/builtin.h | 6 tools/objtool/cfi.h | 55 tools/objtool/check.c | 2209 +++++++++++++++++++++ tools/objtool/check.h | 82 tools/objtool/elf.c | 326 ++- tools/objtool/elf.h | 23 tools/objtool/objtool.c | 12 tools/objtool/orc.h | 30 tools/objtool/orc_dump.c | 213 ++ tools/objtool/orc_gen.c | 221 ++ tools/objtool/special.c | 6 tools/objtool/sync-check.sh | 29 tools/objtool/warn.h | 10 tools/perf/MANIFEST | 6 tools/perf/Makefile.perf | 144 - tools/perf/arch/x86/entry/syscalls/syscall_64.tbl | 7 tools/perf/check-headers.sh | 61 tools/perf/util/util.h | 2 89 files changed, 7431 insertions(+), 4320 deletions(-)
Arnaldo Carvalho de Melo (11):
tools include: Introduce linux/compiler-gcc.h
tools include: Adopt __compiletime_error
tools include: Introduce atomic_cmpxchg_{relaxed,release}() tools include: Add UINT_MAX def to kernel.h
tools include: Adopt kernel's refcount.h
tools include uapi: Grab copies of stat.h and fcntl.h
tools include: Introduce linux/bug.h, from the kernel sources tools include: Adopt __same_type() and __must_be_array() from the kernel tools include: Move ARRAY_SIZE() to linux/kernel.h
tools include: Drop ARRAY_SIZE() definition from linux/hashtable.h tools include: Include missing headers for fls() and types in linux/log2.h
Greg Kroah-Hartman (5):
objtool: sync up with the 4.14.47 version of objtool perf/tools: header file sync up
objtool: header file sync-up
x86/xen: Add unwind hint annotations to xen_setup_gdt Linux 4.9.106
Jiri Olsa (3):
tools lib: Add for_each_clear_bit macro
perf tools: Force fixdep compilation at the start of the build perf tools: Move headers check into bash script
Josh Poimboeuf (9):
objtool: Improve detection of BUG() and other dead ends
objtool: Move checking code to check.c
objtool: Support GCC 8's cold subfunctions
objtool: Support GCC 8 switch tables
objtool: Detect RIP-relative switch table references
objtool: Detect RIP-relative switch table references, part 2
objtool: Fix "noreturn" detection for recursive sibling calls objtool, x86: Add several functions and files to the objtool whitelist
objtool: Enclose contents of unreachable() macro in a block
Matthew Wilcox (2):
tools: add more bitmap functions
radix tree test suite: Remove types.h
Michael S. Tsirkin (1):
tools: enable endian checks for all sparse builds
Greg KH
maintainerMakefile +1 -1
@@ -1,6 +1,6 @@ VERSION = 4 PATCHLEVEL = 9 -SUBLEVEL = 105 +SUBLEVEL = 106 EXTRAVERSION = NAME = Roaring Lionus
arch/x86/crypto/Makefile +2 -0
@@ -2,6 +2,8 @@ # Arch-specific CryptoAPI modules. # +OBJECT_FILES_NON_STANDARD := y + avx_supported := $(call as-instr,vpxor %xmm0$(comma)%xmm0$(comma)%xmm0,yes,no) avx2_supported := $(call as-instr,vpgatherdd %ymm0$(comma)(%eax$(comma)%ymm1\ $(comma)4)$(comma)%ymm2,yes,no)
arch/x86/crypto/sha1-mb/Makefile +2 -0
@@ -2,6 +2,8 @@ # Arch-specific CryptoAPI modules. # +OBJECT_FILES_NON_STANDARD := y + avx2_supported := $(call as-instr,vpgatherdd %ymm0$(comma)(%eax$(comma)%ymm1\ $(comma)4)$(comma)%ymm2,yes,no) ifeq ($(avx2_supported),yes)
arch/x86/crypto/sha256-mb/Makefile +2 -0
@@ -2,6 +2,8 @@ # Arch-specific CryptoAPI modules. # +OBJECT_FILES_NON_STANDARD := y + avx2_supported := $(call as-instr,vpgatherdd %ymm0$(comma)(%eax$(comma)%ymm1\ $(comma)4)$(comma)%ymm2,yes,no) ifeq ($(avx2_supported),yes)
arch/x86/include/asm/orc_types.h new file +107 -0
107 lines not on this page · raw message
arch/x86/include/asm/unwind_hints.h new file +103 -0
103 lines not on this page · raw message
arch/x86/kernel/Makefile +1 -0
@@ -29,6 +29,7 @@ OBJECT_FILES_NON_STANDARD_head_$(BITS).o := y OBJECT_FILES_NON_STANDARD_relocate_kernel_$(BITS).o := y OBJECT_FILES_NON_STANDARD_mcount_$(BITS).o := y OBJECT_FILES_NON_STANDARD_test_nx.o := y +OBJECT_FILES_NON_STANDARD_paravirt_patch_$(BITS).o := y # If instrumentation of this dir is enabled, boot hangs during first second. # Probably could be more selective here, but note that files related to irqs,
arch/x86/kernel/acpi/Makefile +2 -0
@@ -1,3 +1,5 @@ +OBJECT_FILES_NON_STANDARD_wakeup_$(BITS).o := y + obj-$(CONFIG_ACPI) += boot.o obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup_$(BITS).o obj-$(CONFIG_ACPI_APEI) += apei.o
arch/x86/kernel/kprobes/opt.c +8 -1
@@ -28,6 +28,7 @@#include <linux/kdebug.h> #include <linux/kallsyms.h> #include <linux/ftrace.h> +#include <linux/frame.h> #include <asm/text-patching.h> #include <asm/cacheflush.h>
@@ -91,6 +92,7 @@ static void synthesize_set_arg1(kprobe_opcode_t *addr, unsigned long val) } asm ( + "optprobe_template_func:\n" ".global optprobe_template_entry\n" "optprobe_template_entry:\n"#ifdef CONFIG_X86_64
@@ -128,7 +130,12 @@ asm (" popf\n" #endif".global optprobe_template_end\n" - "optprobe_template_end:\n"); +"optprobe_template_end:\n" +".type optprobe_template_func, @function\n" + ".size optprobe_template_func, .-optprobe_template_func\n"); + +void optprobe_template_func (void ); +STACK_FRAME_NON_STANDARD (optprobe_template_func);#define TMPL_MOVE_IDX \ ((long)&optprobe_template_val - (long)&optprobe_template_entry)
arch/x86/kernel/reboot.c +2 -0
@@ -9,6 +9,7 @@#include <linux/sched.h> #include <linux/tboot.h> #include <linux/delay.h> +#include <linux/frame.h> #include <acpi/reboot.h> #include <asm/io.h> #include <asm/apic.h>
@@ -127,6 +128,7 @@ void __noreturn machine_real_restart(unsigned int type)#ifdef CONFIG_APM_MODULE EXPORT_SYMBOL (machine_real_restart);#endif +STACK_FRAME_NON_STANDARD (machine_real_restart);/* * Some Apple MacBook and MacBookPro's needs reboot=p to be able to reboot
arch/x86/kernel/vmlinux.lds.S +1 -0
@@ -353,6 +353,7 @@ SECTIONS /DISCARD/ : { *(.eh_frame) *(__func_stack_frame_non_standard) + *(__unreachable) } }
arch/x86/kvm/svm.c +2 -0
@@ -36,6 +36,7 @@#include <linux/slab.h> #include <linux/amd-iommu.h> #include <linux/hashtable.h> +#include <linux/frame.h> #include <asm/apic.h> #include <asm/perf_event.h>
@@ -5111,6 +5112,7 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)mark_all_clean (svm->vmcb); } +STACK_FRAME_NON_STANDARD (svm_vcpu_run);static void svm_set_cr3 (struct kvm_vcpu *vcpu,unsigned long root) {
arch/x86/kvm/vmx.c +3 -0
@@ -33,6 +33,7 @@#include <linux/slab.h> #include <linux/tboot.h> #include <linux/hrtimer.h> +#include <linux/frame.h> #include <linux/nospec.h> #include "kvm_cache_regs.h" #include "x86.h"
@@ -8698,6 +8699,7 @@ static void vmx_handle_external_intr(struct kvm_vcpu *vcpu) ); } } +STACK_FRAME_NON_STANDARD (vmx_handle_external_intr);static bool vmx_has_emulated_msr (int index) {
@@ -9138,6 +9140,7 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)vmx_recover_nmi_blocking (vmx);vmx_complete_interrupts (vmx); } +STACK_FRAME_NON_STANDARD (vmx_vcpu_run);static void vmx_load_vmcs01 (struct kvm_vcpu *vcpu) {
arch/x86/lib/msr-reg.S +4 -4
@@ -13,14 +13,14 @@ .macro op_safe_regs op ENTRY(\op\()_safe_regs) pushq %rbx - pushq %rbp + pushq %r12 movq %rdi, %r10 /* Save pointer */ xorl %r11d, %r11d /* Return value */ movl (%rdi), %eax movl 4(%rdi), %ecx movl 8(%rdi), %edx movl 12(%rdi), %ebx - movl 20(%rdi), %ebp + movl 20(%rdi), %r12d movl 24(%rdi), %esi movl 28(%rdi), %edi 1: \op
@@ -29,10 +29,10 @@ ENTRY(\op\()_safe_regs) movl %ecx, 4(%r10) movl %edx, 8(%r10) movl %ebx, 12(%r10) - movl %ebp, 20(%r10) + movl %r12d, 20(%r10) movl %esi, 24(%r10) movl %edi, 28(%r10) - popq %rbp + popq %r12 popq %rbx ret 3:
arch/x86/net/Makefile +2 -0
@@ -1,4 +1,6 @@ # # Arch-specific network modules # +OBJECT_FILES_NON_STANDARD_bpf_jit.o += y + obj-$(CONFIG_BPF_JIT) += bpf_jit.o bpf_jit_comp.o
arch/x86/platform/efi/Makefile +1 -0
@@ -1,4 +1,5 @@ OBJECT_FILES_NON_STANDARD_efi_thunk_$(BITS).o := y +OBJECT_FILES_NON_STANDARD_efi_stub_$(BITS).o := y obj-$(CONFIG_EFI) += quirks.o efi.o efi_$(BITS).o efi_stub_$(BITS).o obj-$(CONFIG_ACPI_BGRT) += efi-bgrt.o
arch/x86/power/Makefile +2 -0
@@ -1,3 +1,5 @@ +OBJECT_FILES_NON_STANDARD_hibernate_asm_$(BITS).o := y + # __restore_processor_state() restores %gs after S3 resume and so should not # itself be stack-protected nostackp := $(call cc-option, -fno-stack-protector)
arch/x86/xen/Makefile +3 -0
@@ -1,3 +1,6 @@ +OBJECT_FILES_NON_STANDARD_xen-asm_$(BITS).o := y +OBJECT_FILES_NON_STANDARD_xen-pvh.o := y + ifdef CONFIG_FUNCTION_TRACER # Do not profile debug and lowlevel utilities CFLAGS_REMOVE_spinlock.o = -pg
arch/x86/xen/enlighten.c +4 -1
@@ -75,6 +75,7 @@#include <asm/mwait.h> #include <asm/pci_x86.h> #include <asm/cpu.h> +#include <asm/unwind_hints.h> #ifdef CONFIG_ACPI #include <linux/acpi.h>
@@ -1452,10 +1453,12 @@ static void __ref xen_setup_gdt(int cpu)* GDT. The new GDT has __KERNEL_CS with CS.L = 1 * and we are jumping to reload it. */ - asmvolatile ("pushq %0\n" + asmvolatile (UNWIND_HINT_SAVE +"pushq %0\n" "leaq 1f(%%rip),%0\n" "pushq %0\n" "lretq\n" +UNWIND_HINT_RESTORE "1:\n" :"=&r" (dummy) :"0" (__KERNEL_CS));
include/linux/compiler-gcc.h +13 -1
@@ -203,6 +203,17 @@#endif #endif +#ifdef CONFIG_STACK_VALIDATION +#define annotate_unreachable () ({ \ + asm("1:\t\n" \ + ".pushsection __unreachable, \"a\"\t\n" \ + ".long 1b\t\n" \ + ".popsection\t\n"); \ +}) +#else +#define annotate_unreachable () +#endif +/* * Mark a position in code as unreachable. This can be used to * suppress control flow warnings after asm blocks that transfer
@@ -212,7 +223,8 @@* this in the preprocessor, but we can live with this because they're * unreleased. Really, we need to have autoconf for the kernel. */ -#define unreachable () __builtin_unreachable() +#define unreachable () \ + do { annotate_unreachable(); __builtin_unreachable(); } while (0)/* Mark a function definition as prohibited from being cloned. */ #define __noclone __attribute__((__noclone__, __optimize__("no-tracer")))
kernel/kexec_core.c +3 -1
@@ -38,6 +38,7 @@#include <linux/syscore_ops.h> #include <linux/compiler.h> #include <linux/hugetlb.h> +#include <linux/frame.h> #include <asm/page.h> #include <asm/sections.h>
@@ -878,7 +879,7 @@ int kexec_load_disabled;* only when panic_cpu holds the current CPU number; this is the only CPU * which processes crash_kexec routines. */ -void __crash_kexec (struct pt_regs *regs) +void __noclone __crash_kexec (struct pt_regs *regs) {/* Take the kexec_mutex here to prevent sys_kexec_load * running on one cpu from replacing the crash kernel
@@ -900,6 +901,7 @@ void __crash_kexec(struct pt_regs *regs)mutex_unlock (&kexec_mutex); } } +STACK_FRAME_NON_STANDARD (__crash_kexec);void crash_kexec (struct pt_regs *regs) {
tools/arch/arm/include/uapi/asm/kvm.h +13 -0
@@ -84,6 +84,13 @@ struct kvm_regs {#define KVM_VGIC_V2_DIST_SIZE 0x1000#define KVM_VGIC_V2_CPU_SIZE 0x2000 +/* Supported VGICv3 address types */ +#define KVM_VGIC_V3_ADDR_TYPE_DIST 2 +#define KVM_VGIC_V3_ADDR_TYPE_REDIST 3 + +#define KVM_VGIC_V3_DIST_SIZE SZ_64K +#define KVM_VGIC_V3_REDIST_SIZE (2 * SZ_64K) +#define KVM_ARM_VCPU_POWER_OFF 0/* CPU is started in OFF state */ #define KVM_ARM_VCPU_PSCI_0_2 1/* CPU uses PSCI v0.2 */
@@ -166,6 +173,12 @@ struct kvm_arch_memory_slot {#define KVM_REG_ARM_VFP_FPINST 0x1009#define KVM_REG_ARM_VFP_FPINST2 0x100A +/* KVM-as-firmware specific pseudo-registers */ +#define KVM_REG_ARM_FW (0x0014 << KVM_REG_ARM_COPROC_SHIFT) +#define KVM_REG_ARM_FW_REG (r) (KVM_REG_ARM | KVM_REG_SIZE_U64 | \ + KVM_REG_ARM_FW | ((r) & 0xffff)) +#define KVM_REG_ARM_PSCI_VERSION KVM_REG_ARM_FW_REG(0) +/* Device Control API: ARM VGIC */ #define KVM_DEV_ARM_VGIC_GRP_ADDR 0#define KVM_DEV_ARM_VGIC_GRP_DIST_REGS 1
tools/arch/arm64/include/uapi/asm/kvm.h +6 -0
@@ -195,6 +195,12 @@ struct kvm_arch_memory_slot {#define KVM_REG_ARM_TIMER_CNT ARM64_SYS_REG(3, 3, 14, 3, 2)#define KVM_REG_ARM_TIMER_CVAL ARM64_SYS_REG(3, 3, 14, 0, 2) +/* KVM-as-firmware specific pseudo-registers */ +#define KVM_REG_ARM_FW (0x0014 << KVM_REG_ARM_COPROC_SHIFT) +#define KVM_REG_ARM_FW_REG (r) (KVM_REG_ARM64 | KVM_REG_SIZE_U64 | \ + KVM_REG_ARM_FW | ((r) & 0xffff)) +#define KVM_REG_ARM_PSCI_VERSION KVM_REG_ARM_FW_REG(0) +/* Device Control API: ARM VGIC */ #define KVM_DEV_ARM_VGIC_GRP_ADDR 0#define KVM_DEV_ARM_VGIC_GRP_DIST_REGS 1
tools/arch/powerpc/include/uapi/asm/kvm.h +1 -0
@@ -596,6 +596,7 @@ struct kvm_get_htab_header {#define KVM_REG_PPC_TM_VSCR (KVM_REG_PPC_TM | KVM_REG_SIZE_U32 | 0x67)#define KVM_REG_PPC_TM_DSCR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x68)#define KVM_REG_PPC_TM_TAR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x69) +#define KVM_REG_PPC_TM_XER (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x6a)/* PPC64 eXternal Interrupt Controller Specification */ #define KVM_DEV_XICS_GRP_SOURCES 1/* 64-bit source attributes */
tools/arch/s390/include/uapi/asm/kvm.h +4 -1
@@ -197,6 +197,7 @@ struct kvm_guest_debug_arch {#define KVM_SYNC_VRS (1UL << 6)#define KVM_SYNC_RICCB (1UL << 7)#define KVM_SYNC_FPRS (1UL << 8) +#define KVM_SYNC_BPBC (1UL << 10)/* definition of registers in kvm_run */ struct kvm_sync_regs {__u64 prefix;/* prefix register */
@@ -217,7 +218,9 @@ struct kvm_sync_regs { };__u8 reserved[512 ];/* for future vector expansion */ __u32 fpc;/* valid on KVM_SYNC_VRS or KVM_SYNC_FPRS */ -__u8 padding[52 ];/* riccb needs to be 64byte aligned */ + __u8 bpbc : 1; /* bp mode */ + __u8 reserved2 : 7; +__u8 padding1[51 ];/* riccb needs to be 64byte aligned */ __u8 riccb[64 ];/* runtime instrumentation controls block */ };
tools/arch/x86/include/asm/cpufeatures.h +40 -4
86 lines not on this page · raw message
tools/arch/x86/include/asm/disabled-features.h +5 -2
@@ -21,11 +21,13 @@# define DISABLE_K6_MTRR (1<<(X86_FEATURE_K6_MTRR & 31))# define DISABLE_CYRIX_ARR (1<<(X86_FEATURE_CYRIX_ARR & 31))# define DISABLE_CENTAUR_MCR (1<<(X86_FEATURE_CENTAUR_MCR & 31)) +# define DISABLE_PCID 0#else # define DISABLE_VME 0# define DISABLE_K6_MTRR 0# define DISABLE_CYRIX_ARR 0# define DISABLE_CENTAUR_MCR 0 +# define DISABLE_PCID (1<<(X86_FEATURE_PCID & 31))#endif /* CONFIG_X86_64 */ #ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS
@@ -43,7 +45,7 @@#define DISABLED_MASK1 0#define DISABLED_MASK2 0#define DISABLED_MASK3 (DISABLE_CYRIX_ARR|DISABLE_CENTAUR_MCR|DISABLE_K6_MTRR) -#define DISABLED_MASK4 0 +#define DISABLED_MASK4 (DISABLE_PCID)#define DISABLED_MASK5 0#define DISABLED_MASK6 0#define DISABLED_MASK7 0
@@ -57,6 +59,7 @@#define DISABLED_MASK15 0#define DISABLED_MASK16 (DISABLE_PKU|DISABLE_OSPKE)#define DISABLED_MASK17 0 -#define DISABLED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 18) +#define DISABLED_MASK18 0 +#define DISABLED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 19)#endif /* _ASM_X86_DISABLED_FEATURES_H */
tools/arch/x86/include/asm/required-features.h +2 -1
@@ -100,6 +100,7 @@#define REQUIRED_MASK15 0#define REQUIRED_MASK16 0#define REQUIRED_MASK17 0 -#define REQUIRED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 18) +#define REQUIRED_MASK18 0 +#define REQUIRED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 19)#endif /* _ASM_X86_REQUIRED_FEATURES_H */
tools/include/asm-generic/bitops.h +1 -0
@@ -13,6 +13,7 @@*/ #include <asm-generic/bitops/__ffs.h> +#include <asm-generic/bitops/__ffz.h> #include <asm-generic/bitops/fls.h> #include <asm-generic/bitops/__fls.h> #include <asm-generic/bitops/fls64.h>
tools/include/asm-generic/bitops/__ffz.h new file +12 -0
@@ -0,0 +1,12 @@ +#ifndef _ASM_GENERIC_BITOPS_FFZ_H_ +#define _ASM_GENERIC_BITOPS_FFZ_H_ + +/* +* ffz - find first zero in word. +* @word: The word to search +* +* Undefined if no zero exists, so code should check against ~0UL first. +*/ +#define ffz (x) __ffs(~(x)) + +#endif /* _ASM_GENERIC_BITOPS_FFZ_H_ */
tools/include/asm-generic/bitops/find.h +28 -0
@@ -15,6 +15,21 @@ extern unsigned long find_next_bit(const unsigned long *addr, unsigned long size, unsigned long offset);#endif +#ifndef find_next_zero_bit + +/** +* find_next_zero_bit - find the next cleared bit in a memory region +* @addr: The address to base the search on +* @offset: The bitnumber to start searching at +* @size: The bitmap size in bits +* +* Returns the bit number of the next zero bit +* If no bits are zero, returns @size. +*/ +unsigned long find_next_zero_bit (const unsigned long *addr,unsigned long size, +unsigned long offset); +#endif +#ifndef find_first_bit/**
@@ -30,4 +45,17 @@ extern unsigned long find_first_bit(const unsigned long *addr,#endif /* find_first_bit */ +#ifndef find_first_zero_bit + +/** +* find_first_zero_bit - find the first cleared bit in a memory region +* @addr: The address to start the search at +* @size: The maximum number of bits to search +* +* Returns the bit number of the first cleared bit. +* If no bits are zero, returns @size. +*/ +unsigned long find_first_zero_bit (const unsigned long *addr,unsigned long size); +#endif +#endif /*_TOOLS_LINUX_ASM_GENERIC_BITOPS_FIND_H_ */
tools/include/linux/atomic.h +6 -0
@@ -3,4 +3,10 @@#include <asm/atomic.h> +/* atomic_cmpxchg_relaxed */ +#ifndef atomic_cmpxchg_relaxed +#define atomic_cmpxchg_relaxed atomic_cmpxchg +#define atomic_cmpxchg_release atomic_cmpxchg +#endif /* atomic_cmpxchg_relaxed */ +#endif /* __TOOLS_LINUX_ATOMIC_H */
tools/include/linux/bitmap.h +26 -0
@@ -35,6 +35,32 @@ static inline void bitmap_zero(unsigned long *dst, int nbits) } } +static inline void bitmap_fill (unsigned long *dst,unsigned int nbits) +{ +unsigned int nlongs =BITS_TO_LONGS (nbits); +if (!small_const_nbits (nbits)) { +unsigned int len = (nlongs -1 ) *sizeof (unsigned long ); +memset (dst,0xff , len); + } + dst[nlongs -1 ] =BITMAP_LAST_WORD_MASK (nbits); +} + +static inline int bitmap_empty (const unsigned long *src,unsigned nbits) +{ +if (small_const_nbits (nbits)) +return ! (*src &BITMAP_LAST_WORD_MASK (nbits)); + +return find_first_bit (src, nbits) == nbits; +} + +static inline int bitmap_full (const unsigned long *src,unsigned int nbits) +{ +if (small_const_nbits (nbits)) +return ! (~(*src) &BITMAP_LAST_WORD_MASK (nbits)); + +return find_first_zero_bit (src, nbits) == nbits; +} +static inline int bitmap_weight (const unsigned long *src,int nbits) {if (small_const_nbits (nbits))
tools/include/linux/bitops.h +5 -0
@@ -39,6 +39,11 @@ extern unsigned long __sw_hweight64(__u64 w); (bit) < (size); \ (bit) = find_next_bit((addr), (size), (bit) + 1)) +#define for_each_clear_bit (bit, addr, size) \ + for ((bit) = find_first_zero_bit((addr), (size)); \ + (bit) < (size); \ + (bit) = find_next_zero_bit((addr), (size), (bit) + 1)) +/* same as for_each_set_bit() but use bit as value to start with */ #define for_each_set_bit_from (bit, addr, size) \ for ((bit) = find_next_bit((addr), (size), (bit)); \
tools/include/linux/bug.h new file +10 -0
@@ -0,0 +1,10 @@ +#ifndef _TOOLS_PERF_LINUX_BUG_H +#define _TOOLS_PERF_LINUX_BUG_H + +/* Force a compilation error if condition is true, but also produce a +result (of value 0 and type size_t), so the expression can be used +e.g. in a structure initializer (or where-ever else comma expressions +aren't permitted). */ +#define BUILD_BUG_ON_ZERO (e) (sizeof(struct { int:-!!(e); })) + +#endif /* _TOOLS_PERF_LINUX_BUG_H */
tools/include/linux/compiler-gcc.h new file +21 -0
@@ -0,0 +1,21 @@ +#ifndef _TOOLS_LINUX_COMPILER_H_ +#error "Please don't include <linux/compiler-gcc.h> directly, include <linux/compiler.h> instead." +#endif + +/* +* Common definitions for all gcc versions go here. +*/ +#define GCC_VERSION (__GNUC__ * 10000 \ + + __GNUC_MINOR__ * 100 \ + + __GNUC_PATCHLEVEL__) + +#if GCC_VERSION >=70000 && !defined(__CHECKER__) +# define __fallthrough __attribute__ ((fallthrough)) +#endif + +#if GCC_VERSION >=40300 +# define __compiletime_error (message) __attribute__((error(message))) +#endif /* GCC_VERSION >= 40300 */ + +/* &a[0] degrades to a pointer: a different type from an array */ +#define __must_be_array (a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
tools/include/linux/compiler.h +18 -5
@@ -1,6 +1,14 @@#ifndef _TOOLS_LINUX_COMPILER_H_#define _TOOLS_LINUX_COMPILER_H_ +#ifdef __GNUC__ +#include <linux/compiler-gcc.h> +#endif + +#ifndef __compiletime_error +# define __compiletime_error (message) +#endif +/* Optimization barrier */ /* The "volatile" is due to gcc bugs */ #define barrier () __asm__ __volatile__("": : :"memory")
@@ -9,6 +17,11 @@# define __always_inline inline __attribute__((always_inline))#endif +/* Are two types/vars the same type (ignoring qualifiers)? */ +#ifndef __same_type +# define __same_type (a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) +#endif +#ifdef __ANDROID__/* * FIXME: Big hammer to get rid of tons of:
@@ -21,6 +34,8 @@#endif #define __user +#define __rcu +#define __read_mostly#ifndef __attribute_const__# define __attribute_const__
@@ -50,6 +65,8 @@# define unlikely (x) __builtin_expect(!!(x), 0)#endif +#define uninitialized_var (x) x = *(&(x)) +#define ACCESS_ONCE (x) (*(volatile typeof(x) *)&(x))#include <linux/types.h>
@@ -128,11 +145,7 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s#ifndef __fallthrough -# if defined(__GNUC__) && __GNUC__ >=7 -# define __fallthrough __attribute__ ((fallthrough)) -# else -# define __fallthrough -# endif +# define __fallthrough#endif #endif /* _TOOLS_LINUX_COMPILER_H */
tools/include/linux/hashtable.h +0 -4
@@ -13,10 +13,6 @@#include <linux/hash.h> #include <linux/log2.h> -#ifndef ARRAY_SIZE -#define ARRAY_SIZE (x) (sizeof(x) / sizeof((x)[0])) -#endif -#define DEFINE_HASHTABLE (name, bits) \ struct hlist_head name[1 << (bits)] = \ { [0 ... ((1 << (bits)) - 1)] = HLIST_HEAD_INIT }
tools/include/linux/kernel.h +7 -0
@@ -4,6 +4,11 @@#include <stdarg.h> #include <stddef.h> #include <assert.h> +#include <linux/compiler.h> + +#ifndef UINT_MAX +#define UINT_MAX (~0U) +#endif #define DIV_ROUND_UP (n,d) (((n) + (d) - 1) / (d))
@@ -72,6 +77,8 @@int vscnprintf (char *buf,size_t size,const char *fmt,va_list args);int scnprintf (char * buf,size_t size,const char * fmt, ...); +#define ARRAY_SIZE (arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) +/* * This looks more complex than it should be. But we need to * get the type for the ~ right in round_down (it needs to be
tools/include/linux/log2.h +3 -0
@@ -12,6 +12,9 @@#ifndef _TOOLS_LINUX_LOG2_H#define _TOOLS_LINUX_LOG2_H +#include <linux/bitops.h> +#include <linux/types.h> +/* * non-constant log of base 2 calculators * - the arch may override these in asm/bitops.h if they can be implemented
tools/include/linux/refcount.h new file +151 -0
151 lines not on this page · raw message
tools/include/linux/spinlock.h new file +5 -0
@@ -0,0 +1,5 @@ +#define spinlock_t pthread_mutex_t +#define DEFINE_SPINLOCK (x) pthread_mutex_t x = PTHREAD_MUTEX_INITIALIZER; + +#define spin_lock_irqsave (x, f) (void)f, pthread_mutex_lock(x) +#define spin_unlock_irqrestore (x, f) (void)f, pthread_mutex_unlock(x)
tools/include/linux/types.h +1 -4
@@ -7,6 +7,7 @@#define __SANE_USERSPACE_TYPES__/* For PPC64, to get LL64 types */ #include <asm/types.h> +#include <asm/posix_types.h> struct page ;struct kmem_cache ;
@@ -42,11 +43,7 @@ typedef __s8 s8;#else #define __bitwise__#endif -#ifdef __CHECK_ENDIAN__#define __bitwise __bitwise__ -#else -#define __bitwise -#endif #define __force#define __user
tools/include/uapi/asm-generic/mman-common.h +5 -0
@@ -72,4 +72,9 @@#define MAP_HUGE_SHIFT 26#define MAP_HUGE_MASK 0x3f +#define PKEY_DISABLE_ACCESS 0x1 +#define PKEY_DISABLE_WRITE 0x2 +#define PKEY_ACCESS_MASK (PKEY_DISABLE_ACCESS |\ + PKEY_DISABLE_WRITE) +#endif /* __ASM_GENERIC_MMAN_COMMON_H */
tools/include/uapi/linux/bpf.h +51 -0
63 lines not on this page · raw message
tools/include/uapi/linux/fcntl.h new file +67 -0
67 lines not on this page · raw message
tools/include/uapi/linux/stat.h new file +45 -0
45 lines not on this page · raw message
tools/lib/find_bit.c +25 -0
@@ -82,3 +82,28 @@ unsigned long find_first_bit(const unsigned long *addr, unsigned long size) return size; }#endif + +#ifndef find_first_zero_bit +/* +* Find the first cleared bit in a memory region. +*/ +unsigned long find_first_zero_bit (const unsigned long *addr,unsigned long size) +{ +unsigned long idx; + +for (idx =0 ; idx *BITS_PER_LONG < size; idx++) { +if (addr[idx] != ~0UL ) +return min (idx *BITS_PER_LONG +ffz (addr[idx]), size); + } + +return size; +} +#endif + +#ifndef find_next_zero_bit +unsigned long find_next_zero_bit (const unsigned long *addr,unsigned long size, +unsigned long offset) +{ +return _find_next_bit (addr, size, offset, ~0UL ); +} +#endif
tools/objtool/Build +4 -0
@@ -1,5 +1,9 @@ objtool-y += arch/$(SRCARCH)/ objtool-y += builtin-check.o +objtool-y += builtin-orc.o +objtool-y += check.o +objtool-y += orc_gen.o +objtool-y += orc_dump.o objtool-y += elf.o objtool-y += special.o objtool-y += objtool.o
tools/objtool/Documentation/stack-validation.txt +75 -120
278 lines not on this page · raw message
tools/objtool/Makefile +15 -20
@@ -1,3 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 include ../scripts/Makefile.include include ../scripts/Makefile.arch
@@ -6,17 +7,19 @@ ARCH := x86 endif # always use the host compiler -CC = gcc -LD = ld -AR = ar +HOSTCC ?= gcc +HOSTLD ?= ld +CC = $(HOSTCC) +LD = $(HOSTLD) +AR = ar ifeq ($(srctree),) -srctree := $(patsubst %/,%,$(dir $(shell pwd))) +srctree := $(patsubst %/,%,$(dir $(CURDIR))) srctree := $(patsubst %/,%,$(dir $(srctree))) endif SUBCMD_SRCDIR = $(srctree)/tools/lib/subcmd/ -LIBSUBCMD_OUTPUT = $(if $(OUTPUT),$(OUTPUT),$(PWD)/) +LIBSUBCMD_OUTPUT = $(if $(OUTPUT),$(OUTPUT),$(CURDIR)/) LIBSUBCMD = $(LIBSUBCMD_OUTPUT)libsubcmd.a OBJTOOL := $(OUTPUT)objtool
@@ -24,8 +27,11 @@ OBJTOOL_IN := $(OBJTOOL)-in.o all: $(OBJTOOL) -INCLUDES := -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(HOSTARCH)/include/uapi -CFLAGS += -Wall -Werror $(EXTRA_WARNINGS) -fomit-frame-pointer -O2 -g $(INCLUDES) +INCLUDES := -I$(srctree)/tools/include \ + -I$(srctree)/tools/arch/$(HOSTARCH)/include/uapi \ + -I$(srctree)/tools/objtool/arch/$(ARCH)/include +WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed +CFLAGS += -Wall -Werror $(WARNINGS) -fomit-frame-pointer -O2 -g $(INCLUDES) LDFLAGS += -lelf $(LIBSUBCMD) # Allow old libelf to be used:
@@ -39,19 +45,8 @@ include $(srctree)/tools/build/Makefile.include $(OBJTOOL_IN): fixdep FORCE @$(MAKE) $(build)=objtool -# Busybox's diff doesn't have -I, avoid warning in that case -# $(OBJTOOL): $(LIBSUBCMD) $(OBJTOOL_IN) - @(diff -I 2>&1 | grep -q 'option requires an argument' && \ - test -d ../../kernel -a -d ../../tools -a -d ../objtool && (( \ - diff -I'^#include' arch/x86/insn/insn.c ../../arch/x86/lib/insn.c >/dev/null && \ - diff -I'^#include' arch/x86/insn/inat.c ../../arch/x86/lib/inat.c >/dev/null && \ - diff arch/x86/insn/x86-opcode-map.txt ../../arch/x86/lib/x86-opcode-map.txt >/dev/null && \ - diff arch/x86/insn/gen-insn-attr-x86.awk ../../arch/x86/tools/gen-insn-attr-x86.awk >/dev/null && \ - diff -I'^#include' arch/x86/insn/insn.h ../../arch/x86/include/asm/insn.h >/dev/null && \ - diff -I'^#include' arch/x86/insn/inat.h ../../arch/x86/include/asm/inat.h >/dev/null && \ - diff -I'^#include' arch/x86/insn/inat_types.h ../../arch/x86/include/asm/inat_types.h >/dev/null) \ - || echo "warning: objtool: x86 instruction decoder differs from kernel" >&2 )) || true + @$(CONFIG_SHELL) ./sync-check.sh $(QUIET_LINK)$(CC) $(OBJTOOL_IN) $(LDFLAGS) -o $@
@@ -61,7 +56,7 @@ $(LIBSUBCMD): fixdep FORCE clean: $(call QUIET_CLEAN, objtool) $(RM) $(OBJTOOL) $(Q)find $(OUTPUT) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete - $(Q)$(RM) $(OUTPUT)arch/x86/insn/inat-tables.c $(OUTPUT)fixdep + $(Q)$(RM) $(OUTPUT)arch/x86/lib/inat-tables.c $(OUTPUT)fixdep FORCE:
tools/objtool/arch.h +52 -14
78 lines not on this page · raw message
tools/objtool/arch/x86/Build +5 -5
@@ -1,12 +1,12 @@ objtool-y += decode.o -inat_tables_script = arch/x86/insn/gen-insn-attr-x86.awk -inat_tables_maps = arch/x86/insn/x86-opcode-map.txt +inat_tables_script = arch/x86/tools/gen-insn-attr-x86.awk +inat_tables_maps = arch/x86/lib/x86-opcode-map.txt -$(OUTPUT)arch/x86/insn/inat-tables.c: $(inat_tables_script) $(inat_tables_maps) +$(OUTPUT)arch/x86/lib/inat-tables.c: $(inat_tables_script) $(inat_tables_maps) $(call rule_mkdir) $(Q)$(call echo-cmd,gen)$(AWK) -f $(inat_tables_script) $(inat_tables_maps) > $@ -$(OUTPUT)arch/x86/decode.o: $(OUTPUT)arch/x86/insn/inat-tables.c +$(OUTPUT)arch/x86/decode.o: $(OUTPUT)arch/x86/lib/inat-tables.c -CFLAGS_decode.o += -I$(OUTPUT)arch/x86/insn +CFLAGS_decode.o += -I$(OUTPUT)arch/x86/lib
tools/objtool/arch/x86/decode.c +361 -46
486 lines not on this page · raw message
tools/objtool/arch/x86/include/asm/inat.h new file +234 -0
234 lines not on this page · raw message
tools/objtool/arch/x86/include/asm/inat_types.h new file +29 -0
@@ -0,0 +1,29 @@ +#ifndef _ASM_X86_INAT_TYPES_H +#define _ASM_X86_INAT_TYPES_H +/* +* x86 instruction attributes +* +* Written by Masami Hiramatsu <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +* +*/ + +/* Instruction attributes */ +typedef unsigned int insn_attr_t ; +typedef unsigned char insn_byte_t ; +typedef signed int insn_value_t ; + +#endif
tools/objtool/arch/x86/include/asm/insn.h new file +211 -0
211 lines not on this page · raw message
tools/objtool/arch/x86/include/asm/orc_types.h new file +107 -0
107 lines not on this page · raw message
tools/objtool/arch/x86/insn/gen-insn-attr-x86.awk deleted +0 -392
226 lines not on this page · raw message
tools/objtool/arch/x86/insn/inat.c deleted +0 -97
97 lines not on this page · raw message
tools/objtool/arch/x86/insn/inat.h deleted +0 -234
234 lines not on this page · raw message
tools/objtool/arch/x86/insn/inat_types.h deleted +0 -29
Lines of this file are not shown. View the raw message.
tools/objtool/arch/x86/insn/insn.c deleted +0 -606
606 lines not on this page · raw message
tools/objtool/arch/x86/insn/insn.h deleted +0 -211
211 lines not on this page · raw message
tools/objtool/arch/x86/insn/x86-opcode-map.txt deleted +0 -1063
1,063 lines not on this page · raw message
tools/objtool/arch/x86/lib/inat.c new file +97 -0
97 lines not on this page · raw message
tools/objtool/arch/x86/lib/insn.c new file +606 -0
606 lines not on this page · raw message
tools/objtool/arch/x86/lib/x86-opcode-map.txt new file +1063 -0
1,063 lines not on this page · raw message
tools/objtool/arch/x86/tools/gen-insn-attr-x86.awk new file +392 -0
392 lines not on this page · raw message
tools/objtool/builtin-check.c +16 -1281
1,297 lines not on this page · raw message
tools/objtool/builtin-orc.c new file +68 -0
68 lines not on this page · raw message
tools/objtool/cfi.h new file +55 -0
55 lines not on this page · raw message
tools/objtool/check.c new file +2209 -0
2,209 lines not on this page · raw message
tools/objtool/check.h new file +82 -0
82 lines not on this page · raw message
tools/objtool/elf.c +277 -49
326 lines not on this page · raw message
tools/objtool/orc_dump.c new file +213 -0
213 lines not on this page · raw message
tools/objtool/orc_gen.c new file +221 -0
221 lines not on this page · raw message
tools/perf/Makefile.perf +39 -105
144 lines not on this page · raw message
tools/perf/arch/x86/entry/syscalls/syscall_64.tbl +5 -2
Lines of this file are not shown. View the raw message.
tools/perf/check-headers.sh new file +61 -0
61 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.