05 Dec, 2016

1 commit


03 Dec, 2016

1 commit

  • When building a specific target such as bzImage, modules aren't normally
    built. However if CONFIG_TRIM_UNUSED_KSYMS is enabled, no built modules
    means none of the exported symbols are used and therefore they will all
    be trimmed away from the final kernel. A subsequent "make modules" will
    fail because modpost cannot find the needed symbols for those modules in
    the kernel binary.

    Let's make sure modules are also built whenever CONFIG_TRIM_UNUSED_KSYMS
    is enabled and that the kernel binary is properly rebuilt accordingly.

    Signed-off-by: Nicolas Pitre
    Tested-by: Jarod Wilson
    Signed-off-by: Linus Torvalds

    Nicolas Pitre
     

02 Dec, 2016

1 commit

  • Some people are able to trigger a race where autoksyms.h is used before
    its empty version is even created. Let's create it at the same time as
    the directory holding it is created.

    Signed-off-by: Nicolas Pitre
    Tested-by: Prarit Bhargava
    Tested-by: Jarod Wilson
    Signed-off-by: Linus Torvalds

    Nicolas Pitre
     

28 Nov, 2016

1 commit


21 Nov, 2016

1 commit


19 Nov, 2016

1 commit

  • Pull kbuild fixes from Michal Marek:
    "Here are some regression fixes for kbuild:

    - modversion support for exported asm symbols (Nick Piggin). The
    affected architectures need separate patches adding
    asm-prototypes.h.

    - fix rebuilds of lib-ksyms.o (Nick Piggin)

    - -fno-PIE builds (Sebastian Siewior and Borislav Petkov). This is
    not a kernel regression, but one of the Debian gcc package.
    Nevertheless, it's quite annoying, so I think it should go into
    mainline and stable now"

    * 'rc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
    kbuild: Steal gcc's pie from the very beginning
    kbuild: be more careful about matching preprocessed asm ___EXPORT_SYMBOL
    x86/kexec: add -fno-PIE
    scripts/has-stack-protector: add -fno-PIE
    kbuild: add -fno-PIE
    kbuild: modversions for EXPORT_SYMBOL() for asm
    kbuild: prevent lib-ksyms.o rebuilds

    Linus Torvalds
     

16 Nov, 2016

1 commit

  • So Sebastian turned off the PIE for kernel builds but that was too late
    - Kbuild.include already uses KBUILD_CFLAGS and trying to disable gcc
    options with, say cc-disable-warning, fails:

    gcc -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs
    ...
    -Wno-sign-compare -fno-asynchronous-unwind-tables -Wframe-address -c -x c /dev/null -o .31392.tmp
    /dev/null:1:0: error: code model kernel does not support PIC mode

    because that returns an error and we can't disable the warning. For
    example in this case:

    KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,)

    which leads to gcc issuing all those warnings again.

    So let's turn off PIE/PIC at the earliest possible moment, when we
    declare KBUILD_CFLAGS so that cc-disable-warning picks it up too.

    Also, we need the $(call cc-option ...) because -fno-PIE is supported
    since gcc v3.4 and our lowest supported gcc version is 3.2 right now.

    Signed-off-by: Borislav Petkov
    Cc: stable@vger.kernel.org
    Cc: Ben Hutchings
    Cc: Sebastian Andrzej Siewior
    Signed-off-by: Michal Marek

    Borislav Petkov
     

14 Nov, 2016

1 commit


12 Nov, 2016

1 commit

  • Traditionally, we have always had warnings about uninitialized variables
    enabled, as this is part of -Wall, and generally a good idea [1], but it
    also always produced false positives, mainly because this is a variation
    of the halting problem and provably impossible to get right in all cases
    [2].

    Various people have identified cases that are particularly bad for false
    positives, and in commit e74fc973b6e5 ("Turn off -Wmaybe-uninitialized
    when building with -Os"), I turned off the warning for any build that
    was done with CC_OPTIMIZE_FOR_SIZE. This drastically reduced the number
    of false positive warnings in the default build but unfortunately had
    the side effect of turning the warning off completely in 'allmodconfig'
    builds, which in turn led to a lot of warnings (both actual bugs, and
    remaining false positives) to go in unnoticed.

    With commit 877417e6ffb9 ("Kbuild: change CC_OPTIMIZE_FOR_SIZE
    definition") enabled the warning again for allmodconfig builds in v4.7
    and in v4.8-rc1, I had finally managed to address all warnings I get in
    an ARM allmodconfig build and most other maybe-uninitialized warnings
    for ARM randconfig builds.

    However, commit 6e8d666e9253 ("Disable "maybe-uninitialized" warning
    globally") was merged at the same time and disabled it completely for
    all configurations, because of false-positive warnings on x86 that I had
    not addressed until then. This caused a lot of actual bugs to get
    merged into mainline, and I sent several dozen patches for these during
    the v4.9 development cycle. Most of these are actual bugs, some are for
    correct code that is safe because it is only called under external
    constraints that make it impossible to run into the case that gcc sees,
    and in a few cases gcc is just stupid and finds something that can
    obviously never happen.

    I have now done a few thousand randconfig builds on x86 and collected
    all patches that I needed to address every single warning I got (I can
    provide the combined patch for the other warnings if anyone is
    interested), so I hope we can get the warning back and let people catch
    the actual bugs earlier.

    This reverts the change to disable the warning completely and for now
    brings it back at the "make W=1" level, so we can get it merged into
    mainline without introducing false positives. A follow-up patch enables
    it on all levels unless some configuration option turns it off because
    of false-positives.

    Link: https://rusty.ozlabs.org/?p=232 [1]
    Link: https://gcc.gnu.org/wiki/Better_Uninitialized_Warnings [2]
    Signed-off-by: Arnd Bergmann
    Signed-off-by: Linus Torvalds

    Arnd Bergmann
     

09 Nov, 2016

1 commit

  • Debian started to build the gcc with -fPIE by default so the kernel
    build ends before it starts properly with:
    |kernel/bounds.c:1:0: error: code model kernel does not support PIC mode

    Also add to KBUILD_AFLAGS due to:

    |gcc -Wp,-MD,arch/x86/entry/vdso/vdso32/.note.o.d … -mfentry -DCC_USING_FENTRY … vdso/vdso32/note.S
    |arch/x86/entry/vdso/vdso32/note.S:1:0: sorry, unimplemented: -mfentry isn’t supported for 32-bit in combination with -fpic

    Tagging it stable so it is possible to compile recent stable kernels as
    well.

    Cc: stable@vger.kernel.org
    Signed-off-by: Sebastian Andrzej Siewior
    Signed-off-by: Michal Marek

    Sebastian Andrzej Siewior
     

06 Nov, 2016

1 commit


30 Oct, 2016

1 commit


24 Oct, 2016

1 commit


16 Oct, 2016

1 commit


15 Oct, 2016

2 commits

  • …/kernel/git/shuah/linux-kselftest

    Pull kselftest updates from Shuah Khan:
    "This update consists of:

    - Fixes and improvements to existing tests

    - Moving code from Documentation to selftests, samples, and tools:

    * Moves dnotify_test, prctl, ptp, vDSO, ia64, watchdog, and
    networking tests from Documentation to selftests.

    * Moves mic/mpssd, misc-devices/mei, timers, watchdog, auxdisplay,
    and blackfin examples from Documentation to samples.

    * Moves accounting, laptops/dslm, and pcmcia/crc32hash tools from
    Documentation to tools.

    * Deletes BUILD_DOCSRC and its dependencies"

    * tag 'linux-kselftest-4.9-rc1-update' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: (21 commits)
    selftests/futex: Check ANSI terminal color support
    Doc: update 00-INDEX files to reflect the runnable code move
    samples: move blackfin gptimers-example from Documentation
    tools: move pcmcia crc32hash tool from Documentation
    tools: move laptops dslm tool from Documentation
    tools: move accounting tool from Documentation
    samples: move auxdisplay example code from Documentation
    samples: move watchdog example code from Documentation
    samples: move timers example code from Documentation
    samples: move misc-devices/mei example code from Documentation
    samples: move mic/mpssd example code from Documentation
    selftests: Move networking/timestamping from Documentation
    selftests: move watchdog tests from Documentation/watchdog
    selftests: move ia64 tests from Documentation/ia64
    selftests: move vDSO tests from Documentation/vDSO
    selftests: move ptp tests from Documentation/ptp
    selftests: move prctl tests from Documentation/prctl
    selftests: move dnotify_test from Documentation/filesystems
    selftests/timers: Add missing error code assignment before test
    selftests/zram: replace ZRAM_LZ4_COMPRESS
    ...

    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
     

13 Oct, 2016

1 commit

  • This affectively reverts commit 377ccbb48373 ("Makefile: Mute warning
    for __builtin_return_address(>0) for tracing only") because it turns out
    that it really isn't tracing only - it's all over the tree.

    We already also had the warning disabled separately for mm/usercopy.c
    (which this commit also removes), and it turns out that we will also
    want to disable it for get_lock_parent_ip(), that is used for at least
    TRACE_IRQFLAGS. Which (when enabled) ends up being all over the tree.

    Steven Rostedt had a patch that tried to limit it to just the config
    options that actually triggered this, but quite frankly, the extra
    complexity and abstraction just isn't worth it. We have never actually
    had a case where the warning is actually useful, so let's just disable
    it globally and not worry about it.

    Acked-by: Steven Rostedt
    Cc: Thomas Gleixner
    Cc: Andrew Morton
    Cc: Ingo Molnar
    Cc: Peter Anvin
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

10 Oct, 2016

1 commit

  • Move blackfin gptimers-example to samples and remove it from Documentation
    Makefile. Update samples Kconfig and Makefile to build gptimers-example.

    blackfin is the last CONFIG_BUILD_DOCSRC target in Documentation/Makefile.
    Hence this patch also includes changes to remove CONFIG_BUILD_DOCSRC from
    Makefile and lib/Kconfig.debug and updates VIDEO_PCI_SKELETON dependency
    on BUILD_DOCSRC.

    Documentation/Makefile is not deleted to avoid braking make htmldocs and
    make distclean.

    Acked-by: Michal Marek
    Acked-by: Jonathan Corbet
    Reviewed-by: Kees Cook
    Reported-by: Valentin Rothberg
    Reported-by: Paul Gortmaker
    Signed-off-by: Shuah Khan

    Shuah Khan
     

05 Oct, 2016

1 commit

  • 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
     

03 Oct, 2016

1 commit


26 Sep, 2016

1 commit


19 Sep, 2016

1 commit


12 Sep, 2016

1 commit


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
     
  • Introduce LD_DEAD_CODE_DATA_ELIMINATION option for architectures to
    select to build with -ffunction-sections, -fdata-sections, and link
    with --gc-sections. It requires some work (documented) to ensure all
    unreferenced entrypoints are live, and requires toolchain and build
    verification, so it is made a per-arch option for now.

    On a random powerpc64le build, this yelds a significant size saving,
    it boots and runs fine, but there is a lot I haven't tested as yet, so
    these savings may be reduced if there are bugs in the link.

    text data bss dec filename
    11169741 1180744 1923176 14273661 vmlinux
    10445269 1004127 1919707 13369103 vmlinux.dce

    ~700K text, ~170K data, 6% removed from kernel image size.

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

    Nicholas Piggin
     

05 Sep, 2016

1 commit


29 Aug, 2016

1 commit


23 Aug, 2016

1 commit


22 Aug, 2016

1 commit


15 Aug, 2016

1 commit


09 Aug, 2016

1 commit


08 Aug, 2016

1 commit


04 Aug, 2016

2 commits

  • Pull media DocBook removal and some fixups from Mauro Carvalho Chehab:

    - removal of the media DocBook (since it's all in Sphinx now)

    - videobuf2: Fix an allocation regression

    - a few fixes related to the CEC drivers

    * tag 'media/v4.8-5' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
    [media] cec: fix off-by-one memset
    [media] staging: add MEDIA_SUPPORT dependency
    [media] vivid: don't handle CEC_MSG_SET_STREAM_PATH
    [media] media: adv7180: Fix broken interrupt register access
    [media] vb2: Fix allocation size of dma_parms
    [media] vim2m: copy the other colorspace-related fields as well
    [media] adv7511: fix VIC autodetect
    doc-rst: Remove the media docbook

    Linus Torvalds
     
  • Pull tracing fixes from Steven Rostedt:
    "A few updates and fixes:

    - move the suppressing of the __builtin_return_address >0 warning to
    the tracing directory only.

    - metag recordmcount fix for newer glibc's

    - two tracing histogram fixes that were reported by KASAN"

    * tag 'trace-v4.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
    tracing: Fix use-after-free in hist_register_trigger()
    tracing: Fix use-after-free in hist_unreg_all/hist_enable_unreg_all
    Makefile: Mute warning for __builtin_return_address(>0) for tracing only
    ftrace/recordmcount: Work around for addition of metag magic but not relocations

    Linus Torvalds
     

03 Aug, 2016

2 commits

  • Pull kbuild updates from Michal Marek:

    - GCC plugin support by Emese Revfy from grsecurity, with a fixup from
    Kees Cook. The plugins are meant to be used for static analysis of
    the kernel code. Two plugins are provided already.

    - reduction of the gcc commandline by Arnd Bergmann.

    - IS_ENABLED / IS_REACHABLE macro enhancements by Masahiro Yamada

    - bin2c fix by Michael Tautschnig

    - setlocalversion fix by Wolfram Sang

    * 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
    gcc-plugins: disable under COMPILE_TEST
    kbuild: Abort build on bad stack protector flag
    scripts: Fix size mismatch of kexec_purgatory_size
    kbuild: make samples depend on headers_install
    Kbuild: don't add obj tree in additional includes
    Kbuild: arch: look for generated headers in obtree
    Kbuild: always prefix objtree in LINUXINCLUDE
    Kbuild: avoid duplicate include path
    Kbuild: don't add ../../ to include path
    vmlinux.lds.h: replace config_enabled() with IS_ENABLED()
    kconfig.h: allow to use IS_{ENABLE,REACHABLE} in macro expansion
    kconfig.h: use already defined macros for IS_REACHABLE() define
    export.h: use __is_defined() to check if __KSYM_* is defined
    kconfig.h: use __is_defined() to check if MODULE is defined
    kbuild: setlocalversion: print error to STDERR
    Add sancov plugin
    Add Cyclomatic complexity GCC plugin
    GCC plugin infrastructure
    Shared library support

    Linus Torvalds
     
  • With the latest gcc compilers, they give a warning if
    __builtin_return_address() parameter is greater than 0. That is because if
    it is used by a function called by a top level function (or in the case of
    the kernel, by assembly), it can try to access stack frames outside the
    stack and crash the system.

    The tracing system uses __builtin_return_address() of up to 2! But it is
    well aware of the dangers that it may have, and has even added precautions
    to protect against it (see the thunk code in arch/x86/entry/thunk*.S)

    Linus originally added KBUILD_CFLAGS that would suppress the warning for the
    entire kernel, as simply adding KBUILD_CFLAGS to the tracing directory
    wouldn't work. The tracing directory plays a bit with the CFLAGS and
    requires a little more logic.

    This adds that special logic to only suppress the warning for the tracing
    directory. If it is used anywhere else outside of tracing, the warning will
    still be triggered.

    Link: http://lkml.kernel.org/r/20160728223043.51996267@grimm.local.home

    Tested-by: Linus Torvalds
    Signed-off-by: Steven Rostedt

    Steven Rostedt
     

29 Jul, 2016

1 commit

  • Now that all media documentation was converted to Sphinx, we
    should get rid of the old DocBook one, as we don't want people
    to submit patches against the old stuff.

    Signed-off-by: Mauro Carvalho Chehab
    Acked-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     

28 Jul, 2016

2 commits

  • Newer versions of gcc warn about the use of __builtin_return_address()
    with a non-zero argument when "-Wall" is specified:

    kernel/trace/trace_irqsoff.c: In function ‘stop_critical_timings’:
    kernel/trace/trace_irqsoff.c:433:86: warning: calling ‘__builtin_return_address’ with a nonzero argument is unsafe [-Wframe-address]
    stop_critical_timing(CALLER_ADDR0, CALLER_ADDR1);
    [ .. repeats a few times for other similar cases .. ]

    It is true that a non-zero argument is somewhat dangerous, and we do not
    actually have very many uses of that in the kernel - but the ftrace code
    does use it, and as Stephen Rostedt says:

    "We are well aware of the danger of using __builtin_return_address() of
    > 0. In fact that's part of the reason for having the "thunk" code in
    x86 (See arch/x86/entry/thunk_{64,32}.S). [..] it adds extra frames
    when tracking irqs off sections, to prevent __builtin_return_address()
    from accessing bad areas. In fact the thunk_32.S states: 'Trampoline to
    trace irqs off. (otherwise CALLER_ADDR1 might crash)'."

    For now, __builtin_return_address() with a non-zero argument is the best
    we can do, and the warning is not helpful and can end up making people
    miss other warnings for real problems.

    So disable the frame-address warning on compilers that need it.

    Acked-by: Steven Rostedt
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     
  • Several build configurations had already disabled this warning because
    it generates a lot of false positives. But some had not, and it was
    still enabled for "allmodconfig" builds, for example.

    Looking at the warnings produced, every single one I looked at was a
    false positive, and the warnings are frequent enough (and big enough)
    that they can easily hide real problems that you don't notice in the
    noise generated by -Wmaybe-uninitialized.

    The warning is good in theory, but this is a classic case of a warning
    that causes more problems than the warning can solve.

    If gcc gets better at avoiding false positives, we may be able to
    re-enable this warning. But as is, we're better off without it, and I
    want to be able to see the *real* warnings.

    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

27 Jul, 2016

1 commit

  • Merge updates from Andrew Morton:

    - a few misc bits

    - ocfs2

    - most(?) of MM

    * emailed patches from Andrew Morton : (125 commits)
    thp: fix comments of __pmd_trans_huge_lock()
    cgroup: remove unnecessary 0 check from css_from_id()
    cgroup: fix idr leak for the first cgroup root
    mm: memcontrol: fix documentation for compound parameter
    mm: memcontrol: remove BUG_ON in uncharge_list
    mm: fix build warnings in
    mm, thp: convert from optimistic swapin collapsing to conservative
    mm, thp: fix comment inconsistency for swapin readahead functions
    thp: update Documentation/{vm/transhuge,filesystems/proc}.txt
    shmem: split huge pages beyond i_size under memory pressure
    thp: introduce CONFIG_TRANSPARENT_HUGE_PAGECACHE
    khugepaged: add support of collapse for tmpfs/shmem pages
    shmem: make shmem_inode_info::lock irq-safe
    khugepaged: move up_read(mmap_sem) out of khugepaged_alloc_page()
    thp: extract khugepaged from mm/huge_memory.c
    shmem, thp: respect MADV_{NO,}HUGEPAGE for file mappings
    shmem: add huge pages support
    shmem: get_unmapped_area align huge page
    shmem: prepare huge= mount option and sysfs knob
    mm, rmap: account shmem thp pages
    ...

    Linus Torvalds