15 Jan, 2021

1 commit


26 Oct, 2020

1 commit

  • Use a more generic form for __section that requires quotes to avoid
    complications with clang and gcc differences.

    Remove the quote operator # from compiler_attributes.h __section macro.

    Convert all unquoted __section(foo) uses to quoted __section("foo").
    Also convert __attribute__((section("foo"))) uses to __section("foo")
    even if the __attribute__ has multiple list entry forms.

    Conversion done using the script at:

    https://lore.kernel.org/lkml/75393e5ddc272dc7403de74d645e6c6e0f4e70eb.camel@perches.com/2-convert_section.pl

    Signed-off-by: Joe Perches
    Reviewed-by: Nick Desaulniers
    Reviewed-by: Miguel Ojeda
    Signed-off-by: Linus Torvalds

    Joe Perches
     

16 Aug, 2020

1 commit

  • Pull x86 fixes from Ingo Molnar:
    "Misc fixes and small updates all around the place:

    - Fix mitigation state sysfs output

    - Fix an FPU xstate/sxave code assumption bug triggered by
    Architectural LBR support

    - Fix Lightning Mountain SoC TSC frequency enumeration bug

    - Fix kexec debug output

    - Fix kexec memory range assumption bug

    - Fix a boundary condition in the crash kernel code

    - Optimize porgatory.ro generation a bit

    - Enable ACRN guests to use X2APIC mode

    - Reduce a __text_poke() IRQs-off critical section for the benefit of
    PREEMPT_RT"

    * tag 'x86-urgent-2020-08-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    x86/alternatives: Acquire pte lock with interrupts enabled
    x86/bugs/multihit: Fix mitigation reporting when VMX is not in use
    x86/fpu/xstate: Fix an xstate size check warning with architectural LBRs
    x86/purgatory: Don't generate debug info for purgatory.ro
    x86/tsr: Fix tsc frequency enumeration bug on Lightning Mountain SoC
    kexec_file: Correctly output debugging information for the PT_LOAD ELF header
    kexec: Improve & fix crash_exclude_mem_range() to handle overlapping ranges
    x86/crash: Correct the address boundary of function parameters
    x86/acrn: Remove redundant chars from ACRN signature
    x86/acrn: Allow ACRN guest to use X2APIC mode

    Linus Torvalds
     

07 Aug, 2020

1 commit

  • Purgatory.ro is a standalone binary that is not linked against the rest of
    the kernel. Its image is copied into an array that is linked to the
    kernel, and from there kexec relocates it wherever it desires.

    Unlike the debug info for vmlinux, which can be used for analyzing crash
    such info is useless in purgatory.ro. And discarding them can save about
    200K space.

    Original:
    259080 kexec-purgatory.o
    Stripped debug info:
    29152 kexec-purgatory.o

    Signed-off-by: Pingfan Liu
    Signed-off-by: Ingo Molnar
    Reviewed-by: Nick Desaulniers
    Reviewed-by: Steve Wahl
    Acked-by: Dave Young
    Link: https://lore.kernel.org/r/1596433788-3784-1-git-send-email-kernelfans@gmail.com

    Pingfan Liu
     

07 Jul, 2020

1 commit

  • Some Makefiles already pass -fno-stack-protector unconditionally.
    For example, arch/arm64/kernel/vdso/Makefile, arch/x86/xen/Makefile.

    No problem report so far about hard-coding this option. So, we can
    assume all supported compilers know -fno-stack-protector.

    GCC 4.8 and Clang support this option (https://godbolt.org/z/_HDGzN)

    Get rid of cc-option from -fno-stack-protector.

    Remove CONFIG_CC_HAS_STACKPROTECTOR_NONE, which is always 'y'.

    Note:
    arch/mips/vdso/Makefile adds -fno-stack-protector twice, first
    unconditionally, and second conditionally. I removed the second one.

    Signed-off-by: Masahiro Yamada
    Reviewed-by: Kees Cook
    Acked-by: Ard Biesheuvel
    Reviewed-by: Nick Desaulniers

    Masahiro Yamada
     

17 Jun, 2020

1 commit

  • The purgatory Makefile removes -fstack-protector options if they were
    configured in, but does not currently add -fno-stack-protector.

    If gcc was configured with the --enable-default-ssp configure option,
    this results in the stack protector still being enabled for the
    purgatory (absent distro-specific specs files that might disable it
    again for freestanding compilations), if the main kernel is being
    compiled with stack protection enabled (if it's disabled for the main
    kernel, the top-level Makefile will add -fno-stack-protector).

    This will break the build since commit
    e4160b2e4b02 ("x86/purgatory: Fail the build if purgatory.ro has missing symbols")
    and prior to that would have caused runtime failure when trying to use
    kexec.

    Explicitly add -fno-stack-protector to avoid this, as done in other
    Makefiles that need to disable the stack protector.

    Reported-by: Gabriel C
    Signed-off-by: Arvind Sankar
    Signed-off-by: Linus Torvalds

    Arvind Sankar
     

21 Mar, 2020

1 commit


17 Mar, 2020

2 commits

  • Linking purgatory.ro with -r enables "incremental linking"; this means
    no checks for unresolved symbols are done while linking purgatory.ro.

    A change to the sha256 code has caused the purgatory in 5.4-rc1 to have
    a missing symbol on memzero_explicit(), yet things still happily build.

    Add an extra check for unresolved symbols by calling ld without -r
    before running bin2c to generate kexec-purgatory.c.

    This causes a build of 5.4-rc1 with this patch added to fail as it should:

    CHK arch/x86/purgatory/purgatory.ro
    ld: arch/x86/purgatory/purgatory.ro: in function `sha256_transform':
    sha256.c:(.text+0x1c0c): undefined reference to `memzero_explicit'
    make[2]: *** [arch/x86/purgatory/Makefile:72:
    arch/x86/purgatory/kexec-purgatory.c] Error 1
    make[1]: *** [scripts/Makefile.build:509: arch/x86/purgatory] Error 2
    make: *** [Makefile:1650: arch/x86] Error 2

    Also remove --no-undefined from LDFLAGS_purgatory.ro as that has no
    effect.

    Signed-off-by: Hans de Goede
    Signed-off-by: Borislav Petkov
    Link: https://lkml.kernel.org/r/20200317130841.290418-2-hdegoede@redhat.com

    Hans de Goede
     
  • Since the purgatory is a special stand-alone binary, various profiling
    and sanitizing options must be disabled. Having these options enabled
    typically will cause dependencies on various special symbols exported by
    special libs / stubs used by these frameworks. Since the purgatory is
    special, it is not linked against these stubs causing missing symbols in
    the purgatory if these options are not disabled.

    Sync the set of disabled profiling and sanitizing options with that from
    drivers/firmware/efi/libstub/Makefile, adding
    -DDISABLE_BRANCH_PROFILING to the CFLAGS and setting:

    GCOV_PROFILE := n
    UBSAN_SANITIZE := n

    This fixes broken references to ftrace_likely_update() when
    CONFIG_TRACE_BRANCH_PROFILING is enabled and to __gcov_init() and
    __gcov_exit() when CONFIG_GCOV_KERNEL is enabled.

    Signed-off-by: Hans de Goede
    Signed-off-by: Borislav Petkov
    Link: https://lkml.kernel.org/r/20200317130841.290418-1-hdegoede@redhat.com

    Hans de Goede
     

30 Dec, 2019

1 commit


27 Nov, 2019

1 commit

  • Pull x86 asm updates from Ingo Molnar:
    "The main changes in this cycle were:

    - Cross-arch changes to move the linker sections for NOTES and
    EXCEPTION_TABLE into the RO_DATA area, where they belong on most
    architectures. (Kees Cook)

    - Switch the x86 linker fill byte from x90 (NOP) to 0xcc (INT3), to
    trap jumps into the middle of those padding areas instead of
    sliding execution. (Kees Cook)

    - A thorough cleanup of symbol definitions within x86 assembler code.
    The rather randomly named macros got streamlined around a
    (hopefully) straightforward naming scheme:

    SYM_START(name, linkage, align...)
    SYM_END(name, sym_type)

    SYM_FUNC_START(name)
    SYM_FUNC_END(name)

    SYM_CODE_START(name)
    SYM_CODE_END(name)

    SYM_DATA_START(name)
    SYM_DATA_END(name)

    etc - with about three times of these basic primitives with some
    label, local symbol or attribute variant, expressed via postfixes.

    No change in functionality intended. (Jiri Slaby)

    - Misc other changes, cleanups and smaller fixes"

    * 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (67 commits)
    x86/entry/64: Remove pointless jump in paranoid_exit
    x86/entry/32: Remove unused resume_userspace label
    x86/build/vdso: Remove meaningless CFLAGS_REMOVE_*.o
    m68k: Convert missed RODATA to RO_DATA
    x86/vmlinux: Use INT3 instead of NOP for linker fill bytes
    x86/mm: Report actual image regions in /proc/iomem
    x86/mm: Report which part of kernel image is freed
    x86/mm: Remove redundant address-of operators on addresses
    xtensa: Move EXCEPTION_TABLE to RO_DATA segment
    powerpc: Move EXCEPTION_TABLE to RO_DATA segment
    parisc: Move EXCEPTION_TABLE to RO_DATA segment
    microblaze: Move EXCEPTION_TABLE to RO_DATA segment
    ia64: Move EXCEPTION_TABLE to RO_DATA segment
    h8300: Move EXCEPTION_TABLE to RO_DATA segment
    c6x: Move EXCEPTION_TABLE to RO_DATA segment
    arm64: Move EXCEPTION_TABLE to RO_DATA segment
    alpha: Move EXCEPTION_TABLE to RO_DATA segment
    x86/vmlinux: Move EXCEPTION_TABLE to RO_DATA segment
    x86/vmlinux: Actually use _etext for the end of the text segment
    vmlinux.lds.h: Allow EXCEPTION_TABLE to live in RO_DATA
    ...

    Linus Torvalds
     

16 Nov, 2019

1 commit

  • This patch enables KCSAN for x86, with updates to build rules to not use
    KCSAN for several incompatible compilation units.

    Signed-off-by: Marco Elver
    Acked-by: Paul E. McKenney
    Signed-off-by: Paul E. McKenney

    Marco Elver
     

15 Nov, 2019

1 commit

  • When the crashkernel kernel command line option is specified, the low
    1M memory will always be reserved now. Therefore, it's not necessary to
    create a backup region anymore and also no need to copy the contents of
    the first 640k to it.

    Remove all the code related to handling that backup region.

    [ bp: Massage commit message. ]

    Signed-off-by: Lianbo Jiang
    Signed-off-by: Borislav Petkov
    Cc: bhe@redhat.com
    Cc: Dave Young
    Cc: d.hatayama@fujitsu.com
    Cc: dhowells@redhat.com
    Cc: ebiederm@xmission.com
    Cc: horms@verge.net.au
    Cc: "H. Peter Anvin"
    Cc: Ingo Molnar
    Cc: Jürgen Gross
    Cc: kexec@lists.infradead.org
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: Tom Lendacky
    Cc: vgoyal@redhat.com
    Cc: x86-ml
    Link: https://lkml.kernel.org/r/20191108090027.11082-3-lijiang@redhat.com

    Lianbo Jiang
     

18 Oct, 2019

1 commit

  • Purgatory used no annotations at all. So include linux/linkage.h and
    annotate everything:

    * code by SYM_CODE_*
    * data by SYM_DATA_*

    [ bp: Fixup comment in gdt: ]

    Signed-off-by: Jiri Slaby
    Signed-off-by: Borislav Petkov
    Cc: Alexios Zavras
    Cc: Allison Randal
    Cc: Enrico Weigelt
    Cc: Greg Kroah-Hartman
    Cc: "H. Peter Anvin"
    Cc: Ingo Molnar
    Cc: linux-arch@vger.kernel.org
    Cc: Thomas Gleixner
    Cc: x86-ml
    Link: https://lkml.kernel.org/r/20191011115108.12392-16-jslaby@suse.cz

    Jiri Slaby
     

29 Sep, 2019

1 commit


24 Sep, 2019

1 commit

  • Since commit:

    b059f801a937 ("x86/purgatory: Use CFLAGS_REMOVE rather than reset KBUILD_CFLAGS")

    kexec breaks if GCC_PLUGIN_STACKLEAK=y is enabled, as the purgatory
    contains undefined references to stackleak_track_stack.

    Attempting to load a kexec kernel results in this failure:

    kexec: Undefined symbol: stackleak_track_stack
    kexec-bzImage64: Loading purgatory failed

    Fix this by disabling the stackleak plugin for the purgatory.

    Signed-off-by: Arvind Sankar
    Reviewed-by: Nick Desaulniers
    Cc: Borislav Petkov
    Cc: H. Peter Anvin
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Fixes: b059f801a937 ("x86/purgatory: Use CFLAGS_REMOVE rather than reset KBUILD_CFLAGS")
    Link: https://lkml.kernel.org/r/20190923171753.GA2252517@rani.riverdale.lan
    Signed-off-by: Ingo Molnar

    Arvind Sankar
     

19 Sep, 2019

1 commit

  • Pull crypto updates from Herbert Xu:
    "API:
    - Add the ability to abort a skcipher walk.

    Algorithms:
    - Fix XTS to actually do the stealing.
    - Add library helpers for AES and DES for single-block users.
    - Add library helpers for SHA256.
    - Add new DES key verification helper.
    - Add surrounding bits for ESSIV generator.
    - Add accelerations for aegis128.
    - Add test vectors for lzo-rle.

    Drivers:
    - Add i.MX8MQ support to caam.
    - Add gcm/ccm/cfb/ofb aes support in inside-secure.
    - Add ofb/cfb aes support in media-tek.
    - Add HiSilicon ZIP accelerator support.

    Others:
    - Fix potential race condition in padata.
    - Use unbound workqueues in padata"

    * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (311 commits)
    crypto: caam - Cast to long first before pointer conversion
    crypto: ccree - enable CTS support in AES-XTS
    crypto: inside-secure - Probe transform record cache RAM sizes
    crypto: inside-secure - Base RD fetchcount on actual RD FIFO size
    crypto: inside-secure - Base CD fetchcount on actual CD FIFO size
    crypto: inside-secure - Enable extended algorithms on newer HW
    crypto: inside-secure: Corrected configuration of EIP96_TOKEN_CTRL
    crypto: inside-secure - Add EIP97/EIP197 and endianness detection
    padata: remove cpu_index from the parallel_queue
    padata: unbind parallel jobs from specific CPUs
    padata: use separate workqueues for parallel and serial work
    padata, pcrypt: take CPU hotplug lock internally in padata_alloc_possible
    crypto: pcrypt - remove padata cpumask notifier
    padata: make padata_do_parallel find alternate callback CPU
    workqueue: require CPU hotplug read exclusion for apply_workqueue_attrs
    workqueue: unconfine alloc/apply/free_workqueue_attrs()
    padata: allocate workqueue internally
    arm64: dts: imx8mq: Add CAAM node
    random: Use wait_event_freezable() in add_hwgenerator_randomness()
    crypto: ux500 - Fix COMPILE_TEST warnings
    ...

    Linus Torvalds
     

06 Sep, 2019

1 commit

  • …ix kexec relocation errors

    The last change to this Makefile caused relocation errors when loading
    a kdump kernel. Restore -mcmodel=large (not -mcmodel=kernel),
    -ffreestanding, and -fno-zero-initialized-bsss, without reverting to
    the former practice of resetting KBUILD_CFLAGS.

    Purgatory.ro is a standalone binary that is not linked against the
    rest of the kernel. Its image is copied into an array that is linked
    to the kernel, and from there kexec relocates it wherever it desires.

    With the previous change to compiler flags, the error "kexec: Overflow
    in relocation type 11 value 0x11fffd000" was encountered when trying
    to load the crash kernel. This is from kexec code trying to relocate
    the purgatory.ro object.

    From the error message, relocation type 11 is R_X86_64_32S. The
    x86_64 ABI says:

    "The R_X86_64_32 and R_X86_64_32S relocations truncate the
    computed value to 32-bits. The linker must verify that the
    generated value for the R_X86_64_32 (R_X86_64_32S) relocation
    zero-extends (sign-extends) to the original 64-bit value."

    This type of relocation doesn't work when kexec chooses to place the
    purgatory binary in memory that is not reachable with 32 bit
    addresses.

    The compiler flag -mcmodel=kernel allows those type of relocations to
    be emitted, so revert to using -mcmodel=large as was done before.

    Also restore the -ffreestanding and -fno-zero-initialized-bss flags
    because they are appropriate for a stand alone piece of object code
    which doesn't explicitly zero the bss, and one other report has said
    undefined symbols are encountered without -ffreestanding.

    These identical compiler flag changes need to happen for every object
    that becomes part of the purgatory.ro object, so gather them together
    first into PURGATORY_CFLAGS_REMOVE and PURGATORY_CFLAGS, and then
    apply them to each of the objects that have C source. Do not apply
    any of these flags to kexec-purgatory.o, which is not part of the
    standalone object but part of the kernel proper.

    Tested-by: Vaibhav Rustagi <vaibhavrustagi@google.com>
    Tested-by: Andreas Smas <andreas@lonelycoder.com>
    Signed-off-by: Steve Wahl <steve.wahl@hpe.com>
    Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: H. Peter Anvin <hpa@zytor.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: None
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: clang-built-linux@googlegroups.com
    Cc: dimitri.sivanich@hpe.com
    Cc: mike.travis@hpe.com
    Cc: russ.anderson@hpe.com
    Fixes: b059f801a937 ("x86/purgatory: Use CFLAGS_REMOVE rather than reset KBUILD_CFLAGS")
    Link: https://lkml.kernel.org/r/20190905202346.GA26595@swahl-linux
    Signed-off-by: Ingo Molnar <mingo@kernel.org>

    Steve Wahl
     

05 Sep, 2019

1 commit


22 Aug, 2019

2 commits

  • Before this commit lib/crypto/sha256.c has only been used in the s390 and
    x86 purgatory code, make it suitable for generic use:

    * Export interesting symbols
    * Add -D__DISABLE_EXPORTS to CFLAGS_sha256.o for purgatory builds to
    avoid the exports for the purgatory builds
    * Add to lib/crypto/Makefile and crypto/Kconfig

    Signed-off-by: Hans de Goede
    Signed-off-by: Herbert Xu

    Hans de Goede
     
  • Generic crypto implementations belong under lib/crypto not directly in
    lib, likewise the header should be in include/crypto, not include/linux.

    Note that the code in lib/crypto/sha256.c is not yet available for
    generic use after this commit, it is still only used by the s390 and x86
    purgatory code. Making it suitable for generic use is done in further
    patches in this series.

    Signed-off-by: Hans de Goede
    Signed-off-by: Herbert Xu

    Hans de Goede
     

08 Aug, 2019

2 commits

  • KBUILD_CFLAGS is very carefully built up in the top level Makefile,
    particularly when cross compiling or using different build tools.
    Resetting KBUILD_CFLAGS via := assignment is an antipattern.

    The comment above the reset mentions that -pg is problematic. Other
    Makefiles use `CFLAGS_REMOVE_file.o = $(CC_FLAGS_FTRACE)` when
    CONFIG_FUNCTION_TRACER is set. Prefer that pattern to wiping out all of
    the important KBUILD_CFLAGS then manually having to re-add them. Seems
    also that __stack_chk_fail references are generated when using
    CONFIG_STACKPROTECTOR or CONFIG_STACKPROTECTOR_STRONG.

    Fixes: 8fc5b4d4121c ("purgatory: core purgatory functionality")
    Reported-by: Vaibhav Rustagi
    Suggested-by: Peter Zijlstra
    Suggested-by: Thomas Gleixner
    Signed-off-by: Nick Desaulniers
    Signed-off-by: Thomas Gleixner
    Tested-by: Vaibhav Rustagi
    Cc: stable@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190807221539.94583-2-ndesaulniers@google.com

    Nick Desaulniers
     
  • Implementing memcpy and memset in terms of __builtin_memcpy and
    __builtin_memset is problematic.

    GCC at -O2 will replace calls to the builtins with calls to memcpy and
    memset (but will generate an inline implementation at -Os). Clang will
    replace the builtins with these calls regardless of optimization level.
    $ llvm-objdump -dr arch/x86/purgatory/string.o | tail

    0000000000000339 memcpy:
    339: 48 b8 00 00 00 00 00 00 00 00 movabsq $0, %rax
    000000000000033b: R_X86_64_64 memcpy
    343: ff e0 jmpq *%rax

    0000000000000345 memset:
    345: 48 b8 00 00 00 00 00 00 00 00 movabsq $0, %rax
    0000000000000347: R_X86_64_64 memset
    34f: ff e0

    Such code results in infinite recursion at runtime. This is observed
    when doing kexec.

    Instead, reuse an implementation from arch/x86/boot/compressed/string.c.
    This requires to implement a stub function for warn(). Also, Clang may
    lower memcmp's that compare against 0 to bcmp's, so add a small definition,
    too. See also: commit 5f074f3e192f ("lib/string.c: implement a basic bcmp")

    Fixes: 8fc5b4d4121c ("purgatory: core purgatory functionality")
    Reported-by: Vaibhav Rustagi
    Debugged-by: Vaibhav Rustagi
    Debugged-by: Manoj Gupta
    Suggested-by: Alistair Delva
    Signed-off-by: Nick Desaulniers
    Signed-off-by: Thomas Gleixner
    Tested-by: Vaibhav Rustagi
    Cc: stable@vger.kernel.org
    Link: https://bugs.chromium.org/p/chromium/issues/detail?id=984056
    Link: https://lkml.kernel.org/r/20190807221539.94583-1-ndesaulniers@google.com

    Nick Desaulniers
     

19 Jun, 2019

1 commit

  • Based on 2 normalized pattern(s):

    this source code is licensed under the gnu general public license
    version 2 see the file copying for more details

    this source code is licensed under general public license version 2
    see

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 52 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Enrico Weigelt
    Reviewed-by: Allison Randal
    Reviewed-by: Alexios Zavras
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190602204653.449021192@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

18 Jul, 2018

1 commit

  • Commit 8370edea81e3 ("bin2c: move bin2c in scripts/basic") moved bin2c
    to the scripts/basic/ directory, incorrectly stating "Kexec wants to
    use bin2c and it wants to use it really early in the build process.
    See arch/x86/purgatory/ code in later patches."

    Commit bdab125c9301 ("Revert "kexec/purgatory: Add clean-up for
    purgatory directory"") and commit d6605b6bbee8 ("x86/build: Remove
    unnecessary preparation for purgatory") removed the redundant
    purgatory build magic entirely.

    That means that the move of bin2c was unnecessary in the first place.

    fixdep is the only host program that deserves to sit in the
    scripts/basic/ directory.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

15 Jul, 2018

1 commit

  • - Build the kernel without the fix
    - Add some flag to the purgatories KBUILD_CFLAGS,I used
    -fno-asynchronous-unwind-tables
    - Re-build the kernel

    When you look at makes output you see that sha256.o is not re-build in the
    last step. Also readelf -S still shows the .eh_frame section for
    sha256.o.

    With the fix sha256.o is rebuilt in the last step.

    Without FORCE make does not detect changes only made to the command line
    options. So object files might not be re-built even when they should be.
    Fix this by adding FORCE where it is missing.

    Link: http://lkml.kernel.org/r/20180704110044.29279-2-prudo@linux.ibm.com
    Fixes: df6f2801f511 ("kernel/kexec_file.c: move purgatories sha256 to common code")
    Signed-off-by: Philipp Rudo
    Acked-by: Dave Young
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Cc: [4.17+]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Philipp Rudo
     

14 Apr, 2018

1 commit

  • The code to verify the new kernels sha digest is applicable for all
    architectures. Move it to common code.

    One problem is the string.c implementation on x86. Currently sha256
    includes x86/boot/string.h which defines memcpy and memset to be gcc
    builtins. By moving the sha256 implementation to common code and
    changing the include to linux/string.h both functions are no longer
    defined. Thus definitions have to be provided in x86/purgatory/string.c

    Link: http://lkml.kernel.org/r/20180321112751.22196-12-prudo@linux.vnet.ibm.com
    Signed-off-by: Philipp Rudo
    Acked-by: Dave Young
    Cc: AKASHI Takahiro
    Cc: Eric Biederman
    Cc: Heiko Carstens
    Cc: Ingo Molnar
    Cc: Martin Schwidefsky
    Cc: Michael Ellerman
    Cc: Thiago Jung Bauermann
    Cc: Vivek Goyal
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Philipp Rudo
     

25 Mar, 2018

1 commit

  • The kernel build system already takes care of generating the dependency
    files. Having the additional -MD in KBUILD_CFLAGS leads to stray
    ..d files in the build directory when we call the cc-option macro.

    Signed-off-by: Sven Wegener
    Cc: H. Peter Anvin
    Cc: Kees Cook
    Cc: Linus Torvalds
    Cc: Matthias Kaehlcke
    Cc: Peter Zijlstra
    Cc: Sam Ravnborg
    Cc: Thomas Gleixner
    Cc: Vivek Goyal
    Link: http://lkml.kernel.org/r/alpine.LNX.2.21.1803242219380.30139@titan.int.lan.stealer.net
    Signed-off-by: Ingo Molnar

    Sven Wegener
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

01 Apr, 2017

1 commit

  • Fixes this:

    kexec: Undefined symbol: __asan_load8_noabort
    kexec-bzImage64: Loading purgatory failed

    Link: http://lkml.kernel.org/r/1489672155.4458.7.camel@gmx.de
    Signed-off-by: Mike Galbraith
    Cc: Alexander Potapenko
    Cc: Andrey Ryabinin
    Cc: Dmitry Vyukov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mike Galbraith
     

11 Mar, 2017

1 commit

  • The purgatory code defines global variables which are referenced via a
    symbol lookup in the kexec code (core and arch).

    A recent commit addressing sparse warnings made these static and thereby
    broke kexec_file.

    Why did this happen? Simply because the whole machinery is undocumented and
    lacks any form of forward declarations. The variable names are unspecific
    and lack a prefix, so adding forward declarations creates shadow variables
    in the core code. Aside of that the code relies on magic constants and
    duplicate struct definitions with no way to ensure that these things stay
    in sync. The section placement of the purgatory variables happened by
    chance and not by design.

    Unbreak kexec and cleanup the mess:

    - Add proper forward declarations and document the usage
    - Use common struct definition
    - Use the proper common defines instead of magic constants
    - Add a purgatory_ prefix to have a proper name space
    - Use ARRAY_SIZE() instead of a homebrewn reimplementation
    - Add proper sections to the purgatory variables [ From Mike ]

    Fixes: 72042a8c7b01 ("x86/purgatory: Make functions and variables static")
    Reported-by: Mike Galbraith <
    Signed-off-by: Thomas Gleixner
    Cc: Nicholas Mc Guire
    Cc: Borislav Petkov
    Cc: Vivek Goyal
    Cc: "Tobin C. Harding"
    Link: http://lkml.kernel.org/r/alpine.DEB.2.20.1703101315140.3681@nanos
    Signed-off-by: Thomas Gleixner

    Thomas Gleixner
     

01 Mar, 2017

2 commits

  • Sparse emits warning, 'symbol not declared' for a function that has
    neither file scope nor a forward declaration. The functions only call
    site is an ASM file.

    Add a header file with the function declaration. Include the header file in
    the C source file defining the function in order to fix the sparse
    warning. Include the header file in ASM file containing the call site to
    document the usage.

    Signed-off-by: Tobin C. Harding
    Link: http://lkml.kernel.org/r/1487545956-2547-3-git-send-email-me@tobin.cc
    Signed-off-by: Thomas Gleixner

    Tobin C. Harding
     
  • Sparse emits several 'symbol not declared' warnings for various
    functions and variables.

    Add static keyword to functions and variables which have file scope
    only.

    Signed-off-by: Tobin C. Harding
    Link: http://lkml.kernel.org/r/1487545956-2547-2-git-send-email-me@tobin.cc
    Signed-off-by: Thomas Gleixner

    Tobin C. Harding
     

10 Nov, 2016

1 commit

  • If the gcc is configured to do -fPIE by default then the build aborts
    later with:
    | Unsupported relocation type: unknown type rel type name (29)

    Tagging it stable so it is possible to compile recent stable kernels as
    well.

    Cc: stable@vger.kernel.org
    Signed-off-by: Sebastian Andrzej Siewior
    Signed-off-by: Michal Marek

    Sebastian Andrzej Siewior
     

08 Jun, 2016

1 commit

  • The sancov gcc plugin inserts a __sanitizer_cov_trace_pc() call
    at the start of basic blocks.

    This plugin is a helper plugin for the kcov feature. It supports
    all gcc versions with plugin support (from gcc-4.5 on).
    It is based on the gcc commit "Add fuzzing coverage support" by Dmitry Vyukov
    (https://gcc.gnu.org/viewcvs/gcc?limit_changes=0&view=revision&revision=231296).

    Signed-off-by: Emese Revfy
    Acked-by: Kees Cook
    Signed-off-by: Michal Marek

    Emese Revfy
     

20 Apr, 2016

1 commit

  • Since commit 2aedcd098a94 ('kbuild: suppress annoying "... is up to
    date." message'), $(call if_changed,...) is evaluated to "@:"
    when there is nothing to do.

    We no longer need to add "@:" after $(call if_changed,...) to
    suppress "... is up to date." message.

    Signed-off-by: Masahiro Yamada
    Signed-off-by: Michal Marek

    Masahiro Yamada
     

25 Mar, 2016

1 commit

  • Pull x86 fixes from Ingo Molnar:
    "Misc fixes:

    - fix hotplug bugs
    - fix irq live lock
    - fix various topology handling bugs
    - fix APIC ACK ordering
    - fix PV iopl handling
    - fix speling
    - fix/tweak memcpy_mcsafe() return value
    - fix fbcon bug
    - remove stray prototypes"

    * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    x86/msr: Remove unused native_read_tscp()
    x86/apic: Remove declaration of unused hw_nmi_is_cpu_stuck
    x86/oprofile/nmi: Add missing hotplug FROZEN handling
    x86/hpet: Use proper mask to modify hotplug action
    x86/apic/uv: Fix the hotplug notifier
    x86/apb/timer: Use proper mask to modify hotplug action
    x86/topology: Use total_cpus not nr_cpu_ids for logical packages
    x86/topology: Fix Intel HT disable
    x86/topology: Fix logical package mapping
    x86/irq: Cure live lock in fixup_irqs()
    x86/tsc: Prevent NULL pointer deref in calibrate_delay_is_known()
    x86/apic: Fix suspicious RCU usage in smp_trace_call_function_interrupt()
    x86/iopl: Fix iopl capability check on Xen PV
    x86/iopl/64: Properly context-switch IOPL on Xen PV
    selftests/x86: Add an iopl test
    x86/mm, x86/mce: Fix return type/value for memcpy_mcsafe()
    x86/video: Don't assume all FB devices are PCI devices
    arch/x86/irq: Purge useless handler declarations from hw_irq.h
    x86: Fix misspellings in comments

    Linus Torvalds
     

29 Feb, 2016

1 commit

  • Code which runs outside the kernel's normal mode of operation often does
    unusual things which can cause a static analysis tool like objtool to
    emit false positive warnings:

    - boot image
    - vdso image
    - relocation
    - realmode
    - efi
    - head
    - purgatory
    - modpost

    Set OBJECT_FILES_NON_STANDARD for their related files and directories,
    which will tell objtool to skip checking them. It's ok to skip them
    because they don't affect runtime stack traces.

    Also skip the following code which does the right thing with respect to
    frame pointers, but is too "special" to be validated by a tool:

    - entry
    - mcount

    Also skip the test_nx module because it modifies its exception handling
    table at runtime, which objtool can't understand. Fortunately it's
    just a test module so it doesn't matter much.

    Currently objtool is the only user of OBJECT_FILES_NON_STANDARD, but it
    might eventually be useful for other tools.

    Signed-off-by: Josh Poimboeuf
    Cc: Andrew Morton
    Cc: Andy Lutomirski
    Cc: Arnaldo Carvalho de Melo
    Cc: Bernd Petrovitsch
    Cc: Borislav Petkov
    Cc: Chris J Arges
    Cc: Jiri Slaby
    Cc: Linus Torvalds
    Cc: Michal Marek
    Cc: Namhyung Kim
    Cc: Pedro Alves
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: live-patching@vger.kernel.org
    Link: http://lkml.kernel.org/r/366c080e3844e8a5b6a0327dc7e8c2b90ca3baeb.1456719558.git.jpoimboe@redhat.com
    Signed-off-by: Ingo Molnar

    Josh Poimboeuf
     

24 Feb, 2016

1 commit


11 Dec, 2014

1 commit

  • …r-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

    Pull x86 build, cleanup and defconfig updates from Ingo Molnar:
    "A single minor build change to suppress a repetitive build messages,
    misc cleanups and a defconfig update"

    * 'x86-build-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    x86/purgatory, build: Suppress kexec-purgatory.c is up to date message

    * 'x86-cleanups-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    x86, CPU, AMD: Move K8 TLB flush filter workaround to K8 code
    x86, espfix: Remove stale ptemask
    x86, msr: Use seek definitions instead of hard-coded values
    x86, msr: Convert printk to pr_foo()
    x86, msr: Use PTR_ERR_OR_ZERO
    x86/simplefb: Use PTR_ERR_OR_ZERO
    x86/sysfb: Use PTR_ERR_OR_ZERO
    x86, cpuid: Use PTR_ERR_OR_ZERO

    * 'x86-debug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    x86/kconfig/defconfig: Enable CONFIG_FHANDLE=y

    Linus Torvalds