30 Jun, 2022

1 commit

  • This is the 5.15.41 stable release

    * tag 'v5.15.41': (1977 commits)
    Linux 5.15.41
    usb: gadget: uvc: allow for application to cleanly shutdown
    usb: gadget: uvc: rename function to be more consistent
    ...

    Signed-off-by: Jason Liu

    Conflicts:
    arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi
    arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi
    arch/arm64/configs/defconfig
    drivers/clk/imx/clk-imx8qxp-lpcg.c
    drivers/dma/imx-sdma.c
    drivers/gpu/drm/bridge/nwl-dsi.c
    drivers/mailbox/imx-mailbox.c
    drivers/net/phy/at803x.c
    drivers/tty/serial/fsl_lpuart.c
    security/keys/trusted-keys/trusted_core.c

    Jason Liu
     

20 Apr, 2022

1 commit

  • commit c40160f2998c897231f8454bf797558d30a20375 upstream.

    While the latent entropy plugin mostly doesn't derive entropy from
    get_random_const() for measuring the call graph, when __latent_entropy is
    applied to a constant, then it's initialized statically to output from
    get_random_const(). In that case, this data is derived from a 64-bit
    seed, which means a buffer of 512 bits doesn't really have that amount
    of compile-time entropy.

    This patch fixes that shortcoming by just buffering chunks of
    /dev/urandom output and doling it out as requested.

    At the same time, it's important that we don't break the use of
    -frandom-seed, for people who want the runtime benefits of the latent
    entropy plugin, while still having compile-time determinism. In that
    case, we detect whether gcc's set_random_seed() has been called by
    making a call to get_random_seed(noinit=true) in the plugin init
    function, which is called after set_random_seed() is called but before
    anything that calls get_random_seed(noinit=false), and seeing if it's
    zero or not. If it's not zero, we're in deterministic mode, and so we
    just generate numbers with a basic xorshift prng.

    Note that we don't detect if -frandom-seed is being used using the
    documented local_tick variable, because it's assigned via:
    local_tick = (unsigned) tv.tv_sec * 1000 + tv.tv_usec / 1000;
    which may well overflow and become -1 on its own, and so isn't
    reliable: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105171

    [kees: The 256 byte rnd_buf size was chosen based on average (250),
    median (64), and std deviation (575) bytes of used entropy for a
    defconfig x86_64 build]

    Fixes: 38addce8b600 ("gcc-plugins: Add latent_entropy plugin")
    Cc: stable@vger.kernel.org
    Cc: PaX Team
    Signed-off-by: Jason A. Donenfeld
    Signed-off-by: Kees Cook
    Link: https://lore.kernel.org/r/20220405222815.21155-1-Jason@zx2c4.com
    Signed-off-by: Greg Kroah-Hartman

    Jason A. Donenfeld
     

08 Apr, 2022

1 commit

  • [ Upstream commit 27e9faf415dbf94af19b9c827842435edbc1fbbc ]

    Since STRING_CST may not be NUL terminated, strncmp() was used for check
    for equality. However, this may lead to mismatches for longer section
    names where the start matches the tested-for string. Test for exact
    equality by checking for the presences of NUL termination.

    Cc: Alexander Popov
    Signed-off-by: Kees Cook
    Signed-off-by: Sasha Levin

    Kees Cook
     

02 Nov, 2021

1 commit

  • Currently CONFIG_GCC_PLUGINS is auto enabled by detecting host
    build environment as follows:
    "depends on $(success,$(srctree)/scripts/gcc-plugin.sh $(CC))"

    This potentially cause an inconsistency issue of images built
    from two machines e.g. kernel modules built by ourselves
    maybe unable to load with a prebuilt kernel image and vice versa.
    (Affected by STACKPROTECTOR_PER_TASK which is also default y and
    depends on GCC_PLUGINS)

    In order to address this image inconsistency issue, we make the
    GCC_PLUGINS option not default to y and reply on users to select it
    from defconfig file once their host environment can meet the requirement
    and want this option enabled.

    This issue happened with GCC 10.2 toolchain and have gcc-10-plugin-dev
    package installed on host after migrated to Yocto 3.2.

    Acked-by: Jason Liu
    Signed-off-by: Dong Aisheng

    Dong Aisheng
     

10 Aug, 2021

1 commit

  • Set the x bit to some scripts to make them directly executable.

    Especially, scripts/checkdeclares.pl is not hooked by anyone.
    It should be executable since it is tedious to type
    'perl scripts/checkdeclares.pl'.

    The original patch [1] set the x bit properly, but it was lost when
    it was merged as commit 21917bded72c ("scripts: a new script for
    checking duplicate struct declaration").

    [1] https://lore.kernel.org/lkml/20210401110943.1010796-1-wanjiabing@vivo.com/

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

01 May, 2021

1 commit


11 Mar, 2021

1 commit

  • Linus reported a build error due to the GCC plugin incompatibility
    when the compiler is upgraded. [1]

    GCC plugins are tied to a particular GCC version. So, they must be
    rebuilt when the compiler is upgraded.

    This seems to be a long-standing flaw since the initial support of
    GCC plugins.

    Extend commit 8b59cd81dc5e ("kbuild: ensure full rebuild when the
    compiler is updated"), so that GCC plugins are covered by the
    compiler upgrade detection.

    [1]: https://lore.kernel.org/lkml/CAHk-=wieoN5ttOy7SnsGwZv+Fni3R6m-Ut=oxih6bbZ28G+4dw@mail.gmail.com/

    Reported-by: Linus Torvalds
    Signed-off-by: Masahiro Yamada
    Reviewed-by: Kees Cook

    Masahiro Yamada
     

02 Mar, 2021

2 commits


07 Jan, 2021

1 commit

  • Fedora Rawhide has started including gcc 11,and the g++ compiler
    throws a wobbly when it hits scripts/gcc-plugins:

    HOSTCXX scripts/gcc-plugins/latent_entropy_plugin.so
    In file included from /usr/include/c++/11/type_traits:35,
    from /usr/lib/gcc/x86_64-redhat-linux/11/plugin/include/system.h:244,
    from /usr/lib/gcc/x86_64-redhat-linux/11/plugin/include/gcc-plugin.h:28,
    from scripts/gcc-plugins/gcc-common.h:7,
    from scripts/gcc-plugins/latent_entropy_plugin.c:78:
    /usr/include/c++/11/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO
    C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
    32 | #error This file requires compiler and library support \

    In fact, it works just fine with c++11, which has been in gcc since 4.8,
    and we now require 4.9 as a minimum.

    Signed-off-by: Valdis Kletnieks
    Acked-by: Josh Poimboeuf
    Signed-off-by: Kees Cook
    Link: https://lore.kernel.org/r/82487.1609006918@turing-police

    Valdis Klētnieks
     

05 Dec, 2020

2 commits

  • Linus pointed out a third of the time in the Kconfig parse stage comes
    from the single invocation of cc1plus in scripts/gcc-plugin.sh [1],
    and directly testing plugin-version.h for existence cuts down the
    overhead a lot. [2]

    This commit takes one step further to kill the build test entirely.

    The small piece of code was probably intended to test the C++ designated
    initializer, which was not supported until C++20.

    In fact, with -pedantic option given, both GCC and Clang emit a warning.

    $ echo 'class test { public: int test; } test = { .test = 1 };' | g++ -x c++ -pedantic - -fsyntax-only
    :1:43: warning: C++ designated initializers only available with '-std=c++2a' or '-std=gnu++2a' [-Wpedantic]
    $ echo 'class test { public: int test; } test = { .test = 1 };' | clang++ -x c++ -pedantic - -fsyntax-only
    :1:43: warning: designated initializers are a C++20 extension [-Wc++20-designator]
    class test { public: int test; } test = { .test = 1 };
    ^
    1 warning generated.

    Otherwise, modern C++ compilers should be able to build the code, and
    hopefully skipping this test should not make any practical problem.

    Checking the existence of plugin-version.h is still needed to ensure
    the plugin-dev package is installed. The test code is now small enough
    to be embedded in scripts/gcc-plugins/Kconfig.

    [1] https://lore.kernel.org/lkml/CAHk-=wjU4DCuwQ4pXshRbwDCUQB31ScaeuDo1tjoZ0_PjhLHzQ@mail.gmail.com/
    [2] https://lore.kernel.org/lkml/CAHk-=whK0aQxs6Q5ijJmYF1n2ch8cVFSUzU5yUM_HOjig=+vnw@mail.gmail.com/

    Reported-by: Linus Torvalds
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Kees Cook
    Link: https://lore.kernel.org/r/20201203125700.161354-1-masahiroy@kernel.org

    Masahiro Yamada
     
  • Documentation/process/changes.rst says the minimal GCC version is 4.9.
    Hence, BUILDING_GCC_VERSION is greater than or equal to 4009.

    Signed-off-by: Masahiro Yamada
    Signed-off-by: Kees Cook
    Link: https://lore.kernel.org/r/20201202134929.99883-1-masahiroy@kernel.org

    Masahiro Yamada
     

10 Aug, 2020

2 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
     
  • The host shared library rules are currently implemented in
    scripts/Makefile.host, but actually GCC-plugin is the only user of
    them. (The VDSO .so files are built for the target by different
    build rules) Hence, they do not need to be treewide available.

    Move all the relevant build rules to scripts/gcc-plugins/Makefile.

    I also optimized the build steps so *.so is directly built from .c
    because every upstream plugin is compiled from a single source file.

    I am still keeping the multi-file plugin support, which Kees Cook
    mentioned might be needed by out-of-tree plugins.
    (https://lkml.org/lkml/2019/1/11/1107)

    If the plugin, foo.so, is compiled from two files foo.c and foo2.c,
    then you can do like follows:

    foo-objs := foo.o foo2.o

    Single-file plugins do not need the *-objs notation.

    Signed-off-by: Masahiro Yamada
    Acked-by: Kees Cook

    Masahiro Yamada
     

05 Aug, 2020

1 commit

  • Pull gcc plugin updates from Kees Cook:
    "Primarily improvements to STACKLEAK from Alexander Popov, along with
    some additional cleanups.

    - Update URLs for HTTPS scheme where available (Alexander A. Klimov)

    - Improve STACKLEAK code generation on x86 (Alexander Popov)"

    * tag 'gcc-plugins-v5.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
    gcc-plugins: Replace HTTP links with HTTPS ones
    gcc-plugins/stackleak: Add 'verbose' plugin parameter
    gcc-plugins/stackleak: Use asm instrumentation to avoid useless register saving
    ARM: vdso: Don't use gcc plugins for building vgettimeofday.c
    gcc-plugins/stackleak: Don't instrument itself

    Linus Torvalds
     

14 Jul, 2020

1 commit

  • Rationale:
    Reduces attack surface on kernel devs opening the links for MITM
    as HTTPS traffic is much harder to manipulate.

    Deterministic algorithm:
    For each file:
    If not .svg:
    For each line:
    If doesn't contain `\bxmlns\b`:
    For each link, `\bhttp://[^# \t\r\n]*(?:\w|/)`:
    If neither `\bgnu\.org/license`, nor `\bmozilla\.org/MPL\b`:
    If both the HTTP and HTTPS versions
    return 200 OK and serve the same content:
    Replace HTTP with HTTPS.

    Signed-off-by: Alexander A. Klimov
    Link: https://lore.kernel.org/r/20200713135018.34708-1-grandmaster@al2klimov.de
    Signed-off-by: Kees Cook

    Alexander A. Klimov
     

28 Jun, 2020

1 commit


24 Jun, 2020

2 commits

  • Add 'verbose' plugin parameter for stackleak gcc plugin.
    It can be used for printing additional info about the kernel code
    instrumentation.

    For using it add the following to scripts/Makefile.gcc-plugins:
    gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STACKLEAK) \
    += -fplugin-arg-stackleak_plugin-verbose

    Signed-off-by: Alexander Popov
    Link: https://lore.kernel.org/r/20200624123330.83226-6-alex.popov@linux.com
    Signed-off-by: Kees Cook

    Alexander Popov
     
  • The kernel code instrumentation in stackleak gcc plugin works in two stages.
    At first, stack tracking is added to GIMPLE representation of every function
    (except some special cases). And later, when stack frame size info is
    available, stack tracking is removed from the RTL representation of the
    functions with small stack frame. There is an unwanted side-effect for these
    functions: some of them do useless work with caller-saved registers.

    As an example of such case, proc_sys_write without() instrumentation:
    55 push %rbp
    41 b8 01 00 00 00 mov $0x1,%r8d
    48 89 e5 mov %rsp,%rbp
    e8 11 ff ff ff callq ffffffff81284610
    5d pop %rbp
    c3 retq
    0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
    66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1)
    00 00 00

    proc_sys_write() with instrumentation:
    55 push %rbp
    48 89 e5 mov %rsp,%rbp
    41 56 push %r14
    41 55 push %r13
    41 54 push %r12
    53 push %rbx
    49 89 f4 mov %rsi,%r12
    48 89 fb mov %rdi,%rbx
    49 89 d5 mov %rdx,%r13
    49 89 ce mov %rcx,%r14
    4c 89 f1 mov %r14,%rcx
    4c 89 ea mov %r13,%rdx
    4c 89 e6 mov %r12,%rsi
    48 89 df mov %rbx,%rdi
    41 b8 01 00 00 00 mov $0x1,%r8d
    e8 f2 fe ff ff callq ffffffff81298e80
    5b pop %rbx
    41 5c pop %r12
    41 5d pop %r13
    41 5e pop %r14
    5d pop %rbp
    c3 retq
    66 0f 1f 84 00 00 00 nopw 0x0(%rax,%rax,1)
    00 00

    Let's improve the instrumentation to avoid this:

    1. Make stackleak_track_stack() save all register that it works with.
    Use no_caller_saved_registers attribute for that function. This attribute
    is available for x86_64 and i386 starting from gcc-7.

    2. Insert calling stackleak_track_stack() in asm:
    asm volatile("call stackleak_track_stack" :: "r" (current_stack_pointer))
    Here we use ASM_CALL_CONSTRAINT trick from arch/x86/include/asm/asm.h.
    The input constraint is taken into account during gcc shrink-wrapping
    optimization. It is needed to be sure that stackleak_track_stack() call is
    inserted after the prologue of the containing function, when the stack
    frame is prepared.

    This work is a deep reengineering of the idea described on grsecurity blog
    https://grsecurity.net/resolving_an_unfortunate_stackleak_interaction

    Signed-off-by: Alexander Popov
    Acked-by: Miguel Ojeda
    Link: https://lore.kernel.org/r/20200624123330.83226-5-alex.popov@linux.com
    Signed-off-by: Kees Cook

    Alexander Popov
     

11 Jun, 2020

1 commit

  • Pull READ/WRITE_ONCE rework from Will Deacon:
    "This the READ_ONCE rework I've been working on for a while, which
    bumps the minimum GCC version and improves code-gen on arm64 when
    stack protector is enabled"

    [ Side note: I'm _really_ tempted to raise the minimum gcc version to
    4.9, so that we can just say that we require _Generic() support.

    That would allow us to more cleanly handle a lot of the cases where we
    depend on very complex macros with 'sizeof' or __builtin_choose_expr()
    with __builtin_types_compatible_p() etc.

    This branch has a workaround for sparse not handling _Generic(),
    either, but that was already fixed in the sparse development branch,
    so it's really just gcc-4.9 that we'd require. - Linus ]

    * 'rwonce/rework' of git://git.kernel.org/pub/scm/linux/kernel/git/will/linux:
    compiler_types.h: Use unoptimized __unqual_scalar_typeof for sparse
    compiler_types.h: Optimize __unqual_scalar_typeof compilation time
    compiler.h: Enforce that READ_ONCE_NOCHECK() access size is sizeof(long)
    compiler-types.h: Include naked type in __pick_integer_type() match
    READ_ONCE: Fix comment describing 2x32-bit atomicity
    gcov: Remove old GCC 3.4 support
    arm64: barrier: Use '__unqual_scalar_typeof' for acquire/release macros
    locking/barriers: Use '__unqual_scalar_typeof' for load-acquire macros
    READ_ONCE: Drop pointer qualifiers when reading from scalar types
    READ_ONCE: Enforce atomicity for {READ,WRITE}_ONCE() memory accesses
    READ_ONCE: Simplify implementations of {READ,WRITE}_ONCE()
    arm64: csum: Disable KASAN for do_csum()
    fault_inject: Don't rely on "return value" from WRITE_ONCE()
    net: tls: Avoid assigning 'const' pointer to non-const pointer
    netfilter: Avoid assigning 'const' pointer to non-const pointer
    compiler/gcc: Raise minimum GCC version for kernel builds to 4.8

    Linus Torvalds
     

25 May, 2020

1 commit


16 Apr, 2020

1 commit

  • It is very rare to see versions of GCC prior to 4.8 being used to build
    the mainline kernel. These old compilers are also know to have codegen
    issues which can lead to silent miscompilation:

    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58145

    Raise the minimum GCC version for kernel build to 4.8 and remove some
    tautological Kconfig dependencies as a consequence.

    Cc: Masahiro Yamada
    Acked-by: Arnd Bergmann
    Reviewed-by: Nick Desaulniers
    Signed-off-by: Will Deacon

    Will Deacon
     

14 Apr, 2020

2 commits

  • 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

    Frédéric Pierret (fepitre)
     
  • With GCC version >= 8, the cgraph_create_edge() macro argument using
    "frequency" goes unused. Instead of assigning a temporary variable for
    the argument, pass the compute_call_stmt_bb_frequency() call directly
    as the macro argument so that it will just not be called when it is
    not wanted by the macros.

    Silences the warning:

    scripts/gcc-plugins/stackleak_plugin.c:54:6: warning: variable ‘frequency’ set but not used [-Wunused-but-set-variable]

    Now builds cleanly with gcc-7 and gcc-9. Both boot and pass
    STACKLEAK_ERASING LKDTM test.

    Signed-off-by: Kees Cook

    Kees Cook
     

08 Apr, 2020

1 commit


04 Apr, 2020

1 commit

  • Pull SPDX updates from Greg KH:
    "Here are three SPDX patches for 5.7-rc1.

    One fixes up the SPDX tag for a single driver, while the other two go
    through the tree and add SPDX tags for all of the .gitignore files as
    needed.

    Nothing too complex, but you will get a merge conflict with your
    current tree, that should be trivial to handle (one file modified by
    two things, one file deleted.)

    All three of these have been in linux-next for a while, with no
    reported issues other than the merge conflict"

    * tag 'spdx-5.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/spdx:
    ASoC: MT6660: make spdxcheck.py happy
    .gitignore: add SPDX License Identifier
    .gitignore: remove too obvious comments

    Linus Torvalds
     

01 Apr, 2020

1 commit

  • Pull Kbuild updates from Masahiro Yamada:
    "Build system:

    - add CONFIG_UNUSED_KSYMS_WHITELIST, which will be useful to define a
    fixed set of export symbols for Generic Kernel Image (GKI)

    - allow to run 'make dt_binding_check' without .config

    - use full schema for checking DT examples in *.yaml files

    - make modpost fail for missing MODULE_IMPORT_NS(), which makes more
    sense because we know the produced modules are never loadable

    - Remove unused 'AS' variable

    Kconfig:

    - sanitize DEFCONFIG_LIST, and remove ARCH_DEFCONFIG from Kconfig
    files

    - relax the 'imply' behavior so that symbols implied by 'y' can
    become 'm'

    - make 'imply' obey 'depends on' in order to make 'imply' really weak

    Misc:

    - add documentation on building the kernel with Clang/LLVM

    - revive __HAVE_ARCH_STRLEN for 32bit sparc to use optimized strlen()

    - fix warning from deb-pkg builds when CONFIG_DEBUG_INFO=n

    - various script and Makefile cleanups"

    * tag 'kbuild-v5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (34 commits)
    Makefile: Update kselftest help information
    kbuild: deb-pkg: fix warning when CONFIG_DEBUG_INFO is unset
    kbuild: add outputmakefile to no-dot-config-targets
    kbuild: remove AS variable
    net: wan: wanxl: refactor the firmware rebuild rule
    net: wan: wanxl: use $(M68KCC) instead of $(M68KAS) for rebuilding firmware
    net: wan: wanxl: use allow to pass CROSS_COMPILE_M68k for rebuilding firmware
    kbuild: add comment about grouped target
    kbuild: add -Wall to KBUILD_HOSTCXXFLAGS
    kconfig: remove unused variable in qconf.cc
    sparc: revive __HAVE_ARCH_STRLEN for 32bit sparc
    kbuild: refactor Makefile.dtbinst more
    kbuild: compute the dtbs_install destination more simply
    Makefile: disallow data races on gcc-10 as well
    kconfig: make 'imply' obey the direct dependency
    kconfig: allow symbols implied by y to become m
    net: drop_monitor: use IS_REACHABLE() to guard net_dm_hw_report()
    modpost: return error if module is missing ns imports and MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS=n
    modpost: rework and consolidate logging interface
    kbuild: allow to run dt_binding_check without kernel configuration
    ...

    Linus Torvalds
     

29 Mar, 2020

1 commit

  • Add -Wall to catch more warnings for C++ host programs.

    When I submitted the previous version, the 0-day bot reported
    -Wc++11-compat warnings for old GCC:

    HOSTCXX -fPIC scripts/gcc-plugins/latent_entropy_plugin.o
    In file included from /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/include/tm.h:28:0,
    from scripts/gcc-plugins/gcc-common.h:15,
    from scripts/gcc-plugins/latent_entropy_plugin.c:78:
    /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/include/config/elfos.h:102:21: warning: C++11 requires a space between string literal and macro [-Wc++11-compat]
    fprintf ((FILE), "%s"HOST_WIDE_INT_PRINT_UNSIGNED"\n",\
    ^
    /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/include/config/elfos.h:170:24: warning: C++11 requires a space between string literal and macro [-Wc++11-compat]
    fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", \
    ^
    In file included from /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/include/tm.h:42:0,
    from scripts/gcc-plugins/gcc-common.h:15,
    from scripts/gcc-plugins/latent_entropy_plugin.c:78:
    /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/include/defaults.h:126:24: warning: C++11 requires a space between string literal and macro [-Wc++11-compat]
    fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", \
    ^

    The source of the warnings is in the plugin headers, so we have no
    control of it. I just suppressed them by adding -Wno-c++11-compat to
    scripts/gcc-plugins/Makefile.

    Signed-off-by: Masahiro Yamada
    Acked-by: Kees Cook

    Masahiro Yamada
     

25 Mar, 2020

1 commit


11 Mar, 2020

1 commit


04 Feb, 2020

1 commit

  • In old days, the "host-progs" syntax was used for specifying host
    programs. It was renamed to the current "hostprogs-y" in 2004.

    It is typically useful in scripts/Makefile because it allows Kbuild to
    selectively compile host programs based on the kernel configuration.

    This commit renames like follows:

    always -> always-y
    hostprogs-y -> hostprogs

    So, scripts/Makefile will look like this:

    always-$(CONFIG_BUILD_BIN2C) += ...
    always-$(CONFIG_KALLSYMS) += ...
    ...
    hostprogs := $(always-y) $(always-m)

    I think this makes more sense because a host program is always a host
    program, irrespective of the kernel configuration. We want to specify
    which ones to compile by CONFIG options, so always-y will be handier.

    The "always", "hostprogs-y", "hostprogs-m" will be kept for backward
    compatibility for a while.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

03 Jan, 2020

1 commit

  • I noticed that randconfig builds with gcc no longer produce a lot of
    ccache hits, unlike with clang, and traced this back to plugins
    now being enabled unconditionally if they are supported.

    I am now working around this by adding

    export CCACHE_COMPILERCHECK=/usr/bin/size -A %compiler%

    to my top-level Makefile. This changes the heuristic that ccache uses
    to determine whether the plugins are the same after a 'make clean'.

    However, it also seems that being able to just turn off the plugins is
    generally useful, at least for build testing it adds noticeable overhead
    but does not find a lot of bugs additional bugs, and may be easier for
    ccache users than my workaround.

    Fixes: 9f671e58159a ("security: Create "kernel hardening" config area")
    Signed-off-by: Arnd Bergmann
    Acked-by: Ard Biesheuvel
    Reviewed-by: Masahiro Yamada
    Link: https://lore.kernel.org/r/20191211133951.401933-1-arnd@arndb.de
    Cc: stable@vger.kernel.org
    Signed-off-by: Kees Cook

    Arnd Bergmann
     

01 Aug, 2019

1 commit

  • While no uses in the kernel triggered this case, it was possible to have
    a false negative where a struct contains other structs which contain only
    function pointers because of unreachable code in is_pure_ops_struct().

    Signed-off-by: Joonwon Kang
    Link: https://lore.kernel.org/r/20190727155841.GA13586@host
    Fixes: 313dd1b62921 ("gcc-plugins: Add the randstruct plugin")
    Cc: stable@vger.kernel.org
    Signed-off-by: Kees Cook

    Joonwon Kang
     

15 Jul, 2019

1 commit


01 Jun, 2019

1 commit


21 May, 2019

2 commits

  • Add SPDX license identifiers to all Make/Kconfig files which:

    - Have no license information of any form

    These files fall under the project license, GPL v2 only. The resulting SPDX
    license identifier is:

    GPL-2.0-only

    Signed-off-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     
  • The gcc-common.h file did not take into account certain macros that
    might have already been defined in the build environment. This updates
    the header to avoid redefining the macros, as seen on a Darwin host
    using gcc 4.9.2:

    HOSTCXX -fPIC scripts/gcc-plugins/arm_ssp_per_task_plugin.o - due to: scripts/gcc-plugins/gcc-common.h
    In file included from scripts/gcc-plugins/arm_ssp_per_task_plugin.c:3:0:
    scripts/gcc-plugins/gcc-common.h:153:0: warning: "__unused" redefined
    ^
    In file included from /usr/include/stdio.h:64:0,
    from /Users/hns/Documents/Projects/QuantumSTEP/System/Library/Frameworks/System.framework/Versions-jessie/x86_64-apple-darwin15.0.0/gcc/arm-linux-gnueabi/bin/../lib/gcc/arm-linux-gnueabi/4.9.2/plugin/include/system.h:40,
    from /Users/hns/Documents/Projects/QuantumSTEP/System/Library/Frameworks/System.framework/Versions-jessie/x86_64-apple-darwin15.0.0/gcc/arm-linux-gnueabi/bin/../lib/gcc/arm-linux-gnueabi/4.9.2/plugin/include/gcc-plugin.h:28,
    from /Users/hns/Documents/Projects/QuantumSTEP/System/Library/Frameworks/System.framework/Versions-jessie/x86_64-apple-darwin15.0.0/gcc/arm-linux-gnueabi/bin/../lib/gcc/arm-linux-gnueabi/4.9.2/plugin/include/plugin.h:23,
    from scripts/gcc-plugins/gcc-common.h:9,
    from scripts/gcc-plugins/arm_ssp_per_task_plugin.c:3:
    /usr/include/sys/cdefs.h:161:0: note: this is the location of the previous definition
    ^

    Reported-and-tested-by: "H. Nikolaus Schaller"
    Fixes: 189af4657186 ("ARM: smp: add support for per-task stack canaries")
    Cc: stable@vger.kernel.org
    Signed-off-by: Kees Cook

    Kees Cook
     

14 May, 2019

1 commit


11 May, 2019

1 commit

  • Use gen_rtx_set instead of gen_rtx_SET. The former is a wrapper macro
    that handles the difference between GCC versions implementing
    the latter.

    This fixes the following error on my system with g++ 5.4.0 as the host
    compiler

    HOSTCXX -fPIC scripts/gcc-plugins/arm_ssp_per_task_plugin.o
    scripts/gcc-plugins/arm_ssp_per_task_plugin.c:42:14: error: macro "gen_rtx_SET" requires 3 arguments, but only 2 given
    mask)),
    ^
    scripts/gcc-plugins/arm_ssp_per_task_plugin.c: In function ‘unsigned int arm_pertask_ssp_rtl_execute()’:
    scripts/gcc-plugins/arm_ssp_per_task_plugin.c:39:20: error: ‘gen_rtx_SET’ was not declared in this scope
    emit_insn_before(gen_rtx_SET

    Signed-off-by: Chris Packham
    Fixes: 189af4657186 ("ARM: smp: add support for per-task stack canaries")
    Cc: stable@vger.kernel.org
    Tested-by: Douglas Anderson
    Signed-off-by: Kees Cook

    Chris Packham
     

25 Apr, 2019

1 commit