16 Oct, 2016

1 commit

  • Pull gcc plugins update from Kees Cook:
    "This adds a new gcc plugin named "latent_entropy". It is designed to
    extract as much possible uncertainty from a running system at boot
    time as possible, hoping to capitalize on any possible variation in
    CPU operation (due to runtime data differences, hardware differences,
    SMP ordering, thermal timing variation, cache behavior, etc).

    At the very least, this plugin is a much more comprehensive example
    for how to manipulate kernel code using the gcc plugin internals"

    * tag 'gcc-plugins-v4.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
    latent_entropy: Mark functions with __latent_entropy
    gcc-plugins: Add latent_entropy plugin

    Linus Torvalds
     

15 Oct, 2016

2 commits

  • Pull misc kbuild changes from Michal Marek:
    "Just a few patches on the kbuild.git#misc branch this time:

    - New Coccinelle patch by Nicholas Mc Guire
    - Existing patch fixes by Julia Lawall
    - Minor comment fix by Markus Elfring"

    * 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
    Coccinelle: flag conditions with no effect
    scripts/coccicheck: Update reference for the corresponding documentation
    Coccinelle: pm_runtime: ensure relevance of pm_runtime reports
    Coccinelle: limit memdup_user transformation to GFP_KERNEL case

    Linus Torvalds
     
  • Pull kbuild updates from Michal Marek:

    - EXPORT_SYMBOL for asm source by Al Viro.

    This does bring a regression, because genksyms no longer generates
    checksums for these symbols (CONFIG_MODVERSIONS). Nick Piggin is
    working on a patch to fix this.

    Plus, we are talking about functions like strcpy(), which rarely
    change prototypes.

    - Fixes for PPC fallout of the above by Stephen Rothwell and Nick
    Piggin

    - fixdep speedup by Alexey Dobriyan.

    - preparatory work by Nick Piggin to allow architectures to build with
    -ffunction-sections, -fdata-sections and --gc-sections

    - CONFIG_THIN_ARCHIVES support by Stephen Rothwell

    - fix for filenames with colons in the initramfs source by me.

    * 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: (22 commits)
    initramfs: Escape colons in depfile
    ppc: there is no clear_pages to export
    powerpc/64: whitelist unresolved modversions CRCs
    kbuild: -ffunction-sections fix for archs with conflicting sections
    kbuild: add arch specific post-link Makefile
    kbuild: allow archs to select link dead code/data elimination
    kbuild: allow architectures to use thin archives instead of ld -r
    kbuild: Regenerate genksyms lexer
    kbuild: genksyms fix for typeof handling
    fixdep: faster CONFIG_ search
    ia64: move exports to definitions
    sparc32: debride memcpy.S a bit
    [sparc] unify 32bit and 64bit string.h
    sparc: move exports to definitions
    ppc: move exports to definitions
    arm: move exports to definitions
    s390: move exports to definitions
    m68k: move exports to definitions
    alpha: move exports to actual definitions
    x86: move exports to actual definitions
    ...

    Linus Torvalds
     

12 Oct, 2016

14 commits

  • Vim, with the omnicppcomplete(#1) plugin, can do code completion using
    information build by ctags. Add flags needed by omnicppcomplete(#2) to
    have completion on member of structure.

    1: https://github.com/vim-scripts/omnicppcomplete
    2: https://github.com/vim-scripts/OmniCppComplete/blob/master/doc/omnicppcomplete.txt#L93

    Link: http://lkml.kernel.org/r/20160830191546.4469-1-mathieu.maret@gmail.com
    Signed-off-by: Mathieu Maret
    Cc: Michal Marek
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mathieu Maret
     
  • The function calls with octal permissions commonly span multiple lines.
    The current test is line oriented and fails to find some matches.

    Make the test use the $stat variable instead of the $line variable to span
    multiple lines.

    Also add a few functions to the known functions with permissions list.

    Move the SYMBOLIC_PERMS test to a separate section to find all the S_
    permissions in any form not just those that have specific function names.

    This can now find and fix permissions uses like:
    .mode = S_ | S_;

    Link: http://lkml.kernel.org/r/b51bab60530912aae4ac420119d465c5b206f19f.1475030406.git.joe@perches.com
    Signed-off-by: Joe Perches
    Tested-by: Ramiro Oliveira
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Function definitions without identifiers like
    int foo(int)
    are not preferred. Emit a warning when they occur.

    Link: http://lkml.kernel.org/r/94fe6378504745991b650f48fc92bb4648f25706.1474925354.git.joe@perches.com
    Signed-off-by: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • It is possible for a multiple line macro definition to have a false positive
    report when an argument is used on a line after a continuation \.

    This line might have a leading '+' as the initial character that could be
    confused by checkpatch as an operator.

    Avoid the leading character on multiple line macro definitions.

    Link: http://lkml.kernel.org/r/60229d13399f9b6509db5a32e30d4c16951a60cd.1473836073.git.joe@perches.com
    Signed-off-by: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Add a test for macro arguents that have a non-comma leading or trailing
    operator where the argument isn't parenthesized to avoid possible precedence
    issues.

    Link: http://lkml.kernel.org/r/47715508972f8d786f435e583ff881dbeee3a114.1473745855.git.joe@perches.com
    Signed-off-by: Joe Perches
    Cc: Andy Whitcroft
    Cc: Julia Lawall
    Cc: Dan Carpenter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • If a macro argument is used multiple times in the macro definition, the
    macro argument may have an unexpected side-effect.

    Add a test (MACRO_ARG_REUSE) for that condition which is only
    emitted with command-line option --strict.

    Link: http://lkml.kernel.org/r/b6d67a87cafcafd15499e91780dc63b15dec0aa0.1473744906.git.joe@perches.com
    Signed-off-by: Joe Perches
    Cc: Andy Whitcroft
    Cc: Julia Lawall
    Cc: Dan Carpenter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • An "uninitialized value" is emitted when a block comment starts on
    the same line as a statement.

    Fix this and make the test use a little fewer cpu cycles too.

    Link: http://lkml.kernel.org/r/3c9993320c2182d37f53ac540878cfef59c3f62d.1473365956.git.joe@perches.com
    Signed-off-by: Joe Perches
    Reported-by: Charlemagne Lasse
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Adding -f to the get_maintainer.pl invocation means git isn't invoked
    by get_maintainer.pl for known filenames.

    This reduces the overall time to run checkpatch.

    Link: http://lkml.kernel.org/r/22991e3a295aeb399b43af0478b6e5809106ccee.1472684066.git.joe@perches.com
    Signed-off-by: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Using const is generally a good idea.

    Julia Lawall has created a list of always const and almost always const
    structs in the kernel sources.

    Link: https://lkml.org/lkml/2016/8/28/95

    Add the most frequently used (> 50 cases) that are almost always or
    always const.

    Link: http://lkml.kernel.org/r/1e16020f8027654db0095bbfbcc11da51025365c.1472664220.git.joe@perches.com
    Signed-off-by: Joe Perches
    Acked-by: Kees Cook
    Cc: Julia Lawall
    Cc: Andy Whitcroft
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Make it easier to add new structs that should be const.

    Link: http://lkml.kernel.org/r/e5a8da43e7c11525bafbda1ca69a8323614dd942.1472664220.git.joe@perches.com
    Signed-off-by: Joe Perches
    Cc: Julia Lawall
    Cc: Kees Cook
    Cc: Andy Whitcroft
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • < sigh > Comment these tests out.

    These are just too enticing to people that don't verify that
    both source and dest addresses really must be __aligned(2).

    It helps make Dan Carpenter happy too.

    Link: http://lkml.kernel.org/r/dc32ec66d24647f4cdf824c8dfbbc59aa7ce7b7d.1472665676.git.joe@perches.com
    Signed-off-by: Joe Perches
    Cc: Dan Carpenter
    Cc: Greg
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Warn when block comments are not aligned on the *

    /*
    * block comment, no warning
    */

    /*
    * block comment, emit warning
    */

    Link: http://lkml.kernel.org/r/edb57bd330adfe024b95ec2a807d4aa7f0c8b112.1472261299.git.joe@perches.com
    Signed-off-by: Joe Perches
    Reported-by: Sudip Mukherjee
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • S_ uses should be avoided where octal is more intelligible.

    Linus didst say:

    : It's *much* easier to parse and understand the octal numbers, while the
    : symbolic macro names are just random line noise and hard as hell to
    : understand. You really have to think about it.
    :
    : So we should rather go the other way: convert existing bad symbolic
    : permission bit macro use to just use the octal numbers.
    :
    : The symbolic names are good for the *other* bits (ie sticky bit, and the
    : inode mode _type_ numbers etc), but for the permission bits, the symbolic
    : names are just insane crap. Nobody sane should ever use them. Not in the
    : kernel, not in user space.
    (http://lkml.kernel.org/r/CA+55aFw5v23T-zvDZp-MmD_EYxF8WbafwwB59934FV7g21uMGQ@mail.gmail.com)

    Link: http://lkml.kernel.org/r/7232ef011d05a92f4caa86a5e9830d87966a2eaf.1470180926.git.joe@perches.com
    Signed-off-by: Joe Perches
    Cc: Linus Torvalds
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Use get_maintainer to check the status of individual files. If
    "obsolete", suggest leaving the files alone.

    Link: http://lkml.kernel.org/r/7ceaa510dc9d2df05ec4b456baed7bb1415550b3.1471889575.git.joe@perches.com
    Signed-off-by: Joe Perches
    Cc: SF Markus Elfring
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     

11 Oct, 2016

3 commits

  • Report code constructs where the if and else branch are functionally
    identical. In cases where this is intended it really should be
    documented - most reported cases probably are bugs.

    Signed-off-by: Nicholas Mc Guire
    Signed-off-by: Michal Marek

    Nicholas Mc Guire
     
  • Use the current name (in a comment at the beginning of this script) for
    the file which was converted to the documentation format "reStructuredText"
    in August 2016.

    Fixes: 4b9033a33494 ("docs: sphinxify coccinelle.txt and add it to dev-tools")
    Signed-off-by: Markus Elfring
    Acked-by: Julia Lawall
    Signed-off-by: Michal Marek

    Markus Elfring
     
  • This adds a new gcc plugin named "latent_entropy". It is designed to
    extract as much possible uncertainty from a running system at boot time as
    possible, hoping to capitalize on any possible variation in CPU operation
    (due to runtime data differences, hardware differences, SMP ordering,
    thermal timing variation, cache behavior, etc).

    At the very least, this plugin is a much more comprehensive example for
    how to manipulate kernel code using the gcc plugin internals.

    The need for very-early boot entropy tends to be very architecture or
    system design specific, so this plugin is more suited for those sorts
    of special cases. The existing kernel RNG already attempts to extract
    entropy from reliable runtime variation, but this plugin takes the idea to
    a logical extreme by permuting a global variable based on any variation
    in code execution (e.g. a different value (and permutation function)
    is used to permute the global based on loop count, case statement,
    if/then/else branching, etc).

    To do this, the plugin starts by inserting a local variable in every
    marked function. The plugin then adds logic so that the value of this
    variable is modified by randomly chosen operations (add, xor and rol) and
    random values (gcc generates separate static values for each location at
    compile time and also injects the stack pointer at runtime). The resulting
    value depends on the control flow path (e.g., loops and branches taken).

    Before the function returns, the plugin mixes this local variable into
    the latent_entropy global variable. The value of this global variable
    is added to the kernel entropy pool in do_one_initcall() and _do_fork(),
    though it does not credit any bytes of entropy to the pool; the contents
    of the global are just used to mix the pool.

    Additionally, the plugin can pre-initialize arrays with build-time
    random contents, so that two different kernel builds running on identical
    hardware will not have the same starting values.

    Signed-off-by: Emese Revfy
    [kees: expanded commit message and code comments]
    Signed-off-by: Kees Cook

    Emese Revfy
     

08 Oct, 2016

2 commits

  • No need to correct the correct.

    Link: http://lkml.kernel.org/r/1472490791.3425.38.camel@perches.com
    Signed-off-by: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • When doing an nmi backtrace of many cores, most of which are idle, the
    output is a little overwhelming and very uninformative. Suppress
    messages for cpus that are idling when they are interrupted and just
    emit one line, "NMI backtrace for N skipped: idling at pc 0xNNN".

    We do this by grouping all the cpuidle code together into a new
    .cpuidle.text section, and then checking the address of the interrupted
    PC to see if it lies within that section.

    This commit suitably tags x86 and tile idle routines, and only adds in
    the minimal framework for other architectures.

    Link: http://lkml.kernel.org/r/1472487169-14923-5-git-send-email-cmetcalf@mellanox.com
    Signed-off-by: Chris Metcalf
    Acked-by: Peter Zijlstra (Intel)
    Tested-by: Peter Zijlstra (Intel)
    Tested-by: Daniel Thompson [arm]
    Tested-by: Petr Mladek
    Cc: Aaron Tomlin
    Cc: Peter Zijlstra (Intel)
    Cc: "Rafael J. Wysocki"
    Cc: Russell King
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Chris Metcalf
     

07 Oct, 2016

1 commit

  • Pull tracing updates from Steven Rostedt:
    "This release cycle is rather small. Just a few fixes to tracing.

    The big change is the addition of the hwlat tracer. It not only
    detects SMIs, but also other latency that's caused by the hardware. I
    have detected some latency from large boxes having bus contention"

    * tag 'trace-v4.9' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
    tracing: Call traceoff trigger after event is recorded
    ftrace/scripts: Add helper script to bisect function tracing problem functions
    tracing: Have max_latency be defined for HWLAT_TRACER as well
    tracing: Add NMI tracing in hwlat detector
    tracing: Have hwlat trace migrate across tracing_cpumask CPUs
    tracing: Add documentation for hwlat_detector tracer
    tracing: Added hardware latency tracer
    ftrace: Access ret_stack->subtime only in the function profiler
    function_graph: Handle TRACE_BPUTS in print_graph_comment
    tracing/uprobe: Drop isdigit() check in create_trace_uprobe

    Linus Torvalds
     

05 Oct, 2016

2 commits

  • Pull s390 updates from Martin Schwidefsky:
    "The new features and main improvements in this merge for v4.9

    - Support for the UBSAN sanitizer

    - Set HAVE_EFFICIENT_UNALIGNED_ACCESS, it improves the code in some
    places

    - Improvements for the in-kernel fpu code, in particular the overhead
    for multiple consecutive in kernel fpu users is recuded

    - Add a SIMD implementation for the RAID6 gen and xor operations

    - Add RAID6 recovery based on the XC instruction

    - The PCI DMA flush logic has been improved to increase the speed of
    the map / unmap operations

    - The time synchronization code has seen some updates

    And bug fixes all over the place"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: (48 commits)
    s390/con3270: fix insufficient space padding
    s390/con3270: fix use of uninitialised data
    MAINTAINERS: update DASD maintainer
    s390/cio: fix accidental interrupt enabling during resume
    s390/dasd: add missing \n to end of dev_err messages
    s390/config: Enable config options for Docker
    s390/dasd: make query host access interruptible
    s390/dasd: fix panic during offline processing
    s390/dasd: fix hanging offline processing
    s390/pci_dma: improve lazy flush for unmap
    s390/pci_dma: split dma_update_trans
    s390/pci_dma: improve map_sg
    s390/pci_dma: simplify dma address calculation
    s390/pci_dma: remove dma address range check
    iommu/s390: simplify registration of I/O address translation parameters
    s390: migrate exception table users off module.h and onto extable.h
    s390: export header for CLP ioctl
    s390/vmur: fix irq pointer dereference in int handler
    s390/dasd: add missing KOBJ_CHANGE event for unformatted devices
    s390: enable UBSAN
    ...

    Linus Torvalds
     
  • Pull documentation updates from Jonathan Corbet:
    "This is the documentation update pull for the 4.9 merge window.

    The Sphinx transition is still creating a fair amount of work. Here we
    have a number of fixes and, importantly, a proper PDF output solution,
    thanks to Jani Nikula, Mauro Carvalho Chehab and Markus Heiser.

    I've started a couple of new books: a driver API book (based on the
    old device-drivers.tmpl) and a development tools book. Both are meant
    to show how we can integrate together our existing documentation into
    a more coherent and accessible whole. It involves moving some stuff
    around and formatting changes, but, I think, the results are worth it.
    The good news is that most of our existing Documentation/*.txt files
    are *almost* in RST format already; the amount of messing around
    required is minimal.

    And, of course, there's the usual set of updates, typo fixes, and
    more"

    * tag 'docs-4.9' of git://git.lwn.net/linux: (120 commits)
    URL changed for Linux Foundation TAB
    dax : Fix documentation with respect to struct pages
    iio: Documentation: Correct the path used to create triggers.
    docs: Remove space-before-label guidance from CodingStyle
    docs-rst: add inter-document cross references
    Documentation/email-clients.txt: convert it to ReST markup
    Documentation/kernel-docs.txt: reorder based on timestamp
    Documentation/kernel-docs.txt: Add dates for online docs
    Documentation/kernel-docs.txt: get rid of broken docs
    Documentation/kernel-docs.txt: move in-kernel docs
    Documentation/kernel-docs.txt: remove more legacy references
    Documentation/kernel-docs.txt: add two published books
    Documentation/kernel-docs.txt: sort books per publication date
    Documentation/kernel-docs.txt: adjust LDD references
    Documentation/kernel-docs.txt: some improvements on the ReST output
    Documentation/kernel-docs.txt: Consistent indenting: 4 spaces
    Documentation/kernel-docs.txt: Add 4 paper/book references
    Documentation/kernel-docs.txt: Improve layouting of book list
    Documentation/kernel-docs.txt: Remove offline or outdated entries
    docs: Clean up bare :: lines
    ...

    Linus Torvalds
     

04 Oct, 2016

1 commit

  • Pull char/misc driver updates from Greg KH:
    "Here's the "big" char and misc driver update for 4.9-rc1.

    Lots of little things here, all over the driver tree for subsystems
    that flow through me. Nothing major that I can discern, full details
    are in the shortlog.

    All have been in the linux-next tree with no reported issues"

    * tag 'char-misc-4.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (144 commits)
    drivers/misc/hpilo: Changes to support new security states in iLO5 FW
    at25: fix debug and error messaging
    misc/genwqe: ensure zero initialization
    vme: fake: remove unexpected unlock in fake_master_set()
    vme: fake: mark symbols static where possible
    spmi: pmic-arb: Return an error code if sanity check fails
    Drivers: hv: get rid of id in struct vmbus_channel
    Drivers: hv: make VMBus bus ids persistent
    mcb: Add a dma_device to mcb_device
    mcb: Enable PCI bus mastering by default
    mei: stop the stall timer worker if not needed
    clk: probe common clock drivers earlier
    vme: fake: fix build for 64-bit dma_addr_t
    ttyprintk: Neaten and simplify printing
    mei: me: add kaby point device ids
    coresight: tmc: mark symbols static where possible
    coresight: perf: deal with error condition properly
    Drivers: hv: hv_util: Avoid dynamic allocation in time synch
    fpga manager: Add hardware dependency to Zynq driver
    Drivers: hv: utils: Support TimeSync version 4.0 protocol samples.
    ...

    Linus Torvalds
     

02 Oct, 2016

2 commits

  • pm_runtime.cocci starts with one rule that searches for a variety of
    functions calls, followed by various rules that report errors. Previously,
    the only connection between the first rule and the rest was to check that
    the first rule had matched somewhere. Change the rules to propagate a
    position from the first rule to the others, to make sure that the sites
    reported on are the same as the sites that were identified as having the
    relevant functions.

    Signed-off-by: Julia Lawall
    Signed-off-by: Michal Marek

    Julia Lawall
     
  • Memdup_user encapsulates a memory allocation with the flag GFP_KERNEL, so
    only allow this flag in the original code.

    Signed-off-by: Julia Lawall
    Signed-off-by: Michal Marek

    Julia Lawall
     

29 Sep, 2016

1 commit

  • be7635e7287e ("arch, ftrace: for KASAN put hard/soft IRQ entries into
    separate sections") added .softirqentry.text section, but it was not added
    to recordmcount. So functions in the section are untracable. Add the
    section to scripts/recordmcount.c and scripts/recordmcount.pl.

    Fixes: be7635e7287e ("arch, ftrace: for KASAN put hard/soft IRQ entries into separate sections")
    Link: http://lkml.kernel.org/r/1474902626-73468-1-git-send-email-dvyukov@google.com
    Signed-off-by: Dmitry Vyukov
    Acked-by: Steve Rostedt
    Cc: [4.6+]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dmitry Vyukov
     

23 Sep, 2016

1 commit


22 Sep, 2016

1 commit

  • Every so often, with a special config or a architecture change, running
    function or function_graph tracing can cause the machien to hard reboot,
    crash, or simply hard lockup. There's some functions in the function graph
    tracer that can not be traced otherwise it causes the function tracer to
    recurse before the recursion protection mechanisms are in place.

    When this occurs, using the dynamic ftrace featuer that allows limiting what
    actually gets traced can be used to bisect down to the problem function.
    This adds a script that helps with this process in the scripts/tracing
    directory, called ftrace-bisect.sh

    The set up is to read all the functions that can be traced from
    available_filter_functions into a file (full_file). Then run this script
    passing it the full_file and a "test_file" and "non_test_file", where the
    test_file will be add to set_ftrace_filter. What ftarce_bisect.sh does, is
    to copy half of the functions in full_file into the test_file and the other
    half into the non_test_file. This way, one can cat the test_file into the
    set_ftrace_filter functions and only test the functions that are in that
    file. If it works, then we run the process again after copying non_test_file
    to full_file and repeating the process. If the system crashed, then the bad
    function is in the test_file and after a reboot, the test_file becomes the
    new full_file in the next iteration.

    When we get down to a single function in the full_file, then
    ftrace_bisect.sh will report that as the bad function.

    Full documentation of how to use this simple script is within the script
    file itself.

    Link: http://lkml.kernel.org/r/20160920100716.131d3647@gandalf.local.home

    Signed-off-by: Steven Rostedt

    Steven Rostedt (Red Hat)
     

20 Sep, 2016

3 commits

  • Some architectures use a hardware defined structure at address zero.
    Checking for a null pointer will result in many ubsan reports.
    Allow users to disable the null sanitizer.

    Signed-off-by: Christian Borntraeger
    Acked-by: Andrey Ryabinin
    Signed-off-by: Heiko Carstens
    Signed-off-by: Martin Schwidefsky

    Christian Borntraeger
     
  • Due to our compiler include directives, the build pathnames for header
    files often end up being of the form "$srcdir/./include/linux/xyz.h",
    which ends up having that extra "." path component after the build base
    in it.

    Teach faddr2line to skip that too, to make code generated in inline
    functions in header files match the filename for the regular C files.

    Rabin Vincent pointed out that I can't make a stricter regexp match by
    using the " at " prefix for the pathname, because that ends up being
    locale-dependent. But this does require that the path match be preceded
    by a space, to make it a bit more strict (that matters mainly if we
    didn't find any base_dir at all, and we only end up with the "./" part
    of the match)

    Acked-by: Josh Poimboeuf
    Cc: Rabin Vincent
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     
  • addr2line doesn't work with KASLR addresses. Add a basic addr2line
    wrapper script which takes the 'func+offset/size' format as input.

    Signed-off-by: Josh Poimboeuf
    Signed-off-by: Linus Torvalds

    Josh Poimboeuf
     

09 Sep, 2016

2 commits

  • 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
     
  • ld -r is an incremental link used to create built-in.o files in build
    subdirectories. It produces relocatable object files containing all
    its input files, and these are are then pulled together and relocated
    in the final link. Aside from the bloat, this constrains the final
    link relocations, which has bitten large powerpc builds with
    unresolvable relocations in the final link.

    Alan Modra has recommended the kernel use thin archives for linking.
    This is an alternative and means that the linker has more information
    available to it when it links the kernel.

    This patch enables a config option architectures can select, which
    causes all built-in.o files to be built as thin archives. built-in.o
    files in subdirectories do not get symbol table or index attached,
    which improves speed and size. The final link pass creates a
    built-in.o archive in the root output directory which includes the
    symbol table and index. The linker then uses takes this file to link.

    The --whole-archive linker option is required, because the linker now
    has visibility to every individual object file, and it will otherwise
    just completely avoid including those without external references
    (consider a file with EXPORT_SYMBOL or initcall or hardware exceptions
    as its only entry points). The traditional built works "by luck" as
    built-in.o files are large enough that they're going to get external
    references. However this optimisation is unpredictable for the kernel
    (due to above external references), ineffective at culling unused, and
    costly because the .o files have to be searched for references.
    Superior alternatives for link-time culling should be used instead.

    Build characteristics for inclink vs thinarc, on a small powerpc64le
    pseries VM with a modest .config:

    inclink thinarc
    sizes
    vmlinux 15 618 680 15 625 028
    sum of all built-in.o 56 091 808 1 054 334
    sum excluding root built-in.o 151 430

    find -name built-in.o | xargs rm ; time make vmlinux
    real 22.772s 21.143s
    user 13.280s 13.430s
    sys 4.310s 2.750s

    - Final kernel pulled in only about 6K more, which shows how
    ineffective the object file culling is.
    - Build performance looks improved due to less pagecache activity.
    On IO constrained systems it could be a bigger win.
    - Build size saving is significant.

    Side note, the toochain understands archives, so there's some tricks,
    $ ar t built-in.o # list all files you linked with
    $ size built-in.o # and their sizes
    $ objdump -d built-in.o # disassembly (unrelocated) with filenames

    Implementation by sfr, minor tweaks by npiggin.

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

    Stephen Rothwell
     

06 Sep, 2016

3 commits


05 Sep, 2016

1 commit