17 Aug, 2020

1 commit


13 Aug, 2020

1 commit

  • Recently 0day reported many strange performance changes (regression or
    improvement), in which there was no obvious relation between the culprit
    commit and the benchmark at the first look, and it causes people to doubt
    the test itself is wrong.

    Upon further check, many of these cases are caused by the change to the
    alignment of kernel text or data, as whole text/data of kernel are linked
    together, change in one domain may affect alignments of other domains.

    gcc has an option '-falign-functions=n' to force text aligned, and with
    that option enabled, some of those performance changes will be gone, like
    [1][2][3].

    Add this option so that developers and 0day can easily find performance
    bump caused by text alignment change, as tracking these strange bump is
    quite time consuming. Though it can't help in other cases like data
    alignment changes like [4].

    Following is some size data for v5.7 kernel built with a RHEL config used
    in 0day:

    text data bss dec filename
    19738771 13292906 5554236 38585913 vmlinux.noalign
    19758591 13297002 5529660 38585253 vmlinux.align32

    Raw vmlinux size in bytes:

    v5.7 v5.7+align32
    253950832 254018000 +0.02%

    Some benchmark data, most of them have no big change:

    * hackbench: [ -1.8%, +0.5%]

    * fsmark: [ -3.2%, +3.4%] # ext4/xfs/btrfs

    * kbuild: [ -2.0%, +0.9%]

    * will-it-scale: [ -0.5%, +1.8%] # mmap1/pagefault3

    * netperf:
    - TCP_CRR [+16.6%, +97.4%]
    - TCP_RR [-18.5%, -1.8%]
    - TCP_STREAM [ -1.1%, +1.9%]

    [1] https://lore.kernel.org/lkml/20200114085637.GA29297@shao2-debian/
    [2] https://lore.kernel.org/lkml/20200330011254.GA14393@feng-iot/
    [3] https://lore.kernel.org/lkml/1d98d1f0-fe84-6df7-f5bd-f4cb2cdb7f45@intel.com/
    [4] https://lore.kernel.org/lkml/20200205123216.GO12867@shao2-debian/

    Signed-off-by: Feng Tang
    Signed-off-by: Andrew Morton
    Cc: Masahiro Yamada
    Cc: Michal Marek
    Cc: Andi Kleen
    Cc: Huang Ying
    Cc: Andy Shevchenko
    Link: http://lkml.kernel.org/r/1595475001-90945-1-git-send-email-feng.tang@intel.com
    Signed-off-by: Linus Torvalds

    Feng Tang
     

10 Aug, 2020

4 commits

  • Pull Kbuild updates from Masahiro Yamada:

    - run the checker (e.g. sparse) after the compiler

    - remove unneeded cc-option tests for old compiler flags

    - fix tar-pkg to install dtbs

    - introduce ccflags-remove-y and asflags-remove-y syntax

    - allow to trace functions in sub-directories of lib/

    - introduce hostprogs-always-y and userprogs-always-y syntax

    - various Makefile cleanups

    * tag 'kbuild-v5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
    kbuild: stop filtering out $(GCC_PLUGINS_CFLAGS) from cc-option base
    kbuild: include scripts/Makefile.* only when relevant CONFIG is enabled
    kbuild: introduce hostprogs-always-y and userprogs-always-y
    kbuild: sort hostprogs before passing it to ifneq
    kbuild: move host .so build rules to scripts/gcc-plugins/Makefile
    kbuild: Replace HTTP links with HTTPS ones
    kbuild: trace functions in subdirectories of lib/
    kbuild: introduce ccflags-remove-y and asflags-remove-y
    kbuild: do not export LDFLAGS_vmlinux
    kbuild: always create directories of targets
    powerpc/boot: add DTB to 'targets'
    kbuild: buildtar: add dtbs support
    kbuild: remove cc-option test of -ffreestanding
    kbuild: remove cc-option test of -fno-stack-protector
    Revert "kbuild: Create directory for target DTB"
    kbuild: run the checker after the compiler

    Linus Torvalds
     
  • Commit d26e94149276 ("kbuild: no gcc-plugins during cc-option tests")
    was neeeded because scripts/Makefile.gcc-plugins was too early.

    This is unneeded by including scripts/Makefile.gcc-plugins last,
    and being careful to not add cc-option tests after it.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • Currently, the top Makefile includes all of scripts/Makefile.
    even if the associated CONFIG option is disabled.

    Do not include unneeded Makefiles in order to slightly optimize the
    parse stage.

    Include $(include-y), and ignore $(include-).

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • When you clean the build tree for ARCH=arm, you may see the following
    error message from 'nm' command:

    $ make -j24 ARCH=arm clean
    CLEAN arch/arm/crypto
    CLEAN arch/arm/kernel
    CLEAN arch/arm/mach-at91
    CLEAN arch/arm/mach-omap2
    CLEAN arch/arm/vdso
    CLEAN certs
    CLEAN lib
    CLEAN usr
    CLEAN net/wireless
    CLEAN drivers/firmware/efi/libstub
    nm: 'arch/arm/boot/compressed/../../../../vmlinux': No such file
    /bin/sh: 1: arithmetic expression: expecting primary: " "
    CLEAN arch/arm/boot/compressed
    CLEAN drivers/scsi
    CLEAN drivers/tty/vt
    CLEAN arch/arm/boot
    CLEAN vmlinux.symvers modules.builtin modules.builtin.modinfo

    Even if you rerun the same command, the error message will not be
    shown despite vmlinux is already gone.

    To reproduce it, the parallel option -j is needed. Single thread
    cleaning always executes 'archclean', 'vmlinuxclean' in this order,
    so vmlinux still exists when arch/arm/boot/compressed/ is cleaned.

    Looking at arch/arm/boot/compressed/Makefile does not help understand
    the reason of the error message. Both KBSS_SZ and LDFLAGS_vmlinux are
    assigned with '=' operator, hence, they are not expanded unless used.
    Obviously, 'make clean' does not use them.

    In fact, the root cause exists in the top Makefile:

    export LDFLAGS_vmlinux

    Since LDFLAGS_vmlinux is an exported variable, LDFLAGS_vmlinux in
    arch/arm/boot/compressed/Makefile is expanded when scripts/Makefile.clean
    has a command to execute. This is why the error message shows up only
    when there exist build artifacts in arch/arm/boot/compressed/.

    Adding 'unexport LDFLAGS_vmlinux' to arch/arm/boot/compressed/Makefile
    will fix it as far as ARCH=arm is concerned, but I think the proper fix
    is to get rid of 'export LDFLAGS_vmlinux' from the top Makefile.

    LDFLAGS_vmlinux in the top Makefile contains linker flags for the top
    vmlinux. LDFLAGS_vmlinux in arch/arm/boot/compressed/Makefile is for
    arch/arm/boot/compressed/vmlinux. They just happen to have the same
    variable name, but are used for different purposes. Stop shadowing
    LDFLAGS_vmlinux.

    This commit passes LDFLAGS_vmlinux to scripts/link-vmlinux.sh via a
    command line parameter instead of via an environment variable. LD and
    KBUILD_LDFLAGS are exported, but I did the same for consistency. Anyway,
    they must be included in cmd_link-vmlinux to allow if_changed to detect
    the changes in LD or KBUILD_LDFLAGS.

    The following Makefiles are not affected:

    arch/arm/boot/compressed/Makefile
    arch/h8300/boot/compressed/Makefile
    arch/nios2/boot/compressed/Makefile
    arch/parisc/boot/compressed/Makefile
    arch/s390/boot/compressed/Makefile
    arch/sh/boot/compressed/Makefile
    arch/sh/boot/romimage/Makefile
    arch/x86/boot/compressed/Makefile

    They use ':=' or '=' to clear the LDFLAGS_vmlinux inherited from the
    top Makefile.

    We need to take a closer look at the impact to unicore32 and xtensa.

    arch/unicore32/boot/compressed/Makefile only uses '+=' operator for
    LDFLAGS_vmlinux. So, the decompressor previously inherited the linker
    flags from the top Makefile.

    However, commit 70fac51feaf2 ("unicore32 additional architecture files:
    boot process") was merged before commit 1f2bfbd00e46 ("kbuild: link of
    vmlinux moved to a script"). So, I rather consider this is a bug fix of
    1f2bfbd00e46.

    arch/xtensa/boot/boot-elf/Makefile is also affected, but this is also
    considered a fix for the same reason. It did not inherit LDFLAGS_vmlinux
    when commit 4bedea945451 ("[PATCH] xtensa: Architecture support for
    Tensilica Xtensa Part 2") was merged. I deleted $(LDFLAGS_vmlinux),
    which is now empty.

    Signed-off-by: Masahiro Yamada
    Reviewed-by: Nick Desaulniers
    Tested-by: Nick Desaulniers

    Masahiro Yamada
     

06 Aug, 2020

1 commit

  • Pull networking updates from David Miller:

    1) Support 6Ghz band in ath11k driver, from Rajkumar Manoharan.

    2) Support UDP segmentation in code TSO code, from Eric Dumazet.

    3) Allow flashing different flash images in cxgb4 driver, from Vishal
    Kulkarni.

    4) Add drop frames counter and flow status to tc flower offloading,
    from Po Liu.

    5) Support n-tuple filters in cxgb4, from Vishal Kulkarni.

    6) Various new indirect call avoidance, from Eric Dumazet and Brian
    Vazquez.

    7) Fix BPF verifier failures on 32-bit pointer arithmetic, from
    Yonghong Song.

    8) Support querying and setting hardware address of a port function via
    devlink, use this in mlx5, from Parav Pandit.

    9) Support hw ipsec offload on bonding slaves, from Jarod Wilson.

    10) Switch qca8k driver over to phylink, from Jonathan McDowell.

    11) In bpftool, show list of processes holding BPF FD references to
    maps, programs, links, and btf objects. From Andrii Nakryiko.

    12) Several conversions over to generic power management, from Vaibhav
    Gupta.

    13) Add support for SO_KEEPALIVE et al. to bpf_setsockopt(), from Dmitry
    Yakunin.

    14) Various https url conversions, from Alexander A. Klimov.

    15) Timestamping and PHC support for mscc PHY driver, from Antoine
    Tenart.

    16) Support bpf iterating over tcp and udp sockets, from Yonghong Song.

    17) Support 5GBASE-T i40e NICs, from Aleksandr Loktionov.

    18) Add kTLS RX HW offload support to mlx5e, from Tariq Toukan.

    19) Fix the ->ndo_start_xmit() return type to be netdev_tx_t in several
    drivers. From Luc Van Oostenryck.

    20) XDP support for xen-netfront, from Denis Kirjanov.

    21) Support receive buffer autotuning in MPTCP, from Florian Westphal.

    22) Support EF100 chip in sfc driver, from Edward Cree.

    23) Add XDP support to mvpp2 driver, from Matteo Croce.

    24) Support MPTCP in sock_diag, from Paolo Abeni.

    25) Commonize UDP tunnel offloading code by creating udp_tunnel_nic
    infrastructure, from Jakub Kicinski.

    26) Several pci_ --> dma_ API conversions, from Christophe JAILLET.

    27) Add FLOW_ACTION_POLICE support to mlxsw, from Ido Schimmel.

    28) Add SK_LOOKUP bpf program type, from Jakub Sitnicki.

    29) Refactor a lot of networking socket option handling code in order to
    avoid set_fs() calls, from Christoph Hellwig.

    30) Add rfc4884 support to icmp code, from Willem de Bruijn.

    31) Support TBF offload in dpaa2-eth driver, from Ioana Ciornei.

    32) Support XDP_REDIRECT in qede driver, from Alexander Lobakin.

    33) Support PCI relaxed ordering in mlx5 driver, from Aya Levin.

    34) Support TCP syncookies in MPTCP, from Flowian Westphal.

    35) Fix several tricky cases of PMTU handling wrt. briding, from Stefano
    Brivio.

    * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next: (2056 commits)
    net: thunderx: initialize VF's mailbox mutex before first usage
    usb: hso: remove bogus check for EINPROGRESS
    usb: hso: no complaint about kmalloc failure
    hso: fix bailout in error case of probe
    ip_tunnel_core: Fix build for archs without _HAVE_ARCH_IPV6_CSUM
    selftests/net: relax cpu affinity requirement in msg_zerocopy test
    mptcp: be careful on subflow creation
    selftests: rtnetlink: make kci_test_encap() return sub-test result
    selftests: rtnetlink: correct the final return value for the test
    net: dsa: sja1105: use detected device id instead of DT one on mismatch
    tipc: set ub->ifindex for local ipv6 address
    ipv6: add ipv6_dev_find()
    net: openvswitch: silence suspicious RCU usage warning
    Revert "vxlan: fix tos value before xmit"
    ptp: only allow phase values lower than 1 period
    farsync: switch from 'pci_' to 'dma_' API
    wan: wanxl: switch from 'pci_' to 'dma_' API
    hv_netvsc: do not use VF device if link is down
    dpaa2-eth: Fix passing zero to 'PTR_ERR' warning
    net: macb: Properly handle phylink on at91sam9x
    ...

    Linus Torvalds
     

05 Aug, 2020

1 commit

  • Pull automatic variable initialization updates from Kees Cook:
    "This adds the "zero" init option from Clang, which is being used
    widely in production builds of Android and Chrome OS (though it also
    keeps the "pattern" init, which is better for debug builds).

    - Introduce CONFIG_INIT_STACK_ALL_ZERO (Alexander Potapenko)"

    * tag 'var-init-v5.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
    security: allow using Clang's zero initialization for stack variables

    Linus Torvalds
     

04 Aug, 2020

1 commit

  • Pull x86 boot updates from Ingo Molnar:
    "The main change in this cycle was to add support for ZSTD-compressed
    kernel and initrd images.

    ZSTD has a very fast decompressor, yet it compresses better than gzip"

    * tag 'x86-boot-2020-08-03' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    Documentation: dontdiff: Add zstd compressed files
    .gitignore: Add ZSTD-compressed files
    x86: Add support for ZSTD compressed kernel
    x86: Bump ZO_z_extra_bytes margin for zstd
    usr: Add support for zstd compressed initramfs
    init: Add support for zstd compressed kernel
    lib: Add zstd support to decompress
    lib: Prepare zstd for preboot environment, improve performance

    Linus Torvalds
     

03 Aug, 2020

1 commit


02 Aug, 2020

1 commit


31 Jul, 2020

1 commit

  • - Add the zstd and zstd22 cmds to scripts/Makefile.lib

    - Add the HAVE_KERNEL_ZSTD and KERNEL_ZSTD options

    Architecture specific support is still needed for decompression.

    Signed-off-by: Nick Terrell
    Signed-off-by: Ingo Molnar
    Tested-by: Sedat Dilek
    Reviewed-by: Kees Cook
    Link: https://lore.kernel.org/r/20200730190841.2071656-4-nickrterrell@gmail.com

    Nick Terrell
     

27 Jul, 2020

2 commits


26 Jul, 2020

1 commit

  • The UDP reuseport conflict was a little bit tricky.

    The net-next code, via bpf-next, extracted the reuseport handling
    into a helper so that the BPF sk lookup code could invoke it.

    At the same time, the logic for reuseport handling of unconnected
    sockets changed via commit efc6b6f6c3113e8b203b9debfb72d81e0f3dcace
    which changed the logic to carry on the reuseport result into the
    rest of the lookup loop if we do not return immediately.

    This requires moving the reuseport_has_conns() logic into the callers.

    While we are here, get rid of inline directives as they do not belong
    in foo.c files.

    The other changes were cases of more straightforward overlapping
    modifications.

    Signed-off-by: David S. Miller

    David S. Miller
     

23 Jul, 2020

1 commit

  • When CROSS_COMPILE is set (e.g. aarch64-linux-gnu-), if
    $(CROSS_COMPILE)elfedit is found at /usr/bin/aarch64-linux-gnu-elfedit,
    GCC_TOOLCHAIN_DIR will be set to /usr/bin/. --prefix= will be set to
    /usr/bin/ and Clang as of 11 will search for both
    $(prefix)aarch64-linux-gnu-$needle and $(prefix)$needle.

    GCC searchs for $(prefix)aarch64-linux-gnu/$version/$needle,
    $(prefix)aarch64-linux-gnu/$needle and $(prefix)$needle. In practice,
    $(prefix)aarch64-linux-gnu/$needle rarely contains executables.

    To better model how GCC's -B/--prefix takes in effect in practice, newer
    Clang (since
    https://github.com/llvm/llvm-project/commit/3452a0d8c17f7166f479706b293caf6ac76ffd90)
    only searches for $(prefix)$needle. Currently it will find /usr/bin/as
    instead of /usr/bin/aarch64-linux-gnu-as.

    Set --prefix= to $(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
    (/usr/bin/aarch64-linux-gnu-) so that newer Clang can find the
    appropriate cross compiling GNU as (when -no-integrated-as is in
    effect).

    Cc: stable@vger.kernel.org
    Reported-by: Nathan Chancellor
    Signed-off-by: Fangrui Song
    Reviewed-by: Nathan Chancellor
    Tested-by: Nathan Chancellor
    Tested-by: Nick Desaulniers
    Link: https://github.com/ClangBuiltLinux/linux/issues/1099
    Reviewed-by: Nick Desaulniers
    Signed-off-by: Masahiro Yamada

    Fangrui Song
     

20 Jul, 2020

1 commit


14 Jul, 2020

3 commits

  • Alexei Starovoitov says:

    ====================
    pull-request: bpf-next 2020-07-13

    The following pull-request contains BPF updates for your *net-next* tree.

    We've added 36 non-merge commits during the last 7 day(s) which contain
    a total of 62 files changed, 2242 insertions(+), 468 deletions(-).

    The main changes are:

    1) Avoid trace_printk warning banner by switching bpf_trace_printk to use
    its own tracing event, from Alan.

    2) Better libbpf support on older kernels, from Andrii.

    3) Additional AF_XDP stats, from Ciara.

    4) build time resolution of BTF IDs, from Jiri.

    5) BPF_CGROUP_INET_SOCK_RELEASE hook, from Stanislav.
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     
  • Using BTF_ID_LIST macro to define lists for several helpers
    using BTF arguments.

    And running resolve_btfids on vmlinux elf object during linking,
    so the .BTF_ids section gets the IDs resolved.

    Signed-off-by: Jiri Olsa
    Signed-off-by: Alexei Starovoitov
    Tested-by: Andrii Nakryiko
    Acked-by: Andrii Nakryiko
    Link: https://lore.kernel.org/bpf/20200711215329.41165-5-jolsa@kernel.org

    Jiri Olsa
     
  • The resolve_btfids tool will be used during the vmlinux linking,
    so it's necessary it's ready for it.

    Signed-off-by: Jiri Olsa
    Signed-off-by: Alexei Starovoitov
    Tested-by: Andrii Nakryiko
    Acked-by: Andrii Nakryiko
    Link: https://lore.kernel.org/bpf/20200711215329.41165-3-jolsa@kernel.org

    Jiri Olsa
     

13 Jul, 2020

1 commit


11 Jul, 2020

1 commit


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
     

06 Jul, 2020

2 commits

  • Linus Torvalds
     
  • …/masahiroy/linux-kbuild

    Pull Kbuild fixes frin Masahiro Yamada:

    - fix various bugs in xconfig

    - fix some issues in cross-compilation using Clang

    - fix documentation

    * tag 'kbuild-fixes-v5.8-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
    .gitignore: Do not track `defconfig` from `make savedefconfig`
    kbuild: make Clang build userprogs for target architecture
    kbuild: fix CONFIG_CC_CAN_LINK(_STATIC) for cross-compilation with Clang
    kconfig: qconf: parse newer types at debug info
    kconfig: qconf: navigate menus on hyperlinks
    kconfig: qconf: don't show goback button on splitMode
    kconfig: qconf: simplify the goBack() logic
    kconfig: qconf: re-implement setSelected()
    kconfig: qconf: make debug links work again
    kconfig: qconf: make search fully work again on split mode
    kconfig: qconf: cleanup includes
    docs: kbuild: fix ReST formatting
    gcc-plugins: fix gcc-plugins directory path in documentation

    Linus Torvalds
     

01 Jul, 2020

1 commit

  • Programs added 'userprogs' should be compiled for the target
    architecture i.e. the same architecture as the kernel.

    GCC does this correctly since the target architecture is implied
    by the toolchain prefix.

    Clang builds userspace programs always for the host architecture
    because the target triple is currently missing.

    Fix this.

    Fixes: 7f3a59db274c ("kbuild: add infrastructure to build userspace programs")
    Signed-off-by: Masahiro Yamada
    Reviewed-by: Nick Desaulniers
    Reviewed-by: Nathan Chancellor

    Masahiro Yamada
     

29 Jun, 2020

1 commit


22 Jun, 2020

1 commit


21 Jun, 2020

1 commit

  • This reverts commit e0b250b57dcf403529081e5898a9de717f96b76b,
    which broke build systems that need to install files to a certain
    path, but do not set INSTALL_MOD_PATH when invoking 'make install'.

    $ make INSTALL_PATH=/tmp/destdir install
    mkdir: cannot create directory ‘/lib/modules/5.8.0-rc1+/’: Permission denied
    Makefile:1342: recipe for target '_builtin_inst_' failed
    make: *** [_builtin_inst_] Error 1

    While modules.builtin is useful also for CONFIG_MODULES=n, this change
    in the behavior is quite unexpected. Maybe "make modules_install"
    can install modules.builtin irrespective of CONFIG_MODULES as Jonas
    originally suggested.

    Anyway, that commit should be reverted ASAP.

    Reported-by: Douglas Anderson
    Reported-by: Guenter Roeck
    Cc: Jonas Karlman
    Signed-off-by: Masahiro Yamada
    Reviewed-by: Guenter Roeck
    Tested-by: Guenter Roeck

    Masahiro Yamada
     

16 Jun, 2020

1 commit

  • In addition to -ftrivial-auto-var-init=pattern (used by
    CONFIG_INIT_STACK_ALL now) Clang also supports zero initialization for
    locals enabled by -ftrivial-auto-var-init=zero. The future of this flag
    is still being debated (see https://bugs.llvm.org/show_bug.cgi?id=45497).
    Right now it is guarded by another flag,
    -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang,
    which means it may not be supported by future Clang releases. Another
    possible resolution is that -ftrivial-auto-var-init=zero will persist
    (as certain users have already started depending on it), but the name
    of the guard flag will change.

    In the meantime, zero initialization has proven itself as a good
    production mitigation measure against uninitialized locals. Unlike pattern
    initialization, which has a higher chance of triggering existing bugs,
    zero initialization provides safe defaults for strings, pointers, indexes,
    and sizes. On the other hand, pattern initialization remains safer for
    return values. Chrome OS and Android are moving to using zero
    initialization for production builds.

    Performance-wise, the difference between pattern and zero initialization
    is usually negligible, although the generated code for zero
    initialization is more compact.

    This patch renames CONFIG_INIT_STACK_ALL to CONFIG_INIT_STACK_ALL_PATTERN
    and introduces another config option, CONFIG_INIT_STACK_ALL_ZERO, that
    enables zero initialization for locals if the corresponding flags are
    supported by Clang.

    Cc: Kees Cook
    Cc: Nick Desaulniers
    Cc: Greg Kroah-Hartman
    Signed-off-by: Alexander Potapenko
    Link: https://lore.kernel.org/r/20200616083435.223038-1-glider@google.com
    Reviewed-by: Maciej Żenczykowski
    Signed-off-by: Kees Cook

    glider@google.com
     

15 Jun, 2020

2 commits

  • Commit
    10e68b02c861 ("Makefile: support compressed debug info")
    added support for compressed debug sections.

    Support is detected by checking
    - does the compiler support -gz=zlib
    - does the assembler support --compressed-debug-sections=zlib
    - does the linker support --compressed-debug-sections=zlib

    However, the gcc driver's support for this option is somewhat
    convoluted. The driver's builtin specs are set based on the version of
    binutils that it was configured with. It reports an error if the
    configure-time linker/assembler (i.e., not necessarily the actual
    assembler that will be run) do not support the option, but only if the
    assembler (or linker) is actually invoked when -gz=zlib is passed.

    The cc-option check in scripts/Kconfig.include does not invoke the
    assembler, so the gcc driver reports success even if it does not support
    the option being passed to the assembler.

    Because the as-option check passes the option directly to the assembler
    via -Wa,--compressed-debug-sections=zlib, the gcc driver does not see
    this option and will never report an error.

    Combined with an installed version of binutils that is more recent than
    the one the compiler was built with, it is possible for all three tests
    to succeed, yet an actual compilation with -gz=zlib to fail.

    Moreover, it is unnecessary to explicitly pass
    --compressed-debug-sections=zlib to the assembler via -Wa, since the
    driver will do that automatically when it supports -gz=zlib.

    Convert the as-option to just -gz=zlib, simplifying it as well as
    performing a better test of the gcc driver's capabilities.

    Reported-by: kernel test robot
    Signed-off-by: Arvind Sankar
    Reviewed-by: Nick Desaulniers
    Signed-off-by: Masahiro Yamada

    Arvind Sankar
     
  • Linus Torvalds
     

14 Jun, 2020

1 commit


12 Jun, 2020

1 commit

  • Merge the state of the locking kcsan branch before the read/write_once()
    and the atomics modifications got merged.

    Squash the fallout of the rebase on top of the read/write once and atomic
    fallback work into the merge. The history of the original branch is
    preserved in tag locking-kcsan-2020-06-02.

    Signed-off-by: Thomas Gleixner

    Thomas Gleixner
     

11 Jun, 2020

1 commit

  • 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

    Denis Efremov
     

07 Jun, 2020

1 commit

  • Pull Kbuild updates from Masahiro Yamada:

    - fix warnings in 'make clean' for ARCH=um, hexagon, h8300, unicore32

    - ensure to rebuild all objects when the compiler is upgraded

    - exclude system headers from dependency tracking and fixdep processing

    - fix potential bit-size mismatch between the kernel and BPF user-mode
    helper

    - add the new syntax 'userprogs' to build user-space programs for the
    target architecture (the same arch as the kernel)

    - compile user-space sample code under samples/ for the target arch
    instead of the host arch

    - make headers_install fail if a CONFIG option is leaked to user-space

    - sanitize the output format of scripts/checkstack.pl

    - handle ARM 'push' instruction in scripts/checkstack.pl

    - error out before modpost if a module name conflict is found

    - error out when multiple directories are passed to M= because this
    feature is broken for a long time

    - add CONFIG_DEBUG_INFO_COMPRESSED to support compressed debug info

    - a lot of cleanups of modpost

    - dump vmlinux symbols out into vmlinux.symvers, and reuse it in the
    second pass of modpost

    - do not run the second pass of modpost if nothing in modules is
    updated

    - install modules.builtin(.modinfo) by 'make install' as well as by
    'make modules_install' because it is useful even when
    CONFIG_MODULES=n

    - add new command line variables, GZIP, BZIP2, LZOP, LZMA, LZ4, and XZ
    to allow users to use alternatives such as pigz, pbzip2, etc.

    * tag 'kbuild-v5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (96 commits)
    kbuild: add variables for compression tools
    Makefile: install modules.builtin even if CONFIG_MODULES=n
    mksysmap: Fix the mismatch of '.L' symbols in System.map
    kbuild: doc: rename LDFLAGS to KBUILD_LDFLAGS
    modpost: change elf_info->size to size_t
    modpost: remove is_vmlinux() helper
    modpost: strip .o from modname before calling new_module()
    modpost: set have_vmlinux in new_module()
    modpost: remove mod->skip struct member
    modpost: add mod->is_vmlinux struct member
    modpost: remove is_vmlinux() call in check_for_{gpl_usage,unused}()
    modpost: remove mod->is_dot_o struct member
    modpost: move -d option in scripts/Makefile.modpost
    modpost: remove -s option
    modpost: remove get_next_text() and make {grab,release_}file static
    modpost: use read_text_file() and get_line() for reading text files
    modpost: avoid false-positive file open error
    modpost: fix potential mmap'ed file overrun in get_src_version()
    modpost: add read_text_file() and get_line() helpers
    modpost: do not call get_modinfo() for vmlinux(.o)
    ...

    Linus Torvalds
     

06 Jun, 2020

4 commits

  • 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

    Denis Efremov
     
  • Many applications check for available kernel features via:

    - /proc/modules (loaded modules, present if CONFIG_MODULES=y)
    - $(MODLIB)/modules.builtin (builtin modules)

    They fail to detect features if the kernel was built with CONFIG_MODULES=n
    and modules.builtin isn't installed.

    Therefore, add the target "_builtin_inst_" and make "install" and
    "modules_install" depend on it.

    Tests results:

    - make install: kernel image is copied as before, modules.builtin copied
    - make modules_install: (CONFIG_MODULES=n) nothing is copied, exit 1

    Signed-off-by: Jonas Zeiger
    Signed-off-by: Masahiro Yamada

    Jonas Zeiger
     
  • If modpost fails to load a symbol dump file, it cannot check unresolved
    symbols, hence module dependency will not be added. Nor CRCs can be added.

    Currently, external module builds check only $(objtree)/Module.symvers,
    but it should check files specified by KBUILD_EXTRA_SYMBOLS as well.

    Move the warning message from the top Makefile to scripts/Makefile.modpost
    and print the warning if any dump file is missing.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • The full build runs modpost twice, first for vmlinux.o and second for
    modules.

    The first pass dumps all the vmlinux symbols into Module.symvers, but
    the second pass parses vmlinux again instead of reusing the dump file,
    presumably because it needs to avoid accumulating stale symbols.

    Loading symbol info from a dump file is faster than parsing an ELF object.
    Besides, modpost deals with various issues to parse vmlinux in the second
    pass.

    A solution is to make the first pass dumps symbols into a separate file,
    vmlinux.symvers. The second pass reads it, and parses module .o files.
    The merged symbol information is dumped into Module.symvers in the same
    way as before.

    This makes further modpost cleanups possible.

    Also, it fixes the problem of 'make vmlinux', which previously overwrote
    Module.symvers, throwing away module symbols.

    I slightly touched scripts/link-vmlinux.sh so that vmlinux is re-linked
    when you cross this commit. Otherwise, vmlinux.symvers would not be
    generated.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada