Skip to content
Snippets Groups Projects
user avatar
Vitaly Kuznetsov authored
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2119111



commit 334865b2
Author: Nick Desaulniers <ndesaulniers@google.com>
Date:   Tue Mar 29 13:21:45 2022 -0700

    x86/extable: Prefer local labels in .set directives

    Bernardo reported an error that Nathan bisected down to
    (x86_64) defconfig+LTO_CLANG_FULL+X86_PMEM_LEGACY.

        LTO     vmlinux.o
      ld.lld: error: <instantiation>:1:13: redefinition of 'found'
      .set found, 0
                  ^

      <inline asm>:29:1: while in macro instantiation
      extable_type_reg reg=%eax, type=(17 | ((0) << 16))
      ^

    This appears to be another LTO specific issue similar to what was folded
    into commit 4b5305de ("x86/extable: Extend extable functionality"),
    where the `.set found, 0` in DEFINE_EXTABLE_TYPE_REG in
    arch/x86/include/asm/asm.h conflicts with the symbol for the static
    function `found` in arch/x86/kernel/pmem.c.

    Assembler .set directive declare symbols with global visibility, so the
    assembler may not rename such symbols in the event of a conflict. LTO
    could rename static functions if there was a conflict in C sources, but
    it cannot see into symbols defined in inline asm.

    The symbols are also retained in the symbol table, regardless of LTO.

    Give the symbols .L prefixes making them locally visible, so that they
    may be renamed for LTO to avoid conflicts, and to drop them from the
    symbol table regardless of LTO.

    Fixes: 4b5305de ("x86/extable: Extend extable functionality")
Reported-by: default avatarBernardo Meurer Costa <beme@google.com>
Debugged-by: default avatarNathan Chancellor <nathan@kernel.org>
Signed-off-by: default avatarNick Desaulniers <ndesaulniers@google.com>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: default avatarNathan Chancellor <nathan@kernel.org>
Tested-by: default avatarNathan Chancellor <nathan@kernel.org>
    Link: https://lore.kernel.org/r/20220329202148.2379697-1-ndesaulniers@google.com



Omitted-Fix: f9a3099f ("s390/nospec: prefer local labels in .set directives")
Omitted-Fix: 68a971ac ("s390/extable: prefer local labels in .set directives")
as these are not fixes but rather similar s390 changes.

Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
761fefdd
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.