11 Feb, 2019

1 commit


04 Feb, 2019

1 commit


28 Jan, 2019

1 commit


21 Jan, 2019

1 commit


17 Jan, 2019

1 commit

  • Commit c3ff2a5193fa ("powerpc/32: add stack protector support")
    caused kernel panic on PowerPC when an external module is used with
    CONFIG_STACKPROTECTOR because the 'prepare' target was not executed
    for the external module build.

    Commit e07db28eea38 ("kbuild: fix single target build for external
    module") turned it into a build error because the 'prepare' target is
    now executed but the 'prepare0' target is missing for the external
    module build.

    External module on arm/arm64 with CONFIG_STACKPROTECTOR_PER_TASK is
    also broken in the same way.

    Move 'PHONY += prepare0' to the common place. GNU Make is fine with
    missing rule for phony targets. I also removed the comment which is
    wrong irrespective of this commit.

    I minimize the change so it can be easily backported to 4.20.x

    To fix v4.20, please backport e07db28eea38 ("kbuild: fix single target
    build for external module"), and then this commit.

    Link: https://bugzilla.kernel.org/show_bug.cgi?id=201891
    Fixes: e07db28eea38 ("kbuild: fix single target build for external module")
    Fixes: c3ff2a5193fa ("powerpc/32: add stack protector support")
    Fixes: 189af4657186 ("ARM: smp: add support for per-task stack canaries")
    Fixes: 0a1213fa7432 ("arm64: enable per-task stack canaries")
    Cc: linux-stable # v4.20
    Reported-by: Samuel Holland
    Reported-by: Alexey Kardashevskiy
    Signed-off-by: Masahiro Yamada
    Acked-by: Ard Biesheuvel
    Tested-by: Alexey Kardashevskiy

    Masahiro Yamada
     

16 Jan, 2019

1 commit


14 Jan, 2019

1 commit


07 Jan, 2019

1 commit


06 Jan, 2019

4 commits


30 Dec, 2018

1 commit

  • Pull Kbuild updates from Masahiro Yamada:
    "Kbuild core:
    - remove unneeded $(call cc-option,...) switches
    - consolidate Clang compiler flags into CLANG_FLAGS
    - announce the deprecation of SUBDIRS
    - fix single target build for external module
    - simplify the dependencies of 'prepare' stage targets
    - allow fixdep to directly write to .*.cmd files
    - simplify dependency generation for CONFIG_TRIM_UNUSED_KSYMS
    - change if_changed_rule to accept multi-line recipe
    - move .SECONDARY special target to scripts/Kbuild.include
    - remove redundant 'set -e'
    - improve parallel execution for CONFIG_HEADERS_CHECK
    - misc cleanups

    Treewide fixes and cleanups
    - set Clang flags correctly for PowerPC boot images
    - fix UML build error with CONFIG_GCC_PLUGINS
    - remove unneeded patterns from .gitignore files
    - refactor firmware/Makefile
    - remove unneeded rules for *offsets.s
    - avoid unneeded regeneration of intermediate .s files
    - clean up ./Kbuild

    Modpost:
    - remove unused -M, -K options
    - fix false positive warnings about section mismatch
    - use simple devtable lookup instead of linker magic
    - misc cleanups

    Coccinelle:
    - relax boolinit.cocci checks for overall consistency
    - fix warning messages of boolinit.cocci

    Other tools:
    - improve -dirty check of scripts/setlocalversion
    - add a tool to generate compile_commands.json from .*.cmd files"

    * tag 'kbuild-v4.21' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (51 commits)
    kbuild: remove unused cmd_gentimeconst
    kbuild: remove $(obj)/ prefixes in ./Kbuild
    treewide: add intermediate .s files to targets
    treewide: remove explicit rules for *offsets.s
    firmware: refactor firmware/Makefile
    firmware: remove unnecessary patterns from .gitignore
    scripts: remove unnecessary ihex2fw and check-lc_ctypes from .gitignore
    um: remove unused filechk_gen_header in Makefile
    scripts: add a tool to produce a compile_commands.json file
    kbuild: add -Werror=implicit-int flag unconditionally
    kbuild: add -Werror=strict-prototypes flag unconditionally
    kbuild: add -fno-PIE flag unconditionally
    scripts: coccinelle: Correct warning message
    scripts: coccinelle: only suggest true/false in files that already use them
    kbuild: handle part-of-module correctly for *.ll and *.symtypes
    kbuild: refactor part-of-module
    kbuild: refactor quiet_modtag
    kbuild: remove redundant quiet_modtag for $(obj-m)
    kbuild: refactor Makefile.asm-generic
    user/Makefile: Fix typo and capitalization in comment section
    ...

    Linus Torvalds
     

29 Dec, 2018

1 commit

  • Pull Devicetree updates from Rob Herring:
    "The biggest highlight here is the start of using json-schema for DT
    bindings. Being able to validate bindings has been discussed for years
    with little progress.

    - Initial support for DT bindings using json-schema language. This is
    the start of converting DT bindings from free-form text to a
    structured format.

    - Reworking of initrd address initialization. This moves to using the
    phys address instead of virt addr in the DT parsing code. This
    rework was motivated by CONFIG_DEV_BLK_INITRD causing unnecessary
    rebuilding of lots of files.

    - Fix stale phandle entries in phandle cache

    - DT overlay validation improvements. This exposed several memory
    leak bugs which have been fixed.

    - Use node name and device_type helper functions in DT code

    - Last remaining conversions to using %pOFn printk specifier instead
    of device_node.name directly

    - Create new common RTC binding doc and move all trivial RTC devices
    out of trivial-devices.txt.

    - New bindings for Freescale MAG3110 magnetometer, Cadence Sierra
    PHY, and Xen shared memory

    - Update dtc to upstream version v1.4.7-57-gf267e674d145"

    * tag 'devicetree-for-4.21' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux: (68 commits)
    of: __of_detach_node() - remove node from phandle cache
    of: of_node_get()/of_node_put() nodes held in phandle cache
    gpio-omap.txt: add reg and interrupts properties
    dt-bindings: mrvl,intc: fix a trivial typo
    dt-bindings: iio: magnetometer: add dt-bindings for freescale mag3110
    dt-bindings: Convert trivial-devices.txt to json-schema
    dt-bindings: arm: mrvl: amend Browstone compatible string
    dt-bindings: arm: Convert Tegra board/soc bindings to json-schema
    dt-bindings: arm: Convert ZTE board/soc bindings to json-schema
    dt-bindings: arm: Add missing Xilinx boards
    dt-bindings: arm: Convert Xilinx board/soc bindings to json-schema
    dt-bindings: arm: Convert VIA board/soc bindings to json-schema
    dt-bindings: arm: Convert ST STi board/soc bindings to json-schema
    dt-bindings: arm: Convert SPEAr board/soc bindings to json-schema
    dt-bindings: arm: Convert CSR SiRF board/soc bindings to json-schema
    dt-bindings: arm: Convert QCom board/soc bindings to json-schema
    dt-bindings: arm: Convert TI nspire board/soc bindings to json-schema
    dt-bindings: arm: Convert TI davinci board/soc bindings to json-schema
    dt-bindings: arm: Convert Calxeda board/soc bindings to json-schema
    dt-bindings: arm: Convert Altera board/soc bindings to json-schema
    ...

    Linus Torvalds
     

24 Dec, 2018

1 commit


22 Dec, 2018

1 commit

  • Pull x86 fixes from Ingo Molnar:
    "The biggest part is a series of reverts for the macro based GCC
    inlining workarounds. It caused regressions in distro build and other
    kernel tooling environments, and the GCC project was very receptive to
    fixing the underlying inliner weaknesses - so as time ran out we
    decided to do a reasonably straightforward revert of the patches. The
    plan is to rely on the 'asm inline' GCC 9 feature, which might be
    backported to GCC 8 and could thus become reasonably widely available
    on modern distros.

    Other than those reverts, there's misc fixes from all around the
    place.

    I wish our final x86 pull request for v4.20 was smaller..."

    * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    Revert "kbuild/Makefile: Prepare for using macros in inline assembly code to work around asm() related GCC inlining bugs"
    Revert "x86/objtool: Use asm macros to work around GCC inlining bugs"
    Revert "x86/refcount: Work around GCC inlining bug"
    Revert "x86/alternatives: Macrofy lock prefixes to work around GCC inlining bugs"
    Revert "x86/bug: Macrofy the BUG table section handling, to work around GCC inlining bugs"
    Revert "x86/paravirt: Work around GCC inlining bugs when compiling paravirt ops"
    Revert "x86/extable: Macrofy inline assembly code to work around GCC inlining bugs"
    Revert "x86/cpufeature: Macrofy inline assembly code to work around GCC inlining bugs"
    Revert "x86/jump-labels: Macrofy inline assembly code to work around GCC inlining bugs"
    x86/mtrr: Don't copy uninitialized gentry fields back to userspace
    x86/fsgsbase/64: Fix the base write helper functions
    x86/mm/cpa: Fix cpa_flush_array() TLB invalidation
    x86/vdso: Pass --eh-frame-hdr to the linker
    x86/mm: Fix decoy address handling vs 32-bit builds
    x86/intel_rdt: Ensure a CPU remains online for the region's pseudo-locking sequence
    x86/dump_pagetables: Fix LDT remap address marker
    x86/mm: Fix guard hole handling

    Linus Torvalds
     

20 Dec, 2018

1 commit


19 Dec, 2018

2 commits

  • For the same reason as commit 25896d073d8a ("x86/build: Fix compiler
    support check for CONFIG_RETPOLINE"), you cannot put this $(error ...)
    into the parse stage of the top Makefile.

    Perhaps I'd propose a more sophisticated solution later, but this is
    the best I can do for now.

    Link: https://lkml.org/lkml/2017/12/25/211
    Reported-by: Paul Gortmaker
    Reported-by: Bernd Edlinger
    Reported-by: Qian Cai
    Cc: Josh Poimboeuf
    Signed-off-by: Masahiro Yamada
    Tested-by: Qian Cai

    Masahiro Yamada
     
  • …k around asm() related GCC inlining bugs"

    This reverts commit 77b0bf55bc675233d22cd5df97605d516d64525e.

    See this commit for details about the revert:

    e769742d3584 ("Revert "x86/jump-labels: Macrofy inline assembly code to work around GCC inlining bugs"")

    Conflicts:
    arch/x86/Makefile

    Reported-by: Masahiro Yamada <yamada.masahiro@socionext.com>
    Reviewed-by: Borislav Petkov <bp@alien8.de>
    Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: Juergen Gross <jgross@suse.com>
    Cc: Richard Biener <rguenther@suse.de>
    Cc: Kees Cook <keescook@chromium.org>
    Cc: Segher Boessenkool <segher@kernel.crashing.org>
    Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Josh Poimboeuf <jpoimboe@redhat.com>
    Cc: Nadav Amit <namit@vmware.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Ingo Molnar <mingo@kernel.org>

    Ingo Molnar
     

17 Dec, 2018

1 commit


16 Dec, 2018

4 commits


13 Dec, 2018

1 commit

  • This adds the build infrastructure for checking DT binding schema
    documents and validating dts files using the binding schema.

    Check DT binding schema documents:
    make dt_binding_check

    Build dts files and check using DT binding schema:
    make dtbs_check

    Optionally, DT_SCHEMA_FILES can be passed in with a schema file(s) to
    use for validation. This makes it easier to find and fix errors
    generated by a specific schema.

    Currently, the validation targets are separate from a normal build to
    avoid a hard dependency on the external DT schema project and because
    there are lots of warnings generated.

    Cc: Jonathan Corbet
    Cc: Mark Rutland
    Acked-by: Masahiro Yamada
    Cc: Michal Marek
    Cc: linux-doc@vger.kernel.org
    Cc: devicetree@vger.kernel.org
    Cc: linux-kbuild@vger.kernel.org
    Signed-off-by: Rob Herring

    Rob Herring
     

10 Dec, 2018

1 commit


08 Dec, 2018

1 commit


03 Dec, 2018

1 commit


01 Dec, 2018

7 commits

  • Currently, fixdep writes dependencies to .*.tmp, which is renamed to
    .*.cmd after everything succeeds. This is a very safe way to avoid
    corrupted .*.cmd files. The if_changed_dep has carried this safety
    mechanism since it was added in 2002.

    If fixdep fails for some reasons or a user terminates the build while
    fixdep is running, the incomplete output from the fixdep could be
    troublesome.

    This is my insight about some bad scenarios:

    [1] If the compiler succeeds to generate *.o file, but fixdep fails
    to write necessary dependencies to .*.cmd file, Make will miss
    to rebuild the object when headers or CONFIG options are changed.
    In this case, fixdep should not generate .*.cmd file at all so
    that 'arg-check' will surely trigger the rebuild of the object.

    [2] A partially constructed .*.cmd file may not be a syntactically
    correct makefile. The next time Make runs, it would include it,
    then fail to parse it. Once this happens, 'make clean' is be the
    only way to fix it.

    In fact, [1] is no longer a problem since commit 9c2af1c7377a ("kbuild:
    add .DELETE_ON_ERROR special target"). Make deletes a target file on
    any failure in its recipe. Because fixdep is a part of the recipe of
    *.o target, if it fails, the *.o is deleted anyway. However, I am a
    bit worried about the slight possibility of [2].

    So, here is a solution. Let fixdep directly write to a .*.cmd file,
    but allow makefiles to include it only when its corresponding target
    exists.

    This effectively reverts commit 2982c953570b ("kbuild: remove redundant
    $(wildcard ...) for cmd_files calculation"), and commit 00d78ab2ba75
    ("kbuild: remove dead code in cmd_files calculation in top Makefile")
    because now we must check the presence of targets.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • Now that 'archprepare' depends on 'scripts', Kbuild can descend into
    scripts/gcc-plugins in a more standard way.

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

    Masahiro Yamada
     
  • Before start descending, Kbuild needs to run 'prepare' and 'scripts',
    which has been orthogonal to each other.

    Going forward, let's consider 'scripts' is a part of the preparation.
    This will allow more cleanups.

    Move 'scripts' to the prerequisite of 'archprepare', where UML starts
    compiling target *.c files.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • I am eagar to build under the scripts/ directory only with $(HOSTCC),
    but scripts/mod/ highly depends on the $(CC) and target arch headers.
    That it why the 'scripts' target must depend on 'asm-generic',
    'gcc-plugins', and $(autoksyms_h).

    Move it to the 'prepare0' stage. I know this is a cheesy workaround,
    but better than the current situation.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • UML fails to build with CONFIG_GCC_PLUGINS=y.

    $ make -s ARCH=um mrproper
    $ make -s ARCH=um allmodconfig
    $ make ARCH=um
    UPD include/generated/uapi/linux/version.h
    WRAP arch/x86/include/generated/uapi/asm/bpf_perf_event.h
    WRAP arch/x86/include/generated/uapi/asm/poll.h
    WRAP arch/x86/include/generated/asm/dma-contiguous.h
    WRAP arch/x86/include/generated/asm/early_ioremap.h
    WRAP arch/x86/include/generated/asm/export.h
    WRAP arch/x86/include/generated/asm/mcs_spinlock.h
    WRAP arch/x86/include/generated/asm/mm-arch-hooks.h
    SYSTBL arch/x86/include/generated/asm/syscalls_32.h
    SYSHDR arch/x86/include/generated/asm/unistd_32_ia32.h
    SYSHDR arch/x86/include/generated/asm/unistd_64_x32.h
    SYSTBL arch/x86/include/generated/asm/syscalls_64.h
    SYSHDR arch/x86/include/generated/uapi/asm/unistd_32.h
    SYSHDR arch/x86/include/generated/uapi/asm/unistd_64.h
    SYSHDR arch/x86/include/generated/uapi/asm/unistd_x32.h
    HOSTCC scripts/unifdef
    CC arch/x86/um/user-offsets.s
    cc1: error: cannot load plugin ./scripts/gcc-plugins/cyc_complexity_plugin.so
    ./scripts/gcc-plugins/cyc_complexity_plugin.so: cannot open shared object file: No such file or directory
    cc1: error: cannot load plugin ./scripts/gcc-plugins/structleak_plugin.so
    ./scripts/gcc-plugins/structleak_plugin.so: cannot open shared object file: No such file or directory
    cc1: error: cannot load plugin ./scripts/gcc-plugins/latent_entropy_plugin.so
    ./scripts/gcc-plugins/latent_entropy_plugin.so: cannot open shared object file: No such file or directory
    cc1: error: cannot load plugin ./scripts/gcc-plugins/randomize_layout_plugin.so
    ./scripts/gcc-plugins/randomize_layout_plugin.so: cannot open shared object file: No such file or directory
    make[1]: *** [scripts/Makefile.build;119: arch/x86/um/user-offsets.s] Error 1
    make: *** [arch/um/Makefile;152: arch/x86/um/user-offsets.s] Error 2

    Reorder the preparation stage (with cleanups) to make sure gcc-plugins
    is built before descending to arch/x86/um/.

    Fixes: 6b90bd4ba40b ("GCC plugin infrastructure")
    Reported-by: kbuild test robot
    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • Building a single target in an external module fails due to missing
    .tmp_versions directory.

    For example,

    $ make -C /lib/modules/$(uname -r)/build M=$PWD foo.o

    will fail in the following way:

    CC [M] /home/masahiro/foo/foo.o
    /bin/sh: 1: cannot create /home/masahiro/foo/.tmp_versions/foo.mod: Directory nonexistent

    This is because $(cmd_crmodverdir) is executed only before building
    /, %/, %.ko single targets of external modules. Create .tmp_versions
    in the 'prepare' target.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • SUBDIRS has been kept as a backward compatibility since
    commit ("[PATCH] kbuild: external module support") in 2002.

    We do not need multiple ways to do the same thing, so I will remove
    SUBDIRS after the Linux 5.3 release. I cleaned up in-tree code, and
    updated the document so that nobody would try to use it.

    Meanwhile, display the following warning if SUBDIRS is used.

    Makefile:189: ================= WARNING ================
    Makefile:190: 'SUBDIRS' will be removed after Linux 5.3
    Makefile:191: Please use 'M=' or 'KBUILD_EXTMOD' instead
    Makefile:192: ==========================================

    Signed-off-by: Masahiro Yamada
    Acked-by: Boris Brezillon # for scx200_docflash.c
    Acked-by: Guenter Roeck # for scx200_wdt.c

    Masahiro Yamada
     

26 Nov, 2018

1 commit


19 Nov, 2018

1 commit


14 Nov, 2018

3 commits