07 Aug, 2014

6 commits

  • This might help a kernel hacker think twice before blindly adding a
    newline.

    Signed-off-by: Rasmus Villemoes
    Acked-by: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     
  • There are some patches created by git format-patch that when scanned by
    checkpatch report errors on lines like

    To: address.tld

    This is a checkpatch false positive.

    Improve the logic a bit to ignore folded email headers to avoid emitting
    these messages.

    Signed-off-by: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Add a function pointer declaration check to the test for blank line
    needed after declarations.

    Signed-off-by: Joe Perches
    Reported-by: Bruce W Allan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • A single escaped constant char is not a complex macro.

    Signed-off-by: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Using an else following a break or return can unnecessarily indent code
    blocks.

    ie:
    for (i = 0; i < 100; i++) {
    int foo = bar();
    if (foo < 1)
    break;
    else
    usleep(1);
    }

    is generally better written as:

    for (i = 0; i < 100; i++) {
    int foo = bar();
    if (foo < 1)
    break;
    usleep(1);
    }

    Warn when a bare else statement is preceded by a break or return
    indented 1 tab more than the else.

    Signed-off-by: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Logging messages that show some type of "out of memory" error are
    generally unnecessary as there is a generic message and a stack dump
    done by the memory subsystem.

    These messages generally increase kernel size without much added value.

    Emit a warning on these types of messages.

    This test looks for any inserted message function, then looks at the
    previous line for an "if (!foo)" or "if (foo == NULL)" test and then
    looks at the preceding statement for an allocation function like "foo =
    kmalloc()"

    ie: this code matches:

    foo = kmalloc();
    if (foo == NULL) {
    printk("Out of memory\n");
    return -ENOMEM;
    }

    This test is very crude and incomplete.

    This test can miss quite a lot of of OOM messages that do not have this
    specific form.

    ie: this code does not match:

    foo = kmalloc();
    if (!foo) {
    rtn = -ENOMEM;
    printk("Out of memory!\n");
    goto out;
    }

    This test could also be a false positive when the logging message itself
    does not specify anything about memory, but I did not find any false
    positives in my limited testing.

    spatch could be a better solution but correctness seems non-trivial for
    that tool too.

    Signed-off-by: Joe Perches
    Acked-by: Dan Carpenter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     

06 Aug, 2014

1 commit

  • Pull security subsystem updates from James Morris:
    "In this release:

    - PKCS#7 parser for the key management subsystem from David Howells
    - appoint Kees Cook as seccomp maintainer
    - bugfixes and general maintenance across the subsystem"

    * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (94 commits)
    X.509: Need to export x509_request_asymmetric_key()
    netlabel: shorter names for the NetLabel catmap funcs/structs
    netlabel: fix the catmap walking functions
    netlabel: fix the horribly broken catmap functions
    netlabel: fix a problem when setting bits below the previously lowest bit
    PKCS#7: X.509 certificate issuer and subject are mandatory fields in the ASN.1
    tpm: simplify code by using %*phN specifier
    tpm: Provide a generic means to override the chip returned timeouts
    tpm: missing tpm_chip_put in tpm_get_random()
    tpm: Properly clean sysfs entries in error path
    tpm: Add missing tpm_do_selftest to ST33 I2C driver
    PKCS#7: Use x509_request_asymmetric_key()
    Revert "selinux: fix the default socket labeling in sock_graft()"
    X.509: x509_request_asymmetric_keys() doesn't need string length arguments
    PKCS#7: fix sparse non static symbol warning
    KEYS: revert encrypted key change
    ima: add support for measuring and appraising firmware
    firmware_class: perform new LSM checks
    security: introduce kernel_fw_from_file hook
    PKCS#7: Missing inclusion of linux/err.h
    ...

    Linus Torvalds
     

05 Aug, 2014

1 commit

  • Pull driver core updates from Greg KH:
    "Here's the big driver-core pull request for 3.17-rc1.

    Largest thing in here is the dma-buf rework and fence code, that
    touched many different subsystems so it was agreed it should go
    through this tree to handle merge issues. There's also some firmware
    loading updates, as well as tests added, and a few other tiny changes,
    the changelog has the details.

    All have been in linux-next for a long time"

    * tag 'driver-core-3.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (32 commits)
    ARM: imx: Remove references to platform_bus in mxc code
    firmware loader: Fix _request_firmware_load() return val for fw load abort
    platform: Remove most references to platform_bus device
    test: add firmware_class loader test
    doc: fix minor typos in firmware_class README
    staging: android: Cleanup style issues
    Documentation: devres: Sort managed interfaces
    Documentation: devres: Add devm_kmalloc() et al
    fs: debugfs: remove trailing whitespace
    kernfs: kernel-doc warning fix
    debugfs: Fix corrupted loop in debugfs_remove_recursive
    stable_kernel_rules: Add pointer to netdev-FAQ for network patches
    driver core: platform: add device binding path 'driver_override'
    driver core/platform: remove unused implicit padding in platform_object
    firmware loader: inform direct failure when udev loader is disabled
    firmware: replace ALIGN(PAGE_SIZE) by PAGE_ALIGN
    firmware: read firmware size using i_size_read()
    firmware loader: allow disabling of udev as firmware loader
    reservation: add suppport for read-only access using rcu
    reservation: update api and add some helpers
    ...

    Conflicts:
    drivers/base/platform.c

    Linus Torvalds
     

22 Jul, 2014

1 commit


19 Jul, 2014

1 commit


17 Jul, 2014

1 commit


13 Jul, 2014

1 commit

  • Object-like macros are different than function-like macros:
    https://gcc.gnu.org/onlinedocs/cpp/Object-like-Macros.html
    https://gcc.gnu.org/onlinedocs/cpp/Function-like-Macros.html

    They are not parsed correctly, generating invalid intermediate
    files (xmls) for cases like:
    #define BIT_MASK (0xFF << BIT_SHIFT)
    where "OxFF <
    Signed-off-by: Randy Dunlap
    Signed-off-by: Linus Torvalds

    Horia Geanta
     

09 Jul, 2014

1 commit


04 Jul, 2014

1 commit

  • … into driver-core-next

    Russell writes:

    These updates fix one bug in the component helper where the matched
    components are not properly cleaned up when the master fails to bind.
    I'll provide a version of this for stable trees if it's deemed that
    we need to backport it.

    The second patch causes the component helper to ignore duplicate
    matches when adding components - this is something that was originally
    needed for imx-drm, but since that has now been updated, we no longer
    need to skip over a component which has already been matched.

    The final patch starts the process of updating the component helper
    API to achieve two goals: to allow the API to be more efficient when
    deferred probing occurs, and to allow for future improvements to the
    component helper without having a major impact on the users.

    This represents groundwork for some other changes; once this has been
    merged, I will then send two further pull requests (one for the staging
    tree, and one for the DRM tree) to update the drivers to the new API.
    This will result in these three commits being shared with those trees.

    Greg Kroah-Hartman
     

28 Jun, 2014

1 commit

  • Pull MIPS fixes from Ralf Baechle:
    "This is dominated by a large number of changes necessary for the MIPS
    BPF code. code. Aside of that there are

    - a fix for the MSC system controller support code.
    - a Turbochannel fix.
    - a recordmcount fix that's MIPS-specific.
    - barrier fixes to smp-cps / pm-cps after unrelated changes elsewhere
    in the kernel.
    - revert support for MSA registers in the signal frames. The
    reverted patch did modify the signal stack frame which of course is
    inacceptable.
    - fix math-emu build breakage with older compilers.
    - some related cleanup.
    - fix Lasat build error if CONFIG_CRC32 isn't set to y by the user"

    * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: (27 commits)
    MIPS: Lasat: Fix build error if CRC32 is not enabled.
    TC: Handle device_register() errors.
    MIPS: MSC: Prevent out-of-bounds writes to MIPS SC ioremap'd region
    MIPS: bpf: Fix stack space allocation for BPF memwords on MIPS64
    MIPS: BPF: Use 32 or 64-bit load instruction to load an address to register
    MIPS: bpf: Fix PKT_TYPE case for big-endian cores
    MIPS: BPF: Prevent kernel fall over for >=32bit shifts
    MIPS: bpf: Drop update_on_xread and always initialize the X register
    MIPS: bpf: Fix is_range() semantics
    MIPS: bpf: Use pr_debug instead of pr_warn for unhandled opcodes
    MIPS: bpf: Fix return values for VLAN_TAG_PRESENT case
    MIPS: bpf: Use correct mask for VLAN_TAG case
    MIPS: bpf: Fix branch conditional for BPF_J{GT/GE} cases
    MIPS: bpf: Add SEEN_SKB to flags when looking for the PKT_TYPE
    MIPS: bpf: Use 'andi' instead of 'and' for the VLAN cases
    MIPS: bpf: Return error code if the offset is a negative number
    MIPS: bpf: Use the LO register to get division's quotient
    MIPS: mm: uasm: Fix lh micro-assembler instruction
    MIPS: uasm: Add SLT uasm instruction
    MIPS: uasm: Add s3s1s2 instruction builder
    ...

    Linus Torvalds
     

26 Jun, 2014

1 commit

  • On MIPS calls to _mcount in modules generate 2 instructions to load
    the _mcount address (and therefore 2 relocations). The mcount_loc
    table should only reference the first of these, so the second is
    filtered out by checking the relocation offset and ignoring ones that
    immediately follow the previous one seen.

    However if a module has an _mcount call at offset 0, the second
    relocation would not be filtered out due to old_r_offset == 0
    being taken to mean that the current relocation is the first one
    seen, and both would end up in the mcount_loc table.

    This results in ftrace_make_nop() patching both (adjacent)
    instructions to branches over the _mcount call sequence like so:

    0xffffffffc08a8000: 04 00 00 10 b 0xffffffffc08a8014
    0xffffffffc08a8004: 04 00 00 10 b 0xffffffffc08a8018
    0xffffffffc08a8008: 2d 08 e0 03 move at,ra
    ...

    The second branch is in the delay slot of the first, which is
    defined to be unpredictable - on the platform on which this bug was
    encountered, it triggers a reserved instruction exception.

    Fix by initializing old_r_offset to ~0 and using that instead of 0
    to determine whether the current relocation is the first seen.

    Signed-off-by: Alex Smith
    Cc: linux-kernel@vger.kernel.org
    Cc: stable@vger.kernel.org
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/7098/
    Signed-off-by: Ralf Baechle

    Alex Smith
     

24 Jun, 2014

1 commit


20 Jun, 2014

1 commit

  • devm_request_and_ioremap() was obsoleted by the commit 7509657
    ("lib: devres: Introduce devm_ioremap_resource()") and has been
    deprecated for a long time. So, let's remove this function.
    In addition, all usages of devm_request_and_ioremap() are also
    removed.

    Signed-off-by: Jingoo Han
    Signed-off-by: Greg Kroah-Hartman

    Jingoo Han
     

19 Jun, 2014

1 commit

  • The kernel headers package (linux-headers) doesn't include several
    header files required to build out-of-tree modules.

    It makes the package unusable on e.g. ARM architecture:
    /usr/src/linux-headers-3.14.0/arch/arm/include/asm/memory.h:24:25:
    fatal error: mach/memory.h: No such file or directory
    #include
    ^
    compilation terminated.

    Signed-off-by: Fathi Boudra
    Reviewed-by: Ben Hutchings
    Signed-off-by: Michal Marek

    Fathi Boudra
     

18 Jun, 2014

3 commits


13 Jun, 2014

2 commits

  • Pull kbuild misc updates from Michal Marek:
    "This is the non-critical part of kbuild for v3.16-rc1:
    - make deb-pkg can do s390x and arm64
    - new patterns in scripts/tags.sh
    - scripts/tags.sh skips userspace tools' sources (which sometimes
    have copies of kernel structures) and symlinks
    - improvements to the objdiff tool
    - two new coccinelle patches
    - other minor fixes"

    * 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
    scripts: objdiff: support directories for the augument of record command
    scripts: objdiff: fix a comment
    scripts: objdiff: change the extension of disassembly from .o to .dis
    scripts: objdiff: improve path flexibility for record command
    scripts: objdiff: remove unnecessary code
    scripts: objdiff: direct error messages to stderr
    scripts: objdiff: get the path to .tmp_objdiff more simply
    deb-pkg: Add automatic support for s390x architecture
    coccicheck: Add unneeded return variable test
    kbuild: Fix a typo in documentation
    kbuild: trivial - use tabs for code indent where possible
    kbuild: trivial - remove trailing empty lines
    coccinelle: Check for missing NULL terminators in of_device_id tables
    scripts/tags.sh: ignore symlink'ed source files
    scripts/tags.sh: add regular expression replacement pattern for memcg
    builddeb: add arm64 in the supported architectures
    builddeb: use $OBJCOPY variable instead of objcopy
    scripts/tags.sh: ignore code of user space tools
    scripts/tags.sh: add pattern for DEFINE_HASHTABLE
    .gitignore: ignore Module.symvers in all directories

    Linus Torvalds
     
  • Pull kbuild updates from Michal Marek:
    "Kbuild changes for v3.16-rc1:

    - cross-compilation fix so that cc-option is testing the right
    compiler
    - Fix for make defconfig all
    - Using relative paths to the object and source directory where
    possible, plus fixes for the fallout of the change
    - several cleanups in the Makefiles and scripts

    The powerpc fix is from today, because it was only discovered
    recently. The rest has been in linux-next for some time"

    * 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
    powerpc: Avoid circular dependency with zImage.%
    kbuild: create include/config directory in scripts/kconfig/Makefile
    kbuild: do not create include/linux directory
    Makefile: Fix unrecognized cross-compiler command line options
    kbuild: do not add "selinux" to subdir- twice
    um: Fix for relative objtree when generating x86 headers
    kbuild: Use relative path when building in a subdir of the source tree
    kbuild: Use relative path when building in the source tree
    kbuild: Use relative path for $(objtree)
    firmware: Use $(quote) in the Makefile
    firmware: Simplify directory creation
    kbuild: trivial - fix comment block indent
    kbuild: trivial - remove trailing spaces
    kbuild: support simultaneous "make %config" and "make all"
    kbuild: move extra gcc checks to scripts/Makefile.extrawarn

    Linus Torvalds
     

12 Jun, 2014

1 commit

  • Pull module updates from Rusty Russell:
    "Most of this is cleaning up various driver sysfs permissions so we can
    re-add the perm check (we unified the module param and sysfs checks,
    but the module ones were stronger so we weakened them temporarily).

    Param parsing gets documented, and also "--" now forces args to be
    handed to init (and ignored by the kernel).

    Module NX/RO protections get tightened: we now set them before calling
    parse_args()"

    * tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux:
    module: set nx before marking module MODULE_STATE_COMING.
    samples/kobject/: avoid world-writable sysfs files.
    drivers/hid/hid-picolcd_fb: avoid world-writable sysfs files.
    drivers/staging/speakup/: avoid world-writable sysfs files.
    drivers/regulator/virtual: avoid world-writable sysfs files.
    drivers/scsi/pm8001/pm8001_ctl.c: avoid world-writable sysfs files.
    drivers/hid/hid-lg4ff.c: avoid world-writable sysfs files.
    drivers/video/fbdev/sm501fb.c: avoid world-writable sysfs files.
    drivers/mtd/devices/docg3.c: avoid world-writable sysfs files.
    speakup: fix incorrect perms on speakup_acntsa.c
    cpumask.h: silence warning with -Wsign-compare
    Documentation: Update kernel-parameters.tx
    param: hand arguments after -- straight to init
    modpost: Fix resource leak in read_dump()

    Linus Torvalds
     

11 Jun, 2014

1 commit

  • Right now when people try to report issues in the kernel they send stack
    dumps to eachother, which looks something like this:

    [ 6.906437] [] ? backtrace_test_irq_callback+0x20/0x20
    [ 6.907121] [] dump_stack+0x52/0x7f
    [ 6.907640] [] backtrace_regression_test+0x38/0x110
    [ 6.908281] [] ? proc_create_data+0xa0/0xd0
    [ 6.908870] [] ? proc_modules_init+0x22/0x22
    [ 6.909480] [] do_one_initcall+0xc2/0x1e0
    [...]

    However, most of the text you get is pure garbage.

    The only useful thing above is the function name. Due to the amount of
    different kernel code versions and various configurations being used,
    the kernel address and the offset into the function are not really
    helpful in determining where the problem actually occured.

    Too often the result of someone looking at a stack dump is asking the
    person who sent it for a translation for one or more 'addr2line'
    translations. Which slows down the entire process of debugging the
    issue (and really annoying).

    The decode_stacktrace script is an attempt to make the output more
    useful and easy to work with by translating all kernel addresses in the
    stack dump into line numbers. Which means that the stack dump would
    look like this:

    [ 635.148361] dump_stack (lib/dump_stack.c:52)
    [ 635.149127] warn_slowpath_common (kernel/panic.c:418)
    [ 635.150214] warn_slowpath_null (kernel/panic.c:453)
    [ 635.151031] _oalloc_pages_slowpath+0x6a/0x7d0
    [ 635.152171] ? zone_watermark_ok (mm/page_alloc.c:1728)
    [ 635.152988] ? get_page_from_freelist (mm/page_alloc.c:1939)
    [ 635.154766] __alloc_pages_nodemask (mm/page_alloc.c:2766)

    It's pretty obvious why this is better than the previous stack dump
    before.

    Usage is pretty simple:

    ./decode_stacktrace.sh [vmlinux] [base path]

    Where vmlinux is the vmlinux to extract line numbers from and base path
    is the path that points to the root of the build tree, for example:

    ./decode_stacktrace.sh vmlinux /home/sasha/linux/ < input.log > output.log

    The stack trace should be piped through it (I, for example, just pipe
    the output of the serial console of my KVM test box through it).

    Signed-off-by: Sasha Levin
    Signed-off-by: Linus Torvalds

    Sasha Levin
     

10 Jun, 2014

14 commits