Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
  1. Apr 07, 2022
  2. Apr 05, 2022
    • Peter Zijlstra's avatar
      objtool: Fix SLS validation for kcov tail-call replacement · 7a53f408
      Peter Zijlstra authored
      Since not all compilers have a function attribute to disable KCOV
      instrumentation, objtool can rewrite KCOV instrumentation in noinstr
      functions as per commit:
      
        f56dae88 ("objtool: Handle __sanitize_cov*() tail calls")
      
      However, this has subtle interaction with the SLS validation from
      commit:
      
        1cc1e4c8 ("objtool: Add straight-line-speculation validation")
      
      In that when a tail-call instrucion is replaced with a RET an
      additional INT3 instruction is also written, but is not represented in
      the decoded instruction stream.
      
      This then leads to false positive missing INT3 objtool warnings in
      noinstr code.
      
      Instead of adding additional struct instruction objects, mark the RET
      instruction with retpoline_safe to suppress the warning (since we know
      there really is an INT3).
      
      Fixes: 1cc1e4c8
      
       ("objtool: Add straight-line-speculation validation")
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lkml.kernel.org/r/20220323230712.GA8939@worktop.programming.kicks-ass.net
      7a53f408
    • Peter Zijlstra's avatar
      objtool: Fix IBT tail-call detection · d139bca4
      Peter Zijlstra authored
      Objtool reports:
      
        arch/x86/crypto/poly1305-x86_64.o: warning: objtool: poly1305_blocks_avx() falls through to next function poly1305_blocks_x86_64()
        arch/x86/crypto/poly1305-x86_64.o: warning: objtool: poly1305_emit_avx() falls through to next function poly1305_emit_x86_64()
        arch/x86/crypto/poly1305-x86_64.o: warning: objtool: poly1305_blocks_avx2() falls through to next function poly1305_blocks_x86_64()
      
      Which reads like:
      
      0000000000000040 <poly1305_blocks_x86_64>:
      	 40:       f3 0f 1e fa             endbr64
      	...
      
      0000000000000400 <poly1305_blocks_avx>:
      	400:       f3 0f 1e fa             endbr64
      	404:       44 8b 47 14             mov    0x14(%rdi),%r8d
      	408:       48 81 fa 80 00 00 00    cmp    $0x80,%rdx
      	40f:       73 09                   jae    41a <poly1305_blocks_avx+0x1a>
      	411:       45 85 c0                test   %r8d,%r8d
      	414:       0f 84 2a fc ff ff       je     44 <poly1305_blocks_x86_64+0x4>
      	...
      
      These are simple conditional tail-calls and *should* be recognised as
      such by objtool, however due to a mistake in commit 08f87a93
      ("objtool: Validate IBT assumptions") this is failing.
      
      Specifically, the jump_dest is +4, this means the instruction pointed
      at will not be ENDBR and as such it will fail the second clause of
      is_first_func_insn() that was supposed to capture this exact case.
      
      Instead, have is_first_func_insn() look at the previous instruction.
      
      Fixes: 08f87a93
      
       ("objtool: Validate IBT assumptions")
      Reported-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lkml.kernel.org/r/20220322115125.811582125@infradead.org
      d139bca4
    • Vincent Mailhol's avatar
      x86/bug: Prevent shadowing in __WARN_FLAGS · 9ce02f0f
      Vincent Mailhol authored
      The macro __WARN_FLAGS() uses a local variable named "f". This being a
      common name, there is a risk of shadowing other variables.
      
      For example, GCC would yield:
      
      | In file included from ./include/linux/bug.h:5,
      |                  from ./include/linux/cpumask.h:14,
      |                  from ./arch/x86/include/asm/cpumask.h:5,
      |                  from ./arch/x86/include/asm/msr.h:11,
      |                  from ./arch/x86/include/asm/processor.h:22,
      |                  from ./arch/x86/include/asm/timex.h:5,
      |                  from ./include/linux/timex.h:65,
      |                  from ./include/linux/time32.h:13,
      |                  from ./include/linux/time.h:60,
      |                  from ./include/linux/stat.h:19,
      |                  from ./include/linux/module.h:13,
      |                  from virt/lib/irqbypass.mod.c:1:
      | ./include/linux/rcupdate.h: In function 'rcu_head_after_call_rcu':
      | ./arch/x86/include/asm/bug.h:80:21: warning: declaration of 'f' shadows a parameter [-Wshadow]
      |    80 |         __auto_type f = BUGFLAG_WARNING|(flags);                \
      |       |                     ^
      | ./include/asm-generic/bug.h:106:17: note: in expansion of macro '__WARN_FLAGS'
      |   106 |                 __WARN_FLAGS(BUGFLAG_ONCE |                     \
      |       |                 ^~~~~~~~~~~~
      | ./include/linux/rcupdate.h:1007:9: note: in expansion of macro 'WARN_ON_ONCE'
      |  1007 |         WARN_ON_ONCE(func != (rcu_callback_t)~0L);
      |       |         ^~~~~~~~~~~~
      | In file included from ./include/linux/rbtree.h:24,
      |                  from ./include/linux/mm_types.h:11,
      |                  from ./include/linux/buildid.h:5,
      |                  from ./include/linux/module.h:14,
      |                  from virt/lib/irqbypass.mod.c:1:
      | ./include/linux/rcupdate.h:1001:62: note: shadowed declaration is here
      |  1001 | rcu_head_after_call_rcu(struct rcu_head *rhp, rcu_callback_t f)
      |       |                                               ~~~~~~~~~~~~~~~^
      
      For reference, sparse also warns about it, c.f. [1].
      
      This patch renames the variable from f to __flags (with two underscore
      prefixes as suggested in the Linux kernel coding style [2]) in order
      to prevent collisions.
      
      [1] https://lore.kernel.org/all/CAFGhKbyifH1a+nAMCvWM88TK6fpNPdzFtUXPmRGnnQeePV+1sw@mail.gmail.com/
      
      [2] Linux kernel coding style, section 12) Macros, Enums and RTL,
      paragraph 5) namespace collisions when defining local variables in
      macros resembling functions
      https://www.kernel.org/doc/html/latest/process/coding-style.html#macros-enums-and-rtl
      
      Fixes: bfb1a7c9
      
       ("x86/bug: Merge annotate_reachable() into_BUG_FLAGS() asm")
      Signed-off-by: default avatarVincent Mailhol <mailhol.vincent@wanadoo.fr>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Acked-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
      Link: https://lkml.kernel.org/r/20220324023742.106546-1-mailhol.vincent@wanadoo.fr
      9ce02f0f
  3. Apr 04, 2022
    • Dave Hansen's avatar
      x86/mm/tlb: Revert retpoline avoidance approach · d39268ad
      Dave Hansen authored
      0day reported a regression on a microbenchmark which is intended to
      stress the TLB flushing path:
      
      	https://lore.kernel.org/all/20220317090415.GE735@xsang-OptiPlex-9020/
      
      It pointed at a commit from Nadav which intended to remove retpoline
      overhead in the TLB flushing path by taking the 'cond'-ition in
      on_each_cpu_cond_mask(), pre-calculating it, and incorporating it into
      'cpumask'.  That allowed the code to use a bunch of earlier direct
      calls instead of later indirect calls that need a retpoline.
      
      But, in practice, threads can go idle (and into lazy TLB mode where
      they don't need to flush their TLB) between the early and late calls.
      It works in this direction and not in the other because TLB-flushing
      threads tend to hold mmap_lock for write.  Contention on that lock
      causes threads to _go_ idle right in this early/late window.
      
      There was not any performance data in the original commit specific
      to the retpoline overhead.  I did a few tests on a system with
      re...
      d39268ad
  4. Apr 03, 2022
    • Linus Torvalds's avatar
      Linux 5.18-rc1 · 31231092
      Linus Torvalds authored
      v5.18-rc1
      31231092
    • Linus Torvalds's avatar
      Merge tag 'trace-v5.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace · 09bb8856
      Linus Torvalds authored
      Pull more tracing updates from Steven Rostedt:
      
       - Rename the staging files to give them some meaning. Just
         stage1,stag2,etc, does not show what they are for
      
       - Check for NULL from allocation in bootconfig
      
       - Hold event mutex for dyn_event call in user events
      
       - Mark user events to broken (to work on the API)
      
       - Remove eBPF updates from user events
      
       - Remove user events from uapi header to keep it from being installed.
      
       - Move ftrace_graph_is_dead() into inline as it is called from hot
         paths and also convert it into a static branch.
      
      * tag 'trace-v5.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
        tracing: Move user_events.h temporarily out of include/uapi
        ftrace: Make ftrace_graph_is_dead() a static branch
        tracing: Set user_events to BROKEN
        tracing/user_events: Remove eBPF interfaces
        tracing/user_events: Hold event_mutex during dyn_event_add
        proc: bootconfig: Add null pointer check
        tracing: Rename the staging files for trace_events
      09bb8856
    • Linus Torvalds's avatar
      Merge tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux · 34a53ff9
      Linus Torvalds authored
      Pull clk fix from Stephen Boyd:
       "A single revert to fix a boot regression seen when clk_put() started
        dropping rate range requests. It's best to keep various systems
        booting so we'll kick this out and try again next time"
      
      * tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux:
        Revert "clk: Drop the rate range on clk_put()"
      34a53ff9
    • Linus Torvalds's avatar
      Merge tag 'x86-urgent-2022-04-03' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 8b5656bc
      Linus Torvalds authored
      Pull x86 fixes from Thomas Gleixner:
       "A set of x86 fixes and updates:
      
         - Make the prctl() for enabling dynamic XSTATE components correct so
           it adds the newly requested feature to the permission bitmap
           instead of overwriting it. Add a selftest which validates that.
      
         - Unroll string MMIO for encrypted SEV guests as the hypervisor
           cannot emulate it.
      
         - Handle supervisor states correctly in the FPU/XSTATE code so it
           takes the feature set of the fpstate buffer into account. The
           feature sets can differ between host and guest buffers. Guest
           buffers do not contain supervisor states. So far this was not an
           issue, but with enabling PASID it needs to be handled in the buffer
           offset calculation and in the permission bitmaps.
      
         - Avoid a gazillion of repeated CPUID invocations in by caching the
           values early in the FPU/XSTATE code.
      
         - Enable CONFIG_WERROR in x86 defconfig.
      
         - Make the X86 defconfigs more useful by adapting them to Y2022
           reality"
      
      * tag 'x86-urgent-2022-04-03' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/fpu/xstate: Consolidate size calculations
        x86/fpu/xstate: Handle supervisor states in XSTATE permissions
        x86/fpu/xsave: Handle compacted offsets correctly with supervisor states
        x86/fpu: Cache xfeature flags from CPUID
        x86/fpu/xsave: Initialize offset/size cache early
        x86/fpu: Remove unused supervisor only offsets
        x86/fpu: Remove redundant XCOMP_BV initialization
        x86/sev: Unroll string mmio with CC_ATTR_GUEST_UNROLL_STRING_IO
        x86/config: Make the x86 defconfigs a bit more usable
        x86/defconfig: Enable WERROR
        selftests/x86/amx: Update the ARCH_REQ_XCOMP_PERM test
        x86/fpu/xstate: Fix the ARCH_REQ_XCOMP_PERM implementation
      8b5656bc
    • Linus Torvalds's avatar
      Merge tag 'core-urgent-2022-04-03' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · e235f419
      Linus Torvalds authored
      Pull RT signal fix from Thomas Gleixner:
       "Revert the RT related signal changes. They need to be reworked and
        generalized"
      
      * tag 'core-urgent-2022-04-03' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        Revert "signal, x86: Delay calling signals in atomic on RT enabled kernels"
      e235f419
    • Linus Torvalds's avatar
      Merge tag 'dma-mapping-5.18-1' of git://git.infradead.org/users/hch/dma-mapping · 63d12cc3
      Linus Torvalds authored
      Pull more dma-mapping updates from Christoph Hellwig:
      
       - fix a regression in dma remap handling vs AMD memory encryption (me)
      
       - finally kill off the legacy PCI DMA API (Christophe JAILLET)
      
      * tag 'dma-mapping-5.18-1' of git://git.infradead.org/users/hch/dma-mapping:
        dma-mapping: move pgprot_decrypted out of dma_pgprot
        PCI/doc: cleanup references to the legacy PCI DMA API
        PCI: Remove the deprecated "pci-dma-compat.h" API
      63d12cc3
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm · 5dee8721
      Linus Torvalds authored
      Pull ARM fixes from Russell King:
      
       - avoid unnecessary rebuilds for library objects
      
       - fix return value of __setup handlers
      
       - fix invalid input check for "crashkernel=" kernel option
      
       - silence KASAN warnings in unwind_frame
      
      * tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm:
        ARM: 9191/1: arm/stacktrace, kasan: Silence KASAN warnings in unwind_frame()
        ARM: 9190/1: kdump: add invalid input check for 'crashkernel=0'
        ARM: 9187/1: JIVE: fix return value of __setup handler
        ARM: 9189/1: decompressor: fix unneeded rebuilds of library objects
      5dee8721
  5. Apr 02, 2022