23 Sep, 2019

1 commit

  • Pull modules updates from Jessica Yu:
    "The main bulk of this pull request introduces a new exported symbol
    namespaces feature. The number of exported symbols is increasingly
    growing with each release (we're at about 31k exports as of 5.3-rc7)
    and we currently have no way of visualizing how these symbols are
    "clustered" or making sense of this huge export surface.

    Namespacing exported symbols allows kernel developers to more
    explicitly partition and categorize exported symbols, as well as more
    easily limiting the availability of namespaced symbols to other parts
    of the kernel. For starters, we have introduced the USB_STORAGE
    namespace to demonstrate the API's usage. I have briefly summarized
    the feature and its main motivations in the tag below.

    Summary:

    - Introduce exported symbol namespaces.

    This new feature allows subsystem maintainers to partition and
    categorize their exported symbols into explicit namespaces. Module
    authors are now required to import the namespaces they need.

    Some of the main motivations of this feature include: allowing
    kernel developers to better manage the export surface, allow
    subsystem maintainers to explicitly state that usage of some
    exported symbols should only be limited to certain users (think:
    inter-module or inter-driver symbols, debugging symbols, etc), as
    well as more easily limiting the availability of namespaced symbols
    to other parts of the kernel.

    With the module import requirement, it is also easier to spot the
    misuse of exported symbols during patch review.

    Two new macros are introduced: EXPORT_SYMBOL_NS() and
    EXPORT_SYMBOL_NS_GPL(). The API is thoroughly documented in
    Documentation/kbuild/namespaces.rst.

    - Some small code and kbuild cleanups here and there"

    * tag 'modules-for-v5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux:
    module: Remove leftover '#undef' from export header
    module: remove unneeded casts in cmp_name()
    module: move CONFIG_UNUSED_SYMBOLS to the sub-menu of MODULES
    module: remove redundant 'depends on MODULES'
    module: Fix link failure due to invalid relocation on namespace offset
    usb-storage: export symbols in USB_STORAGE namespace
    usb-storage: remove single-use define for debugging
    docs: Add documentation for Symbol Namespaces
    scripts: Coccinelle script for namespace dependencies.
    modpost: add support for generating namespace dependencies
    export: allow definition default namespaces in Makefiles or sources
    module: add config option MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS
    modpost: add support for symbol namespaces
    module: add support for symbol namespaces.
    export: explicitly align struct kernel_symbol
    module: support reading multiple values per modinfo tag

    Linus Torvalds
     

10 Sep, 2019

1 commit

  • A script that uses the '.ns_deps' files generated by modpost to
    automatically add the required symbol namespace dependencies to each
    module.

    Usage:
    1) Move some symbols to a namespace with EXPORT_SYMBOL_NS() or define
    DEFAULT_SYMBOL_NAMESPACE
    2) Run 'make' (or 'make modules') and get warnings about modules not
    importing that namespace.
    3) Run 'make nsdeps' to automatically add required import statements
    to said modules.

    This makes it easer for subsystem maintainers to introduce and maintain
    symbol namespaces into their codebase.

    Co-developed-by: Martijn Coenen
    Signed-off-by: Martijn Coenen
    Acked-by: Julia Lawall
    Reviewed-by: Greg Kroah-Hartman
    Signed-off-by: Matthias Maennich
    Signed-off-by: Jessica Yu

    Matthias Maennich
     

22 Aug, 2019

1 commit

  • I think splitting the modpost and linking modules into separate
    Makefiles will be useful especially when more complex build steps
    come in. The main motivation of this commit is to integrate the
    proposed klp-convert feature cleanly.

    I moved the logging 'Building modules, stage 2.' to Makefile.modpost
    to avoid the code duplication although I do not know whether or not
    this message is needed in the first place.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

21 Aug, 2019

1 commit


14 Aug, 2019

2 commits

  • This builds module objects, so [M] makes sense.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • Update the build scripts and the version magic to reflect when
    CONFIG_PREEMPT_RT is enabled in the same way as CONFIG_PREEMPT is treated.

    The resulting version strings:

    Linux m 5.3.0-rc1+ #100 SMP Fri Jul 26 ...
    Linux m 5.3.0-rc1+ #101 SMP PREEMPT Fri Jul 26 ...
    Linux m 5.3.0-rc1+ #102 SMP PREEMPT_RT Fri Jul 26 ...

    The module vermagic:

    5.3.0-rc1+ SMP mod_unload modversions
    5.3.0-rc1+ SMP preempt mod_unload modversions
    5.3.0-rc1+ SMP preempt_rt mod_unload modversions

    Signed-off-by: Thomas Gleixner
    Signed-off-by: Masahiro Yamada

    Thomas Gleixner
     

10 Aug, 2019

1 commit

  • I removed the single target %.ko in commit ff9b45c55b26 ("kbuild:
    modpost: read modules.order instead of $(MODVERDIR)/*.mod") because
    the modpost stage does not work reliably. For instance, the module
    dependency, modversion, etc. do not work if we lack symbol information
    from the other modules.

    Yet, some people still want to build only one module in their interest,
    and it may be still useful if it is used within those limitations.

    Fixes: ff9b45c55b26 ("kbuild: modpost: read modules.order instead of $(MODVERDIR)/*.mod")
    Reported-by: Don Brace
    Reported-by: Arend Van Spriel
    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

31 Jul, 2019

4 commits

  • Since commit ff9b45c55b26 ("kbuild: modpost: read modules.order instead
    of $(MODVERDIR)/*.mod"), 'make vmlinux' emits a warning, like this:

    $ make defconfig vmlinux
    [ snip ]
    LD vmlinux.o
    cat: modules.order: No such file or directory
    MODPOST vmlinux.o
    MODINFO modules.builtin.modinfo
    KSYM .tmp_kallsyms1.o
    KSYM .tmp_kallsyms2.o
    LD vmlinux
    SORTEX vmlinux
    SYSMAP System.map

    When building only vmlinux, KBUILD_MODULES is not set. Hence, the
    modules.order is not generated. For the vmlinux modpost, it is not
    necessary at all.

    Separate scripts/Makefile.modpost for the vmlinux/modules stages.
    This works more efficiently because the vmlinux modpost does not
    need to include .*.cmd files.

    Fixes: ff9b45c55b26 ("kbuild: modpost: read modules.order instead of $(MODVERDIR)/*.mod")
    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • __modpost is a phony target. The dependency on FORCE is pointless.
    All the objects have been built in the previous stage, so the
    dependency on the objects are not necessary either.

    Count the number of modules in a more straightforward way.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • KBUILD_EXTRA_SYMBOLS makes sense only when building external modules.
    Moreover, the modpost sets 'external_module' if the -e option is given.

    I replaced $(patsubst %, -e %,...) with simpler $(addprefix -e,...)
    while I was here.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • If a build rule fails, the .DELETE_ON_ERROR special target removes the
    target, but does nothing for the .*.cmd file, which might be corrupted.
    So, .*.cmd files should be included only when the corresponding targets
    exist.

    Commit 392885ee82d3 ("kbuild: let fixdep directly write to .*.cmd
    files") missed to fix up this file.

    Fixes: 392885ee82d3 ("kbuild: let fixdep directly write to .*.cmd")
    Cc: # v5.0+
    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

18 Jul, 2019

2 commits

  • While descending directories, Kbuild produces objects for modules,
    but do not link final *.ko files; it is done in the modpost.

    To keep track of modules, Kbuild creates a *.mod file in $(MODVERDIR)
    for every module it is building. Some post-processing steps read the
    necessary information from *.mod files. This avoids descending into
    directories again. This mechanism was introduced in 2003 or so.

    Later, commit 551559e13af1 ("kbuild: implement modules.order") added
    modules.order. So, we can simply read it out to know all the modules
    with directory paths. This is easier than parsing the first line of
    *.mod files.

    $(MODVERDIR) has a flat directory structure, that is, *.mod files
    are named only with base names. This is based on the assumption that
    the module name is unique across the tree. This assumption is really
    fragile.

    Stephen Rothwell reported a race condition caused by a module name
    conflict:

    https://lkml.org/lkml/2019/5/13/991

    In parallel building, two different threads could write to the same
    $(MODVERDIR)/*.mod simultaneously.

    Non-unique module names are the source of all kind of troubles, hence
    commit 3a48a91901c5 ("kbuild: check uniqueness of module names")
    introduced a new checker script.

    However, it is still fragile in the build system point of view because
    this race happens before scripts/modules-check.sh is invoked. If it
    happens again, the modpost will emit unclear error messages.

    To fix this issue completely, create *.mod with full directory path
    so that two threads never attempt to write to the same file.

    $(MODVERDIR) is no longer needed.

    Since modules with directory paths are listed in modules.order, Kbuild
    is still able to find *.mod files without additional descending.

    I also killed cmd_secanalysis; scripts/mod/sumversion.c computes MD4 hash
    for modules with MODULE_VERSION(). When CONFIG_DEBUG_SECTION_MISMATCH=y,
    it occurs not only in the modpost stage, but also during directory
    descending, where sumversion.c may parse stale *.mod files. It would emit
    'No such file or directory' warning when an object consisting a module is
    renamed, or when a single-obj module is turned into a multi-obj module or
    vice versa.

    Signed-off-by: Masahiro Yamada
    Acked-by: Nicolas Pitre

    Masahiro Yamada
     
  • Towards the goal of removing MODVERDIR, read out modules.order to get
    the list of modules to be processed. This is simpler than parsing *.mod
    files in $(MODVERDIR).

    For external modules, $(KBUILD_EXTMOD)/modules.order should be read.

    I removed the single target %.ko from the top Makefile. To make sure
    modpost works correctly, vmlinux and the other modules must be built.
    You cannot build a particular .ko file alone.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

11 Apr, 2019

1 commit

  • Commit ea837f1c0503 ("kbuild: make modpost processing configurable")
    was intended to give KBUILD_MODPOST_WARN flexibility to be configurable.
    Right now KBUILD_MODPOST_WARN gets just ignored when KBUILD_EXTMOD is
    set which happens per default when building modules out of the tree.

    This change gives the opportunity to define module build behaving also
    in case of out of tree builds and default will become exit on error.
    Errors which can be detected by the build should be trapped out of the box
    there, unless somebody wants to notice broken stuff later at runtime.

    As this patch changes the default behaving from warning to error,
    users can consider to fix it for external module builds by:
    - providing module symbol table via KBUILD_EXTRA_SYMBOLS for
    modules which are dependent
    - OR getting old behaving back by passing KBUILD_MODPOST_WARN to the build

    Signed-off-by: Wladislav Wiebe
    Signed-off-by: Masahiro Yamada

    Wiebe, Wladislav (Nokia - DE/Ulm)
     

14 Mar, 2019

1 commit

  • Unless CONFIG_DEBUG_SECTION_MISMATCH is enabled, modpost only shows
    the number of section mismatches.

    If you want to know the symbols causing the issue, you need to rebuild
    with CONFIG_DEBUG_SECTION_MISMATCH. It is tedious.

    I think it is fine to show annoying warning when a new section mismatch
    comes in.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

28 Jan, 2019

1 commit

  • In Kbuild, if_changed and friends must have FORCE as a prerequisite.

    Hence, $(filter-out FORCE,$^) or $(filter-out $(PHONY),$^) is a common
    idiom to get the names of all the prerequisites except phony targets.

    Add real-prereqs as a shorthand.

    Note:
    We cannot replace $(filter %.o,$^) in cmd_link_multi-m because $^ may
    include auto-generated dependencies from the .*.cmd file when a single
    object module is changed into a multi object module. Refer to commit
    69ea912fda74 ("kbuild: remove unneeded link_multi_deps"). I added some
    comment to avoid accidental breakage.

    Signed-off-by: Masahiro Yamada
    Acked-by: Rob Herring

    Masahiro Yamada
     

24 Aug, 2018

1 commit

  • Commit a0f97e06a43c ("kbuild: enable 'make CFLAGS=...' to add
    additional options to CC") renamed CFLAGS to KBUILD_CFLAGS.

    Commit 222d394d30e7 ("kbuild: enable 'make AFLAGS=...' to add
    additional options to AS") renamed AFLAGS to KBUILD_AFLAGS.

    Commit 06c5040cdb13 ("kbuild: enable 'make CPPFLAGS=...' to add
    additional options to CPP") renamed CPPFLAGS to KBUILD_CPPFLAGS.

    For some reason, LDFLAGS was not renamed.

    Using a well-known variable like LDFLAGS may result in accidental
    override of the variable.

    Kbuild generally uses KBUILD_ prefixed variables for the internally
    appended options, so here is one more conversion to sanitize the
    naming convention.

    I did not touch Makefiles under tools/ since the tools build system
    is a different world.

    Signed-off-by: Masahiro Yamada
    Acked-by: Kirill A. Shutemov
    Reviewed-by: Palmer Dabbelt

    Masahiro Yamada
     

06 Jul, 2018

1 commit


18 Nov, 2017

1 commit

  • Pull Kbuild updates from Masahiro Yamada:
    "One of the most remarkable improvements in this cycle is, Kbuild is
    now able to cache the result of shell commands. Some variables are
    expensive to compute, for example, $(call cc-option,...) invokes the
    compiler. It is not efficient to redo this computation every time,
    even when we are not actually building anything. Kbuild creates a
    hidden file ".cache.mk" that contains invoked shell commands and their
    results. The speed-up should be noticeable.

    Summary:

    - Fix arch build issues (hexagon, sh)

    - Clean up various Makefiles and scripts

    - Fix wrong usage of {CFLAGS,LDFLAGS}_MODULE in arch Makefiles

    - Cache variables that are expensive to compute

    - Improve cc-ldopton and ld-option for Clang

    - Optimize output directory creation"

    * tag 'kbuild-v4.15' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (30 commits)
    kbuild: move coccicheck help from scripts/Makefile.help to top Makefile
    sh: decompressor: add shipped files to .gitignore
    frv: .gitignore: ignore vmlinux.lds
    selinux: remove unnecessary assignment to subdir-
    kbuild: specify FORCE in Makefile.headersinst as .PHONY target
    kbuild: remove redundant mkdir from ./Kbuild
    kbuild: optimize object directory creation for incremental build
    kbuild: create object directories simpler and faster
    kbuild: filter-out PHONY targets from "targets"
    kbuild: remove redundant $(wildcard ...) for cmd_files calculation
    kbuild: create directory for make cache only when necessary
    sh: select KBUILD_DEFCONFIG depending on ARCH
    kbuild: fix linker feature test macros when cross compiling with Clang
    kbuild: shrink .cache.mk when it exceeds 1000 lines
    kbuild: do not call cc-option before KBUILD_CFLAGS initialization
    kbuild: Cache a few more calls to the compiler
    kbuild: Add a cache for generated variables
    kbuild: add forward declaration of default target to Makefile.asm-generic
    kbuild: remove KBUILD_SUBDIR_ASFLAGS and KBUILD_SUBDIR_CCFLAGS
    hexagon/kbuild: replace CFLAGS_MODULE with KBUILD_CFLAGS_MODULE
    ...

    Linus Torvalds
     

16 Nov, 2017

1 commit


03 Nov, 2017

1 commit

  • …el/git/gregkh/driver-core

    Pull initial SPDX identifiers from Greg KH:
    "License cleanup: add SPDX license identifiers to some files

    Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the
    'GPL-2.0' SPDX license identifier. The SPDX identifier is a legally
    binding shorthand, which can be used instead of the full boiler plate
    text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart
    and Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset
    of the use cases:

    - file had no licensing information it it.

    - file was a */uapi/* one with no licensing information in it,

    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to
    license had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied
    to a file was done in a spreadsheet of side by side results from of
    the output of two independent scanners (ScanCode & Windriver)
    producing SPDX tag:value files created by Philippe Ombredanne.
    Philippe prepared the base worksheet, and did an initial spot review
    of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537
    files assessed. Kate Stewart did a file by file comparison of the
    scanner results in the spreadsheet to determine which SPDX license
    identifier(s) to be applied to the file. She confirmed any
    determination that was not immediately clear with lawyers working with
    the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:

    - Files considered eligible had to be source code files.

    - Make and config files were included as candidates if they contained
    >5 lines of source

    - File already had some variant of a license header in it (even if <5
    lines).

    All documentation files were explicitly excluded.

    The following heuristics were used to determine which SPDX license
    identifiers to apply.

    - when both scanners couldn't find any license traces, file was
    considered to have no license information in it, and the top level
    COPYING file license applied.

    For non */uapi/* files that summary was:

    SPDX license identifier # files
    ---------------------------------------------------|-------
    GPL-2.0 11139

    and resulted in the first patch in this series.

    If that file was a */uapi/* path one, it was "GPL-2.0 WITH
    Linux-syscall-note" otherwise it was "GPL-2.0". Results of that
    was:

    SPDX license identifier # files
    ---------------------------------------------------|-------
    GPL-2.0 WITH Linux-syscall-note 930

    and resulted in the second patch in this series.

    - if a file had some form of licensing information in it, and was one
    of the */uapi/* ones, it was denoted with the Linux-syscall-note if
    any GPL family license was found in the file or had no licensing in
    it (per prior point). Results summary:

    SPDX license identifier # files
    ---------------------------------------------------|------
    GPL-2.0 WITH Linux-syscall-note 270
    GPL-2.0+ WITH Linux-syscall-note 169
    ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
    ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
    LGPL-2.1+ WITH Linux-syscall-note 15
    GPL-1.0+ WITH Linux-syscall-note 14
    ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
    LGPL-2.0+ WITH Linux-syscall-note 4
    LGPL-2.1 WITH Linux-syscall-note 3
    ((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
    ((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1

    and that resulted in the third patch in this series.

    - when the two scanners agreed on the detected license(s), that
    became the concluded license(s).

    - when there was disagreement between the two scanners (one detected
    a license but the other didn't, or they both detected different
    licenses) a manual inspection of the file occurred.

    - In most cases a manual inspection of the information in the file
    resulted in a clear resolution of the license that should apply
    (and which scanner probably needed to revisit its heuristics).

    - When it was not immediately clear, the license identifier was
    confirmed with lawyers working with the Linux Foundation.

    - If there was any question as to the appropriate license identifier,
    the file was flagged for further research and to be revisited later
    in time.

    In total, over 70 hours of logged manual review was done on the
    spreadsheet to determine the SPDX license identifiers to apply to the
    source files by Kate, Philippe, Thomas and, in some cases,
    confirmation by lawyers working with the Linux Foundation.

    Kate also obtained a third independent scan of the 4.13 code base from
    FOSSology, and compared selected files where the other two scanners
    disagreed against that SPDX file, to see if there was new insights.
    The Windriver scanner is based on an older version of FOSSology in
    part, so they are related.

    Thomas did random spot checks in about 500 files from the spreadsheets
    for the uapi headers and agreed with SPDX license identifier in the
    files he inspected. For the non-uapi files Thomas did random spot
    checks in about 15000 files.

    In initial set of patches against 4.14-rc6, 3 files were found to have
    copy/paste license identifier errors, and have been fixed to reflect
    the correct identifier.

    Additionally Philippe spent 10 hours this week doing a detailed manual
    inspection and review of the 12,461 patched files from the initial
    patch version early this week with:

    - a full scancode scan run, collecting the matched texts, detected
    license ids and scores

    - reviewing anything where there was a license detected (about 500+
    files) to ensure that the applied SPDX license was correct

    - reviewing anything where there was no detection but the patch
    license was not GPL-2.0 WITH Linux-syscall-note to ensure that the
    applied SPDX license was correct

    This produced a worksheet with 20 files needing minor correction. This
    worksheet was then exported into 3 different .csv files for the
    different types of files to be modified.

    These .csv files were then reviewed by Greg. Thomas wrote a script to
    parse the csv files and add the proper SPDX tag to the file, in the
    format that the file expected. This script was further refined by Greg
    based on the output to detect more types of files automatically and to
    distinguish between header and source .c files (which need different
    comment types.) Finally Greg ran the script using the .csv files to
    generate the patches.

    Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
    Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
    Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>"

    * tag 'spdx_identifiers-4.14-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
    License cleanup: add SPDX license identifier to uapi header files with a license
    License cleanup: add SPDX license identifier to uapi header files with no license
    License cleanup: add SPDX GPL-2.0 license identifier to files with no license

    Linus Torvalds
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

07 Oct, 2017

1 commit


09 Sep, 2016

1 commit

  • Allow architectures to create arch/xxx/Makefile.postlink with targets
    for vmlinux, modules.ko, and clean, which will be invoked after final
    linking of vmlinux and modules.

    powerpc will use this to check vmlinux linker relocations for sanity,
    and may use it to fix up alternate instruction patch branch addresses.

    Signed-off-by: Nicholas Piggin
    Signed-off-by: Michal Marek

    Nicholas Piggin
     

06 Oct, 2015

1 commit

  • The section mismatch warning can be easy to miss during the kernel build
    process. Allow it to be marked as fatal to be easily caught and prevent
    bugs from slipping in.

    Setting CONFIG_SECTION_MISMATCH_WARN_ONLY=y causes these warnings to be
    non-fatal, since there are a number of section mismatches when using
    allmodconfig on some architectures, and we do not want to break these
    builds by default.

    Signed-off-by: Nicolas Boichat
    Change-Id: Ic346706e3297c9f0d790e3552aa94e5cff9897a6
    Signed-off-by: Rusty Russell

    Nicolas Boichat
     

23 Sep, 2013

1 commit

  • Commit ea4054a23 (modpost: handle huge numbers of modules) added
    support for building a large number of modules.

    Unfortunately, the commit changed the semantics of the makefile: Instead of
    passing only existing object files to modpost, make now passes all expected
    object files. If make was started with option -i, this results in a modpost
    error if a single file failed to build.

    Example with the current btrfs build falure on m68k:

    fs/btrfs/btrfs.o: No such file or directory
    make[1]: [__modpost] Error 1 (ignored)

    This error is followed by lots of errors such as:

    m68k-linux-gcc: error: arch/m68k/emu/nfcon.mod.c: No such file or directory
    m68k-linux-gcc: fatal error: no input files
    compilation terminated.
    make[1]: [arch/m68k/emu/nfcon.mod.o] Error 1 (ignored)

    This doesn't matter much for normal builds, but it is annoying for builds
    started with "make -i" due to the large number of secondary errors.
    Those errors unnececessarily clog any error log and make it difficult
    to find the real errors in the build.

    Fix the problem by adding a new parameter '-n' to modpost. If this parameter
    is specified, modpost reports but ignores missing object files.

    With this patch, error output from above problem is (with make -i):

    m68k-linux-ld: cannot find fs/btrfs/ioctl.o: No such file or directory
    make[2]: [fs/btrfs/btrfs.o] Error 1 (ignored)
    ...
    fs/btrfs/btrfs.o: No such file or directory (ignored)

    Cc: Rusty Russell
    Cc: Michael Marek
    Signed-off-by: Guenter Roeck
    Signed-off-by: Rusty Russell

    Guenter Roeck
     

05 Apr, 2013

1 commit

  • strace shows:
    72102 execve("/bin/sh", ["/bin/sh", "-c", "echo ' scripts/mod/modpost -m -a
    -o /cc/wfg/sound-compiletest/Module.symvers -s'; scripts/
    mod/modpost -m -a -o /cc/wfg/sound-compiletest/Module.symvers -s vmlinux
    arch/x86/crypto/ablk_helper.o arch/x86/crypto/aes-i586.o arch
    /x86/crypto/aesni-intel.o arch/x86/crypto/crc32-pclmul.o
    ...
    drivers/ata/sata_promise.o "...], [/* 119 vars */]
    71827 wait4(-1,
    72102 ) = -1 E2BIG (Argument list too long)

    So we re-run the shell command which produces the list and feed it into modpost -T -.

    Reported-by: Fengguang Wu
    Signed-off-by: Rusty Russell

    Rusty Russell
     

25 Jan, 2013

1 commit


19 Oct, 2012

1 commit

  • Linus deleted the old code and put signing on the install command,
    I fixed it to extract the keyid and signer-name within sign-file
    and cleaned up that script now it always signs in-place.

    Some enthusiast should convert sign-key to perl and pull
    x509keyid into it.

    Signed-off-by: Rusty Russell
    Signed-off-by: Linus Torvalds

    Rusty Russell
     

15 Oct, 2012

1 commit

  • Pull module signing support from Rusty Russell:
    "module signing is the highlight, but it's an all-over David Howells frenzy..."

    Hmm "Magrathea: Glacier signing key". Somebody has been reading too much HHGTTG.

    * 'modules-next' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux: (37 commits)
    X.509: Fix indefinite length element skip error handling
    X.509: Convert some printk calls to pr_devel
    asymmetric keys: fix printk format warning
    MODSIGN: Fix 32-bit overflow in X.509 certificate validity date checking
    MODSIGN: Make mrproper should remove generated files.
    MODSIGN: Use utf8 strings in signer's name in autogenerated X.509 certs
    MODSIGN: Use the same digest for the autogen key sig as for the module sig
    MODSIGN: Sign modules during the build process
    MODSIGN: Provide a script for generating a key ID from an X.509 cert
    MODSIGN: Implement module signature checking
    MODSIGN: Provide module signing public keys to the kernel
    MODSIGN: Automatically generate module signing keys if missing
    MODSIGN: Provide Kconfig options
    MODSIGN: Provide gitignore and make clean rules for extra files
    MODSIGN: Add FIPS policy
    module: signature checking hook
    X.509: Add a crypto key parser for binary (DER) X.509 certificates
    MPILIB: Provide a function to read raw data into an MPI
    X.509: Add an ASN.1 decoder
    X.509: Add simple ASN.1 grammar compiler
    ...

    Linus Torvalds
     

10 Oct, 2012

1 commit

  • If CONFIG_MODULE_SIG is set, then this patch will cause all modules files to
    to have signatures added. The following steps will occur:

    (1) The module will be linked to foo.ko.unsigned instead of foo.ko

    (2) The module will be stripped using both "strip -x -g" and "eu-strip" to
    ensure minimal size for inclusion in an initramfs.

    (3) The signature will be generated on the stripped module.

    (4) The signature will be appended to the module, along with some information
    about the signature and a magic string that indicates the presence of the
    signature.

    Step (3) requires private and public keys to be available. By default these
    are expected to be found in files:

    signing_key.priv
    signing_key.x509

    in the base directory of the build. The first is the private key in PEM form
    and the second is the X.509 certificate in DER form as can be generated from
    openssl:

    openssl req \
    -new -x509 -outform PEM -out signing_key.x509 \
    -keyout signing_key.priv -nodes \
    -subj "/CN=H2G2/O=Magrathea/CN=Slartibartfast"

    If the secret key is not found then signing will be skipped and the unsigned
    module from (1) will just be copied to foo.ko.

    If signing occurs, lines like the following will be seen:

    LD [M] fs/foo/foo.ko.unsigned
    STRIP [M] fs/foo/foo.ko.stripped
    SIGN [M] fs/foo/foo.ko

    will appear in the build log. If the signature step will be skipped and the
    following will be seen:

    LD [M] fs/foo/foo.ko.unsigned
    STRIP [M] fs/foo/foo.ko.stripped
    NO SIGN [M] fs/foo/foo.ko

    NOTE! After the signature step, the signed module _must_not_ be passed through
    strip. The unstripped, unsigned module is still available at the name on the
    LD [M] line. This restriction may affect packaging tools (such as rpmbuild)
    and initramfs composition tools.

    Signed-off-by: David Howells
    Signed-off-by: Rusty Russell

    David Howells
     

31 Aug, 2012

1 commit

  • This error may happen when the user's id or path includes .ko string.
    For example, user's id is xxx.ko and building test.ko module,
    the test.mod file lists ko name and all object files.
    /home/xxx.ko/kernel_dev/device/drivers/test.ko
    /home/xxx.ko/kernel_dev/device/drivers/test_main.o
    /home/xxx.ko/kernel_dev/device/drivers/test_io.o ...
    Current Makefile.modpost and Makefile.modinst find and list up not
    only test.ko but also other object files.
    because all of object file's path includes .ko string.
    This is a patch to fix it.

    Signed-off-by: Gunho Lee
    Signed-off-by: Michal Marek

    이건호
     

07 Jun, 2011

1 commit


25 May, 2011

1 commit


31 Mar, 2011

1 commit


03 Aug, 2010

2 commits

  • Signed-off-by: Uwe Kleine-König
    Signed-off-by: Michal Marek

    Uwe Kleine-König
     
  • It is now possible to assign options to AS, CC and LD
    on the command line - which is only used when building modules.

    {A,C,LD}FLAGS_MODULE was all used both in the top-level Makefile
    in the arch makefiles, thus users had no way to specify
    additional options to AS, CC, LD when building modules
    without overriding the original value.

    Introduce a new set of variables KBUILD_{A,C,LD}FLAGS_MODULE
    that is used by arch specific files and free up
    {A,C,LD}FLAGS_MODULE so they can be assigned on
    the command line.

    All arch Makefiles that used the old variables has been updated.

    Note: Previously we had a MODFLAGS variable for both
    AS and CC. But in favour of consistency this was dropped.
    So in some cases arch Makefile has one assignmnet replaced by
    two assignmnets.

    Note2: MODFLAGS was not documented and is dropped
    without any notice. I do not expect much/any breakage
    from this.

    Signed-off-by: Sam Ravnborg
    Cc: Denys Vlasenko
    Cc: Haavard Skinnemoen
    Cc: Mike Frysinger
    Cc: Tony Luck
    Cc: Geert Uytterhoeven
    Cc: Ralf Baechle
    Cc: Benjamin Herrenschmidt
    Cc: Martin Schwidefsky
    Cc: Chen Liqin
    Acked-by: Mike Frysinger [blackfin]
    Acked-by: Haavard Skinnemoen [avr32]
    Signed-off-by: Michal Marek

    Sam Ravnborg
     

19 Sep, 2009

1 commit

  • Now that the last users of markers have migrated to the event
    tracer we can kill off the (now orphan) support code.

    Signed-off-by: Christoph Hellwig
    Acked-by: Mathieu Desnoyers
    Cc: Steven Rostedt
    Cc: Frederic Weisbecker
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Christoph Hellwig
     

30 Oct, 2008

1 commit

  • Taken from http://bugzilla.kernel.org/show_bug.cgi?id=11567

    If you even define KBUILD_EXTRA_SYMBOLS in Makefile it will not be expanded
    into command line argument for modpost.

    Signed-off-by: Andrew Morton
    Signed-off-by: Sam Ravnborg

    Peter Volkov
     

23 Jul, 2008

1 commit

  • When a kernel was rebuilt, the previous Module.markers was not cleared.
    It caused markers with different format strings to appear as duplicates
    when a markers was changed. This problem is present since
    scripts/mod/modpost.c started to generate Module.markers, commit
    b2e3e658b344c6bcfb8fb694100ab2f2b5b2edb0

    It therefore applies to 2.6.25, 2.6.26 and linux-next.

    I merely merged the patches from Roland, Wenji and Takashi here.

    Credits to
    Roland McGrath
    Wenji Huang
    and
    Takashi Nishiie

    for providing the individual fixes.

    - Changelog :
    - Integrated Takashi's Makefile modification to clear Module.markers upon
    make clean.

    Signed-off-by: Mathieu Desnoyers
    Cc: Roland McGrath
    Cc: Wenji Huang
    Cc: Takashi Nishiie
    Cc: [2.6.25.x, 2.6.26.x]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mathieu Desnoyers