17 Nov, 2020

1 commit

  • Enable CONFIG_UAPI_HEADER_TEST or make headers_install result in build issues:

    include/uapi/linux/fmd/Peripherals/fm_port_ioctls.h: leak CONFIG_COMPAT to user-space
    include/uapi/linux/fmd/Peripherals/fm_pcd_ioctls.h: leak CONFIG_COMPAT to user-space
    include/uapi/linux/fmd/Peripherals/fm_ioctls.h: leak CONFIG_COMPAT to user-space

    The comments from DN fix of the fmd related failure is to add to the skip-list due to the
    historial reasons from DN(Layerscape) drivers - to avoid break the legacy users

    Signed-off-by: Jason Liu
    (cherry picked from commit 569d6d3cc2a664de66ee980bd611687f4d785b4e)

    Jason Liu
     

08 Oct, 2020

1 commit

  • * tag 'v5.4.70': (3051 commits)
    Linux 5.4.70
    netfilter: ctnetlink: add a range check for l3/l4 protonum
    ep_create_wakeup_source(): dentry name can change under you...
    ...

    Conflicts:
    arch/arm/mach-imx/pm-imx6.c
    arch/arm64/boot/dts/freescale/imx8mm-evk.dts
    arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts
    drivers/crypto/caam/caamalg.c
    drivers/gpu/drm/imx/dw_hdmi-imx.c
    drivers/gpu/drm/imx/imx-ldb.c
    drivers/gpu/drm/imx/ipuv3/ipuv3-crtc.c
    drivers/mmc/host/sdhci-esdhc-imx.c
    drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
    drivers/net/ethernet/freescale/enetc/enetc.c
    drivers/net/ethernet/freescale/enetc/enetc_pf.c
    drivers/thermal/imx_thermal.c
    drivers/usb/cdns3/ep0.c
    drivers/xen/swiotlb-xen.c
    sound/soc/fsl/fsl_esai.c
    sound/soc/fsl/fsl_sai.c

    Signed-off-by: Jason Liu

    Jason Liu
     

07 Oct, 2020

1 commit

  • [ Upstream commit efe84d408bf41975db8506d3a1cc02e794e2309c ]

    When building with

    $ HOST_EXTRACFLAGS=-g make

    the expectation is that host tools are built with debug informations.
    This however doesn't happen if the Makefile assigns a new value to the
    HOST_EXTRACFLAGS instead of appending to it. So use += instead of := for
    the first assignment.

    Fixes: e3fd9b5384f3 ("scripts/dtc: consolidate include path options in Makefile")
    Signed-off-by: Uwe Kleine-König
    Signed-off-by: Rob Herring
    Signed-off-by: Sasha Levin

    Uwe Kleine-König
     

22 Sep, 2020

2 commits


10 Sep, 2020

1 commit

  • commit 13e45417cedbfc44b1926124b1846f5ee8c6ba4a upstream.

    The usage of "capture group (...)" in the immediate condition after `&&`
    results in `$1` being uninitialized. This issues a warning "Use of
    uninitialized value $1 in regexp compilation at ./scripts/checkpatch.pl
    line 2638".

    I noticed this bug while running checkpatch on the set of commits from
    v5.7 to v5.8-rc1 of the kernel on the commits with a diff content in
    their commit message.

    This bug was introduced in the script by commit e518e9a59ec3
    ("checkpatch: emit an error when there's a diff in a changelog"). It
    has been in the script since then.

    The author intended to store the match made by capture group in variable
    `$1`. This should have contained the name of the file as `[\w/]+`
    matched. However, this couldn't be accomplished due to usage of capture
    group and `$1` in the same regular expression.

    Fix this by placing the capture group in the condition before `&&`.
    Thus, `$1` can be initialized to the text that capture group matches
    thereby setting it to the desired and required value.

    Fixes: e518e9a59ec3 ("checkpatch: emit an error when there's a diff in a changelog")
    Signed-off-by: Mrinal Pandey
    Signed-off-by: Andrew Morton
    Tested-by: Lukas Bulwahn
    Reviewed-by: Lukas Bulwahn
    Cc: Joe Perches
    Link: https://lkml.kernel.org/r/20200714032352.f476hanaj2dlmiot@mrinalpandey
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Mrinal Pandey
     

03 Sep, 2020

2 commits

  • commit e4a42c82e943b97ce124539fcd7a47445b43fa0d upstream.

    Redefine GZIP, BZIP2, LZOP variables as KGZIP, KBZIP2, KLZOP resp.
    GZIP, BZIP2, LZOP env variables are reserved by the tools. The original
    attempt to redefine them internally doesn't work in makefiles/scripts
    intercall scenarios, e.g., "make GZIP=gzip bindeb-pkg" and results in
    broken builds. There can be other broken build commands because of this,
    so the universal solution is to use non-reserved env variables for the
    compression tools.

    Fixes: 8dfb61dcbace ("kbuild: add variables for compression tools")
    Signed-off-by: Denis Efremov
    Tested-by: Guenter Roeck
    Signed-off-by: Masahiro Yamada
    Cc: Matthias Maennich
    Signed-off-by: Greg Kroah-Hartman

    Denis Efremov
     
  • commit 8dfb61dcbaceb19a5ded5e9c9dcf8d05acc32294 upstream.

    Allow user to use alternative implementations of compression tools,
    such as pigz, pbzip2, pxz. For example, multi-threaded tools to
    speed up the build:
    $ make GZIP=pigz BZIP2=pbzip2

    Variables _GZIP, _BZIP2, _LZOP are used internally because original env
    vars are reserved by the tools. The use of GZIP in gzip tool is obsolete
    since 2015. However, alternative implementations (e.g., pigz) still rely
    on it. BZIP2, BZIP, LZOP vars are not obsolescent.

    The credit goes to @grsecurity.

    As a sidenote, for multi-threaded lzma, xz compression one can use:
    $ export XZ_OPT="--threads=0"

    Signed-off-by: Denis Efremov
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Matthias Maennich
    Signed-off-by: Greg Kroah-Hartman

    Denis Efremov
     

26 Aug, 2020

2 commits

  • [ Upstream commit d85de3399f97467baa2026fbbbe587850d01ba8a ]

    If you right-click in the ConfigList window, you will see the following
    messages in the console:

    QObject::connect: No such slot QAction::setOn(bool) in scripts/kconfig/qconf.cc:888
    QObject::connect: (sender name: 'config')
    QObject::connect: No such slot QAction::setOn(bool) in scripts/kconfig/qconf.cc:897
    QObject::connect: (sender name: 'config')
    QObject::connect: No such slot QAction::setOn(bool) in scripts/kconfig/qconf.cc:906
    QObject::connect: (sender name: 'config')

    Right, there is no such slot in QAction. I think this is a typo of
    setChecked.

    Due to this bug, when you toggled the menu "Option->Show Name/Range/Data"
    the state of the context menu was not previously updated. Fix this.

    Fixes: d5d973c3f8a9 ("Port xconfig to Qt5 - Put back some of the old implementation(part 2)")
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Sasha Levin

    Masahiro Yamada
     
  • [ Upstream commit fa8de0a3bf3c02e6f00b7746e7e934db522cdda9 ]

    If you right-click the first row in the option tree, the pop-up menu
    shows up, but if you right-click the second row or below, the event
    is ignored due to the following check:

    if (e->y() geometry().bottom()) {

    Perhaps, the intention was to show the pop-menu only when the tree
    header was right-clicked, but this handler is not called in that case.

    Since the origin of e->y() starts from the bottom of the header,
    this check is odd.

    Going forward, you can right-click anywhere in the tree to get the
    pop-up menu.

    Signed-off-by: Masahiro Yamada
    Signed-off-by: Sasha Levin

    Masahiro Yamada
     

21 Aug, 2020

1 commit

  • [ Upstream commit 3df14264ad9930733a8166e5bd0eccc1727564bb ]

    Commit ea0eada45632 leads to the following build failure on powerpc:

    HOSTCC scripts/recordmcount
    scripts/recordmcount.c: In function 'arm64_is_fake_mcount':
    scripts/recordmcount.c:440: error: 'R_AARCH64_CALL26' undeclared (first use in this function)
    scripts/recordmcount.c:440: error: (Each undeclared identifier is reported only once
    scripts/recordmcount.c:440: error: for each function it appears in.)
    make[2]: *** [scripts/recordmcount] Error 1

    Make sure R_AARCH64_CALL26 is always defined.

    Fixes: ea0eada45632 ("recordmcount: only record relocation of type R_AARCH64_CALL26 on arm64.")
    Signed-off-by: Christophe Leroy
    Acked-by: Steven Rostedt (VMware)
    Acked-by: Gregory Herrero
    Cc: Gregory Herrero
    Link: https://lore.kernel.org/r/5ca1be21fa6ebf73203b45fd9aadd2bafb5e6b15.1597049145.git.christophe.leroy@csgroup.eu
    Signed-off-by: Catalin Marinas
    Signed-off-by: Sasha Levin

    Christophe Leroy
     

19 Aug, 2020

1 commit

  • [ Upstream commit ea0eada45632f4807b2f49de951072283e2d781c ]

    Currently, if a section has a relocation to '_mcount' symbol, a new
    __mcount_loc entry will be added whatever the relocation type is.
    This is problematic when a relocation to '_mcount' is in the middle of a
    section and is not a call for ftrace use.

    Such relocation could be generated with below code for example:
    bool is_mcount(unsigned long addr)
    {
    return (target == (unsigned long) &_mcount);
    }

    With this snippet of code, ftrace will try to patch the mcount location
    generated by this code on module load and fail with:

    Call trace:
    ftrace_bug+0xa0/0x28c
    ftrace_process_locs+0x2f4/0x430
    ftrace_module_init+0x30/0x38
    load_module+0x14f0/0x1e78
    __do_sys_finit_module+0x100/0x11c
    __arm64_sys_finit_module+0x28/0x34
    el0_svc_common+0x88/0x194
    el0_svc_handler+0x38/0x8c
    el0_svc+0x8/0xc
    ---[ end trace d828d06b36ad9d59 ]---
    ftrace failed to modify
    [] 0xffffa2dbf3a3a41c
    actual: 66:a9:3c:90
    Initializing ftrace call sites
    ftrace record flags: 2000000
    (0)
    expected tramp: ffffa2dc6cf66724

    So Limit the relocation type to R_AARCH64_CALL26 as in perl version of
    recordmcount.

    Fixes: af64d2aa872a ("ftrace: Add arm64 support to recordmcount")
    Signed-off-by: Gregory Herrero
    Acked-by: Steven Rostedt (VMware)
    Link: https://lore.kernel.org/r/20200717143338.19302-1-gregory.herrero@oracle.com
    Signed-off-by: Catalin Marinas
    Signed-off-by: Sasha Levin

    Gregory Herrero
     

11 Aug, 2020

1 commit

  • commit 55c7549819e438f40a3ef1d8ac5c38b73390bcb7 upstream.

    When running `make coccicheck` in report mode using the
    add_namespace.cocci file, it will fail for files that contain
    MODULE_LICENSE. Those match the replacement precondition, but spatch
    errors out as virtual.ns is not set.

    In order to fix that, add the virtual rule nsdeps and only do search and
    replace if that rule has been explicitly requested.

    In order to make spatch happy in report mode, we also need a dummy rule,
    as otherwise it errors out with "No rules apply". Using a script:python
    rule appears unrelated and odd, but this is the shortest I could come up
    with.

    Adjust scripts/nsdeps accordingly to set the nsdeps rule when run trough
    `make nsdeps`.

    Suggested-by: Julia Lawall
    Fixes: c7c4e29fb5a4 ("scripts: add_namespace: Fix coccicheck failed")
    Cc: YueHaibing
    Cc: jeyu@kernel.org
    Cc: cocci@systeme.lip6.fr
    Cc: stable@vger.kernel.org
    Signed-off-by: Matthias Maennich
    Reported-by: Shuah Khan
    Acked-by: Julia Lawall
    Link: https://lore.kernel.org/r/20200604164145.173925-1-maennich@google.com
    Signed-off-by: Greg Kroah-Hartman

    Matthias Maennich
     

29 Jul, 2020

2 commits

  • [ Upstream commit 7359608a271ce81803de148befefd309baf88c76 ]

    Commit ed66f991bb19 ("module: Refactor section attr into bin attribute")
    removed the 'name' field from 'struct module_sect_attr' triggering the
    following error when invoking lx-symbols:

    (gdb) lx-symbols
    loading vmlinux
    scanning for modules in linux/build
    loading @0xffffffffc014f000: linux/build/drivers/net/tun.ko
    Python Exception There is no member named name.:
    Error occurred in Python: There is no member named name.

    This patch fixes the issue taking the module name from the 'struct
    attribute'.

    Fixes: ed66f991bb19 ("module: Refactor section attr into bin attribute")
    Signed-off-by: Stefano Garzarella
    Signed-off-by: Andrew Morton
    Reviewed-by: Jan Kiszka
    Reviewed-by: Kieran Bingham
    Link: http://lkml.kernel.org/r/20200722102239.313231-1-sgarzare@redhat.com
    Signed-off-by: Linus Torvalds
    Signed-off-by: Sasha Levin

    Stefano Garzarella
     
  • [ Upstream commit d178770d8d21489abf5bafefcbb6d5243b482e9a ]

    Currently the basepath is removed only from the beginning of the string.
    When the symbol is inlined and there's multiple line outputs of
    addr2line, only the first line would have basepath removed.

    Change to remove the basepath prefix from all lines.

    Fixes: 31013836a71e ("scripts/decode_stacktrace: match basepath using shell prefix operator, not regex")
    Co-developed-by: Shik Chen
    Signed-off-by: Pi-Hsun Shih
    Signed-off-by: Shik Chen
    Signed-off-by: Andrew Morton
    Reviewed-by: Stephen Boyd
    Cc: Sasha Levin
    Cc: Nicolas Boichat
    Cc: Jiri Slaby
    Link: http://lkml.kernel.org/r/20200720082709.252805-1-pihsun@chromium.org
    Signed-off-by: Linus Torvalds
    Signed-off-by: Sasha Levin

    Pi-Hsun Shih
     

01 Jul, 2020

2 commits

  • [ Upstream commit 4ef57b21d6fb49d2b25c47e4cff467a0c2c8b6b7 ]

    When compiling a kernel with Clang and LTO, we need to run
    recordmcount on vmlinux.o with a large number of sections, which
    currently fails as the program doesn't understand extended
    section indexes. This change adds support for processing binaries
    with >64k sections.

    Link: https://lkml.kernel.org/r/20200424193046.160744-1-samitolvanen@google.com
    Link: https://lore.kernel.org/lkml/CAK7LNARbZhoaA=Nnuw0=gBrkuKbr_4Ng_Ei57uafujZf7Xazgw@mail.gmail.com/

    Cc: Kees Cook
    Reviewed-by: Matt Helsley
    Signed-off-by: Sami Tolvanen
    Signed-off-by: Steven Rostedt (VMware)
    Signed-off-by: Sasha Levin

    Sami Tolvanen
     
  • [ Upstream commit f2f02ebd8f3833626642688b2d2c6a7b3c141fa9 ]

    When cc-option and friends evaluate compiler flags, the temporary file
    $$TMP is created as an output object, and automatically cleaned up.
    The actual file path of $$TMP is ..tmp, here is the process
    ID of $(shell ...) invoked from cc-option. (Please note $$$$ is the
    escape sequence of $$).

    Such garbage files are cleaned up in most cases, but some compiler flags
    create additional output files.

    For example, -gsplit-dwarf creates a .dwo file.

    When CONFIG_DEBUG_INFO_SPLIT=y, you will see a bunch of ..dwo files
    left in the top of build directories. You may not notice them unless you
    do 'ls -a', but the garbage files will increase every time you run 'make'.

    This commit changes the temporary object path to .tmp_/tmp, and
    removes .tmp_ directory when exiting. Separate build artifacts such
    as *.dwo will be cleaned up all together because their file paths are
    usually determined based on the base name of the object.

    Another example is -ftest-coverage, which outputs the coverage data into
    .gcno

    Signed-off-by: Masahiro Yamada
    Signed-off-by: Sasha Levin

    Masahiro Yamada
     

24 Jun, 2020

2 commits

  • [ Upstream commit 5967577231f9b19acd5a59485e9075964065bbe3 ]

    Misuse of CONFIG_* in UAPI headers should result in an error. These config
    options can be set in userspace by the user application which includes
    these headers to control the APIs and structures being used in a kernel
    which supports multiple targets.

    Signed-off-by: Siddharth Gupta
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Sasha Levin

    Siddharth Gupta
     
  • [ Upstream commit 72d24accf02add25e08733f0ecc93cf10fcbd88c ]

    When System.map was generated, the kernel used mksysmap to
    filter the kernel symbols, but all the symbols with the
    second letter 'L' in the kernel were filtered out, not just
    the symbols starting with 'dot + L'.

    For example:
    ashimida@ubuntu:~/linux$ cat System.map |grep ' .L'
    ashimida@ubuntu:~/linux$ nm -n vmlinux |grep ' .L'
    ffff0000088028e0 t bLength_show
    ......
    ffff0000092e0408 b PLLP_OUTC_lock
    ffff0000092e0410 b PLLP_OUTA_lock

    The original intent should be to filter out all local symbols
    starting with '.L', so the dot should be escaped.

    Fixes: 00902e984732 ("mksysmap: Add h8300 local symbol pattern")
    Signed-off-by: ashimida
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Sasha Levin

    ashimida
     

17 Jun, 2020

1 commit

  • commit 90ceddcb495008ac8ba7a3dce297841efcd7d584 upstream.

    Simplify gen_btf logic to make it work with llvm-objcopy. The existing
    'file format' and 'architecture' parsing logic is brittle and does not
    work with llvm-objcopy/llvm-objdump.

    'file format' output of llvm-objdump>=11 will match GNU objdump, but
    'architecture' (bfdarch) may not.

    .BTF in .tmp_vmlinux.btf is non-SHF_ALLOC. Add the SHF_ALLOC flag
    because it is part of vmlinux image used for introspection. C code
    can reference the section via linker script defined __start_BTF and
    __stop_BTF. This fixes a small problem that previous .BTF had the
    SHF_WRITE flag (objcopy -I binary -O elf* synthesized .data).

    Additionally, `objcopy -I binary` synthesized symbols
    _binary__btf_vmlinux_bin_start and _binary__btf_vmlinux_bin_stop (not
    used elsewhere) are replaced with more commonplace __start_BTF and
    __stop_BTF.

    Add 2>/dev/null because GNU objcopy (but not llvm-objcopy) warns
    "empty loadable segment detected at vaddr=0xffffffff81000000, is this intentional?"

    We use a dd command to change the e_type field in the ELF header from
    ET_EXEC to ET_REL so that lld will accept .btf.vmlinux.bin.o. Accepting
    ET_EXEC as an input file is an extremely rare GNU ld feature that lld
    does not intend to support, because this is error-prone.

    The output section description .BTF in include/asm-generic/vmlinux.lds.h
    avoids potential subtle orphan section placement issues and suppresses
    --orphan-handling=warn warnings.

    Fixes: df786c9b9476 ("bpf: Force .BTF section start to zero when dumping from vmlinux")
    Fixes: cb0cc635c7a9 ("powerpc: Include .BTF section")
    Reported-by: Nathan Chancellor
    Signed-off-by: Fangrui Song
    Signed-off-by: Daniel Borkmann
    Tested-by: Stanislav Fomichev
    Tested-by: Andrii Nakryiko
    Reviewed-by: Stanislav Fomichev
    Reviewed-by: Kees Cook
    Acked-by: Andrii Nakryiko
    Acked-by: Michael Ellerman (powerpc)
    Link: https://github.com/ClangBuiltLinux/linux/issues/871
    Link: https://lore.kernel.org/bpf/20200318222746.173648-1-maskray@google.com
    Signed-off-by: Maria Teguiani
    Tested-by: Matthias Maennich
    Signed-off-by: Greg Kroah-Hartman

    Fangrui Song
     

27 May, 2020

3 commits

  • [ Upstream commit af73d78bd384aa9b8789aa6e7ddbb165f971276f ]

    When CONFIG_DEBUG_INFO is enabled, the two kallsyms linking steps spend
    time collecting and writing the dwarf sections to the temporary output
    files. kallsyms does not need this information, and leaving it off
    halves their linking time. This is especially noticeable without
    CONFIG_DEBUG_INFO_REDUCED. The BTF linking stage, however, does still
    need those details.

    Refactor the BTF and kallsyms generation stages slightly for more
    regularized temporary names. Skip debug during kallsyms links.
    Additionally move "info BTF" to the correct place since commit
    8959e39272d6 ("kbuild: Parameterize kallsyms generation and correct
    reporting"), which added "info LD ..." to vmlinux_link calls.

    For a full debug info build with BTF, my link time goes from 1m06s to
    0m54s, saving about 12 seconds, or 18%.

    Signed-off-by: Kees Cook
    Signed-off-by: Daniel Borkmann
    Acked-by: Andrii Nakryiko
    Link: https://lore.kernel.org/bpf/202003031814.4AEA3351@keescook
    Signed-off-by: Sasha Levin

    Kees Cook
     
  • [ Upstream commit 50e36be1fb9572b2e4f2753340bdce3116bf2ce7 ]

    The current implementations of the rb_first() and rb_last() gdb
    functions have a variable that references itself in its instanciation,
    which causes the function to throw an error if a specific condition on
    the argument is met. The original author rather intended to reference
    the argument and made a typo. Referring the argument instead makes the
    function work as intended.

    Signed-off-by: Aymeric Agon-Rambosson
    Signed-off-by: Andrew Morton
    Reviewed-by: Stephen Boyd
    Cc: Jan Kiszka
    Cc: Kieran Bingham
    Cc: Douglas Anderson
    Cc: Nikolay Borisov
    Cc: Jackie Liu
    Cc: Jason Wessel
    Link: http://lkml.kernel.org/r/20200427051029.354840-1-aymeric.agon@yandex.com
    Signed-off-by: Linus Torvalds
    Signed-off-by: Sasha Levin

    Aymeric Agon-Rambosson
     
  • [ Upstream commit c7527373fe28f97d8a196ab562db5589be0d34b9 ]

    Remove "params.h" include, which has been dropped in GCC 10.

    Remove is_a_helper() macro, which is now defined in gimple.h, as seen
    when running './scripts/gcc-plugin.sh g++ g++ gcc':

    In file included from :1:
    ./gcc-plugins/gcc-common.h:852:13: error: redefinition of ‘static bool is_a_helper::test(U*) [with U = const gimple; T = const ggoto*]’
    852 | inline bool is_a_helper::test(const_gimple gs)
    | ^~~~~~~~~~~~~~~~~~~~~~~~~~
    In file included from ./gcc-plugins/gcc-common.h:125,
    from :1:
    /usr/lib/gcc/x86_64-redhat-linux/10/plugin/include/gimple.h:1037:1: note: ‘static bool is_a_helper::test(U*) [with U = const gimple; T = const ggoto*]’ previously declared here
    1037 | is_a_helper ::test (const gimple *gs)
    | ^~~~~~~~~~~~~~~~~~~~~~~~~~~

    Add -Wno-format-diag to scripts/gcc-plugins/Makefile to avoid
    meaningless warnings from error() formats used by plugins:

    scripts/gcc-plugins/structleak_plugin.c: In function ‘int plugin_init(plugin_name_args*, plugin_gcc_version*)’:
    scripts/gcc-plugins/structleak_plugin.c:253:12: warning: unquoted sequence of 2 consecutive punctuation characters ‘'-’ in format [-Wformat-diag]
    253 | error(G_("unknown option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
    | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Signed-off-by: Frédéric Pierret (fepitre)
    Link: https://lore.kernel.org/r/20200407113259.270172-1-frederic.pierret@qubes-os.org
    [kees: include -Wno-format-diag for plugin builds]
    Signed-off-by: Kees Cook
    Signed-off-by: Sasha Levin

    Frédéric Pierret (fepitre)
     

14 May, 2020

1 commit

  • commit e08df079b23e2e982df15aa340bfbaf50f297504 upstream.

    If the trapping instruction contains a ':', for a memory access through
    segment registers for example, the sed substitution will insert the '*'
    marker in the middle of the instruction instead of the line address:

    2b: 65 48 0f c7 0f cmpxchg16b %gs:*(%rdi)
    Signed-off-by: Andrew Morton
    Reviewed-by: Borislav Petkov
    Link: http://lkml.kernel.org/r/20200419223653.GA31248@visor
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Ivan Delalande
     

10 May, 2020

1 commit

  • [ Upstream commit e461bc9f9ab105637b86065d24b0b83f182d477c ]

    Sed broke on some strings as it used colon as a separator.
    I made it more robust by using \001, which is legit POSIX AFAIK.

    E.g. ./config --set-str CONFIG_USBNET_DEVADDR "de:ad:be:ef:00:01"
    failed with: sed: -e expression #1, char 55: unknown option to `s'

    Signed-off-by: Jeremie Francois (on alpha)
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Sasha Levin

    Jeremie Francois (on alpha)
     

02 May, 2020

1 commit

  • commit 3d4b2238684ac919394eba7fb51bb7eeeec6ab57 upstream.

    Since commit 7a0496056064 ("kbuild: fix DT binding schema rule to detect
    command line changes"), this rule is every time re-run even if you change
    nothing.

    cmd_dtc takes one additional parameter to pass to the -O option of dtc.

    We need to pass 'yaml' to if_changed_rule. Otherwise, cmd-check invoked
    from if_changed_rule is false positive.

    Fixes: 7a0496056064 ("kbuild: fix DT binding schema rule to detect command line changes")
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Greg Kroah-Hartman

    Masahiro Yamada
     

29 Apr, 2020

1 commit


08 Apr, 2020

1 commit

  • [ Upstream commit 8cc4fd73501d9f1370c3eebb70cfe8cc9e24062b ]

    When a compiler supports multiple architectures, some compiler features
    can be dependent on the target architecture.

    This is typical for Clang, which supports multiple LLVM backends.
    Even for GCC, we need to take care of biarch compiler cases.

    It is not a problem when we evaluate cc-option in Makefiles because
    cc-option is tested against the flag in question + $(KBUILD_CFLAGS).

    The cc-option in Kconfig, on the other hand, does not accumulate
    tested flags. Due to this simplification, it could potentially test
    cc-option against a different target.

    At first, Kconfig always evaluated cc-option against the host
    architecture.

    Since commit e8de12fb7cde ("kbuild: Check for unknown options with
    cc-option usage in Kconfig and clang"), in case of cross-compiling
    with Clang, the target triple is correctly passed to Kconfig.

    The case with biarch GCC (and native build with Clang) is still not
    handled properly. We need to pass some flags to specify the target
    machine bit.

    Due to the design, all the macros in Kconfig are expanded in the
    parse stage, where we do not know the target bit size yet.

    For example, arch/x86/Kconfig allows a user to toggle CONFIG_64BIT.
    If a compiler flag -foo depends on the machine bit, it must be tested
    twice, one with -m32 and the other with -m64.

    However, -m32/-m64 are not always recognized. So, this commits adds
    m64-flag and m32-flag macros. They expand to -m32, -m64, respectively
    if supported. Or, they expand to an empty string if unsupported.

    The typical usage is like this:

    config FOO
    bool
    default $(cc-option,$(m64-flag) -foo) if 64BIT
    default $(cc-option,$(m32-flag) -foo)

    This is clumsy, but there is no elegant way to handle this in the
    current static macro expansion.

    There was discussion for static functions vs dynamic functions.
    The consensus was to go as far as possible with the static functions.
    (https://lkml.org/lkml/2018/3/2/22)

    Signed-off-by: Masahiro Yamada
    Tested-by: George Spelvin
    Reviewed-by: Nathan Chancellor
    Signed-off-by: Sasha Levin

    Masahiro Yamada
     

01 Apr, 2020

1 commit

  • commit e33a814e772cdc36436c8c188d8c42d019fda639 upstream.

    gcc 10 will default to -fno-common, which causes this error at link
    time:

    (.text+0x0): multiple definition of `yylloc'; dtc-lexer.lex.o (symbol from plugin):(.text+0x0): first defined here

    This is because both dtc-lexer as well as dtc-parser define the same
    global symbol yyloc. Before with -fcommon those were merged into one
    defintion. The proper solution would be to to mark this as "extern",
    however that leads to:

    dtc-lexer.l:26:16: error: redundant redeclaration of 'yylloc' [-Werror=redundant-decls]
    26 | extern YYLTYPE yylloc;
    | ^~~~~~
    In file included from dtc-lexer.l:24:
    dtc-parser.tab.h:127:16: note: previous declaration of 'yylloc' was here
    127 | extern YYLTYPE yylloc;
    | ^~~~~~
    cc1: all warnings being treated as errors

    which means the declaration is completely redundant and can just be
    dropped.

    Signed-off-by: Dirk Mueller
    Signed-off-by: David Gibson
    [robh: cherry-pick from upstream]
    Cc: stable@vger.kernel.org
    Signed-off-by: Rob Herring
    Signed-off-by: Greg Kroah-Hartman

    Dirk Mueller
     

25 Mar, 2020

3 commits

  • commit 5190044c2965514a973184ca68ef5fad57a24670 upstream.

    In order to preserve backwards compatability with kmod tools, we have to
    move the namespace field in Module.symvers last, as the depmod -e -E
    option looks at the first three fields in Module.symvers to check symbol
    versions (and it's expected they stay in the original order of crc,
    symbol, module).

    In addition, update an ancient comment above read_dump() in modpost that
    suggested that the export type field in Module.symvers was optional. I
    suspect that there were historical reasons behind that comment that are
    no longer accurate. We have been unconditionally printing the export
    type since 2.6.18 (commit bd5cbcedf44), which is over a decade ago now.

    Fix up read_dump() to treat each field as non-optional. I suspect the
    original read_dump() code treated the export field as optional in order
    to support pre
    Reviewed-by: Matthias Maennich
    Reviewed-by: Lucas De Marchi
    Signed-off-by: Jessica Yu
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Greg Kroah-Hartman

    Jessica Yu
     
  • commit 82f2bc2fcc0160d6f82dd1ac64518ae0a4dd183f upstream.

    Clang's -Wpointer-to-int-cast deviates from GCC in that it warns when
    casting to enums. The kernel does this in certain places, such as device
    tree matches to set the version of the device being used, which allows
    the kernel to avoid using a gigantic union.

    https://elixir.bootlin.com/linux/v5.5.8/source/drivers/ata/ahci_brcm.c#L428
    https://elixir.bootlin.com/linux/v5.5.8/source/drivers/ata/ahci_brcm.c#L402
    https://elixir.bootlin.com/linux/v5.5.8/source/include/linux/mod_devicetable.h#L264

    To avoid a ton of false positive warnings, disable this particular part
    of the warning, which has been split off into a separate diagnostic so
    that the entire warning does not need to be turned off for clang. It
    will be visible under W=1 in case people want to go about fixing these
    easily and enabling the warning treewide.

    Cc: stable@vger.kernel.org
    Link: https://github.com/ClangBuiltLinux/linux/issues/887
    Link: https://github.com/llvm/llvm-project/commit/2a41b31fcdfcb67ab7038fc2ffb606fd50b83a84
    Signed-off-by: Nathan Chancellor
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Greg Kroah-Hartman

    Nathan Chancellor
     
  • [ Upstream commit 611d61f9ac99dc9e1494473fb90117a960a89dfa ]

    This makes the script more convenient to run.

    Signed-off-by: Jonathan Neuschäfer
    Signed-off-by: Linus Torvalds
    Signed-off-by: Sasha Levin

    Jonathan Neuschäfer
     

05 Mar, 2020

3 commits

  • commit 7ecaf069da52e472d393f03e79d721aabd724166 upstream.

    Currently, some sanity checks for uapi headers are done by
    scripts/headers_check.pl, which is wired up to the 'headers_check'
    target in the top Makefile.

    It is true compiling headers has better test coverage, but there
    are still several headers excluded from the compile test. I like
    to keep headers_check.pl for a while, but we can delete a lot of
    code by moving the build rule to usr/include/Makefile.

    Signed-off-by: Masahiro Yamada
    Signed-off-by: Greg Kroah-Hartman

    Masahiro Yamada
     
  • commit fcbb8461fd2376ba3782b5b8bd440c929b8e4980 upstream.

    There are both positive and negative options about this feature.
    At first, I thought it was a good idea, but actually Linus stated a
    negative opinion (https://lkml.org/lkml/2019/9/29/227). I admit it
    is ugly and annoying.

    The baseline I'd like to keep is the compile-test of uapi headers.
    (Otherwise, kernel developers have no way to ensure the correctness
    of the exported headers.)

    I will maintain a small build rule in usr/include/Makefile.
    Remove the other header test functionality.

    Signed-off-by: Masahiro Yamada
    [ added to 5.4.y due to start of build warnings from backported patches
    because of this feature - gregkh]
    Signed-off-by: Greg Kroah-Hartman

    Masahiro Yamada
     
  • commit 7a04960560640ac5b0b89461f7757322b57d0c7a upstream.

    This if_change_rule is not working properly; it cannot detect any
    command line change.

    The reason is because cmd-check in scripts/Kbuild.include compares
    $(cmd_$@) and $(cmd_$1), but cmd_dtc_dt_yaml does not exist here.

    For if_change_rule to work properly, the stem part of cmd_* and rule_*
    must match. Because this cmd_and_fixdep invokes cmd_dtc, this rule must
    be named rule_dtc.

    Fixes: 4f0e3a57d6eb ("kbuild: Add support for DT binding schema checks")
    Signed-off-by: Masahiro Yamada
    Acked-by: Rob Herring
    Signed-off-by: Greg Kroah-Hartman

    Masahiro Yamada
     

24 Feb, 2020

4 commits

  • [ Upstream commit 2a67a6ccb01f21b854715d86ff6432a18b97adb3 ]

    When trying to compile with CONFIG_DEBUG_INFO_BTF enabled, I got this
    error:

    % make -s
    Failed to generate BTF for vmlinux
    Try to disable CONFIG_DEBUG_INFO_BTF
    make[3]: *** [vmlinux] Error 1

    Compiling again without -s shows the true error (that pahole is
    missing), but since this is fatal, we should show the error
    unconditionally on stderr as well, not silence it using the `info`
    function. With this patch:

    % make -s
    BTF: .tmp_vmlinux.btf: pahole (pahole) is not available
    Failed to generate BTF for vmlinux
    Try to disable CONFIG_DEBUG_INFO_BTF
    make[3]: *** [vmlinux] Error 1

    Signed-off-by: Chris Down
    Signed-off-by: Daniel Borkmann
    Acked-by: Andrii Nakryiko
    Link: https://lore.kernel.org/bpf/20200122000110.GA310073@chrisdown.name
    Signed-off-by: Sasha Levin

    Chris Down
     
  • [ Upstream commit 3bed1b7b9d79ca40e41e3af130931a3225e951a3 ]

    Currently, -E (stop after the preprocessing stage) is used to check
    whether the given compiler flag is supported.

    While it is faster than -S (or -c), it can be false-positive. You need
    to run the compilation proper to check the flag more precisely.

    For example, -E and -S disagree about the support of
    "--param asan-instrument-allocas=1".

    $ gcc -Werror --param asan-instrument-allocas=1 -E -x c /dev/null -o /dev/null
    $ echo $?
    0

    $ gcc -Werror --param asan-instrument-allocas=1 -S -x c /dev/null -o /dev/null
    cc1: error: invalid --param name ‘asan-instrument-allocas’; did you mean ‘asan-instrument-writes’?
    $ echo $?
    1

    Signed-off-by: Masahiro Yamada
    Signed-off-by: Sasha Levin

    Masahiro Yamada
     
  • [ Upstream commit 88fe89a47153facd8cb2d06d5c8727f7224c43c2 ]

    Bartosz Golaszewski reports that when "make {menu,n,g,x}config" fails
    due to missing packages, a temporary file is left over, which is not
    ignored by git.

    For example, if GTK+ is not installed:

    $ make gconfig
    *
    * Unable to find the GTK+ installation. Please make sure that
    * the GTK+ 2.0 development package is correctly installed.
    * You need gtk+-2.0 gmodule-2.0 libglade-2.0
    *
    scripts/kconfig/Makefile:208: recipe for target 'scripts/kconfig/gconf-cfg' failed
    make[1]: *** [scripts/kconfig/gconf-cfg] Error 1
    Makefile:567: recipe for target 'gconfig' failed
    make: *** [gconfig] Error 2
    $ git status
    HEAD detached at v5.4
    Untracked files:
    (use "git add ..." to include in what will be committed)

    scripts/kconfig/gconf-cfg.tmp

    nothing added to commit but untracked files present (use "git add" to track)

    This is because the check scripts are run with filechk, which misses
    to clean up the temporary file on failure.

    When the line

    { $(filechk_$(1)); } > $@.tmp;

    ... fails, it exits immediately due to the 'set -e'. Use trap to make
    sure to delete the temporary file on exit.

    For extra safety, I replaced $@.tmp with $(dot-target).tmp to make it
    a hidden file.

    Reported-by: Bartosz Golaszewski
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Sasha Levin

    Masahiro Yamada
     
  • [ Upstream commit c8fb7d7e48d11520ad24808cfce7afb7b9c9f798 ]

    Running randconfig on arm64 using KCONFIG_SEED=0x40C5E904 (e.g. on v5.5)
    produces the .config with CONFIG_EFI=y and CONFIG_CPU_BIG_ENDIAN=y,
    which does not meet the !CONFIG_CPU_BIG_ENDIAN dependency.

    This is because the user choice for CONFIG_CPU_LITTLE_ENDIAN vs
    CONFIG_CPU_BIG_ENDIAN is set by randomize_choice_values() after the
    value of CONFIG_EFI is calculated.

    When this happens, the has_changed flag should be set.

    Currently, it takes the result from the last iteration. It should
    accumulate all the results of the loop.

    Fixes: 3b9a19e08960 ("kconfig: loop as long as we changed some symbols in randconfig")
    Reported-by: Vincenzo Frascino
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Sasha Levin

    Masahiro Yamada
     

11 Feb, 2020

1 commit

  • commit 1630146db2111412e7524d05d812ff8f2c75977e upstream.

    scripts/find-unused-docs.sh invokes scripts/kernel-doc to find out if a
    source file contains kerneldoc or not.

    However, as it passes the no longer supported "-text" option to
    scripts/kernel-doc, the latter prints out its help text, causing all
    files to be considered containing kerneldoc.

    Get rid of these false positives by removing the no longer supported
    "-text" option from the scripts/kernel-doc invocation.

    Cc: stable@vger.kernel.org # 4.16+
    Fixes: b05142675310d2ac ("scripts: kernel-doc: get rid of unused output formats")
    Signed-off-by: Geert Uytterhoeven
    Link: https://lore.kernel.org/r/20200127093107.26401-1-geert+renesas@glider.be
    Signed-off-by: Jonathan Corbet
    Signed-off-by: Greg Kroah-Hartman

    Geert Uytterhoeven