18 Jan, 2016

14 commits

  • Pull security subsystem updates from James Morris:

    - EVM gains support for loading an x509 cert from the kernel
    (EVM_LOAD_X509), into the EVM trusted kernel keyring.

    - Smack implements 'file receive' process-based permission checking for
    sockets, rather than just depending on inode checks.

    - Misc enhancments for TPM & TPM2.

    - Cleanups and bugfixes for SELinux, Keys, and IMA.

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (41 commits)
    selinux: Inode label revalidation performance fix
    KEYS: refcount bug fix
    ima: ima_write_policy() limit locking
    IMA: policy can be updated zero times
    selinux: rate-limit netlink message warnings in selinux_nlmsg_perm()
    selinux: export validatetrans decisions
    gfs2: Invalid security labels of inodes when they go invalid
    selinux: Revalidate invalid inode security labels
    security: Add hook to invalidate inode security labels
    selinux: Add accessor functions for inode->i_security
    security: Make inode argument of inode_getsecid non-const
    security: Make inode argument of inode_getsecurity non-const
    selinux: Remove unused variable in selinux_inode_init_security
    keys, trusted: seal with a TPM2 authorization policy
    keys, trusted: select hash algorithm for TPM2 chips
    keys, trusted: fix: *do not* allow duplicate key options
    tpm_ibmvtpm: properly handle interrupted packet receptions
    tpm_tis: Tighten IRQ auto-probing
    tpm_tis: Refactor the interrupt setup
    tpm_tis: Get rid of the duplicate IRQ probing code
    ...

    Linus Torvalds
     
  • Pull audit updates from Paul Moore:
    "Seven audit patches for 4.5, all very minor despite the diffstat.

    The diffstat churn for linux/audit.h can be attributed to needing to
    reshuffle the linux/audit.h header to fix the seccomp auditing issue
    (see the commit description for details).

    Besides the seccomp/audit fix, most of the fixes are around trying to
    improve the connection with the audit daemon and a Kconfig
    simplification. Nothing crazy, and everything passes our little
    audit-testsuite"

    * 'upstream' of git://git.infradead.org/users/pcmoore/audit:
    audit: always enable syscall auditing when supported and audit is enabled
    audit: force seccomp event logging to honor the audit_enabled flag
    audit: Delete unnecessary checks before two function calls
    audit: wake up threads if queue switched from limited to unlimited
    audit: include auditd's threads in audit_log_start() wait exception
    audit: remove audit_backlog_wait_overflow
    audit: don't needlessly reset valid wait time

    Linus Torvalds
     
  • Commit b8d3c4c3009d ("mm/huge_memory.c: don't split THP page when
    MADV_FREE syscall is called") introduced this new function, but got the
    error handling for when pmd_trans_huge_lock() fails wrong. In the
    failure case, the lock has not been taken, and we should not unlock on
    the way out.

    Cc: Minchan Kim
    Cc: Andrew Morton
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     
  • This just fixes a warning on 64-bit builds:

    drivers/gpu/drm/vc4/vc4_validate.c: In function ‘validate_gl_shader_rec’:
    drivers/gpu/drm/vc4/vc4_validate.c:864:12: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t {aka long unsigned int}’ [-Wformat=]

    Reported-by: Linus Torvalds
    Signed-off-by: Dave Airlie
    Signed-off-by: Linus Torvalds

    Dave Airlie
     
  • Pull drm updates from Dave Airlie:
    "This is the main drm pull request for 4.5. I don't think I've missed
    anything too major, I'm mostly back at work now but I'll probably get
    some sleep in 5 years time.

    Summary:

    New drivers:
    - etnaviv:

    GPU driver for the 3D core on the Vivante core used in numerous
    ARM boards.

    Highlights:

    Core:
    - Atomic suspend/resume helpers
    - Move the headers to using userspace friendlier types.
    - Documentation updates
    - Lots of struct_mutex removal.
    - Bunch of DP MST fixes from AMD.

    Panel:
    - More DSI helpers
    - Support for some new basic panels

    i915:
    - Basic Kabylake support
    - DP link training and detect code refactoring
    - fbc/psr fixes
    - FIFO underrun fixes
    - SDE interrupt handling fixes
    - dma-buf/fence support in pageflip path.
    - GPU side for MST audio support

    radeon/amdgpu:
    - Drop UMS support
    - GPUVM/Scheduler optimisations
    - Initial Powerplay support for Tonga/Fiji/CZ/ST
    - ACP audio prerequisites

    nouveau:
    - GK20a instmem improvements
    - PCIE link speed change support

    msm:
    - DSI support for msm8960/apq8064

    tegra:
    - Host1X support for Tegra210 SoC

    vc4:
    - 3D acceleration support

    armada:
    - Get rid of struct mutex

    tda998x:
    - Atomic modesetting support
    - TMDS clock limitations

    omapdrm:
    - Atomic modesetting support
    - improved TILER performance

    rockchip:
    - RK3036 VOP support
    - Atomic modesetting support
    - Synopsys DW MIPI DSI support

    exynos:
    - Runtime PM support
    - of_graph binding for DP panels
    - Cleanup of IPP code
    - Configurable plane support
    - Kernel panic fixes at release time"

    * 'drm-next' of git://people.freedesktop.org/~airlied/linux: (711 commits)
    drm/fb_cma_helper: Remove implicit call to disable_unused_functions
    drm/amdgpu: add missing irq.h include
    drm/vmwgfx: Fix a width / pitch mismatch on framebuffer updates
    drm/vmwgfx: Fix an incorrect lock check
    drm: nouveau: fix nouveau_debugfs_init prototype
    drm/nouveau/pci: fix check in nvkm_pcie_set_link
    drm/amdgpu: validate duplicates first
    drm/amdgpu: move VM page tables to the LRU end on CS v2
    drm/ttm: add ttm_bo_move_to_lru_tail function v2
    drm/ttm: fix adding foreign BOs to the swap LRU
    drm/ttm: fix adding foreign BOs to the LRU during init v2
    drm/radeon: use kobj_to_dev()
    drm/amdgpu: use kobj_to_dev()
    drm/amdgpu/cz: force vce clocks when sclks are forced
    drm/amdgpu/cz: force uvd clocks when sclks are forced
    drm/amdgpu/cz: add code to enable forcing VCE clocks
    drm/amdgpu/cz: add code to enable forcing UVD clocks
    drm/amdgpu: fix lost sync_to if scheduler is enabled.
    drm/amd/powerplay: fix static checker warning for return meaningless value.
    drm/sysfs: use kobj_to_dev()
    ...

    Linus Torvalds
     
  • …/git/shuah/linux-kselftest

    Pull kselftest updates from Shuah Khan:
    "This 14 patch update:

    - adds a new test for intel_pstate driver
    - adds empty string and async test cases to firmware class tests
    - fixes and cleans up several existing tests"

    * tag 'linux-kselftest-4.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
    selftests: firmware: add empty string and async tests
    firmware: actually return NULL on failed request_firmware_nowait()
    test: firmware_class: add asynchronous request trigger
    test: firmware_class: use kstrndup() where appropriate
    test: firmware_class: report errors properly on failure
    selftests/seccomp: fix 32-bit build warnings
    add breakpoints/.gitignore
    add ptrace/.gitignore
    update .gitignore in selftests/timers
    update .gitignore in selftests/vm
    tools, testing, add test for intel_pstate driver
    selftest/ipc: actually test it
    selftests/capabilities: actually test it
    selftests/capabilities: clean up for Makefile

    Linus Torvalds
     
  • Pull parsic updates from Helge Deller:
    "This patchset includes two major fixes which are both scheduled for
    stable:

    First, __ARCH_SI_PREAMBLE_SIZE was defined with a wrong value.
    Second, huge page pte and TLB changes needed protection with a
    spinlock. Other than that there are just some trivial optimizations
    and cleanups"

    * 'parisc-4.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
    parisc: Protect huge page pte changes with spinlocks
    parisc: Imporove debug info about space registers and TLB configuration
    parisc: Drop parisc-specific NSIGTRAP define
    parisc: Fix __ARCH_SI_PREAMBLE_SIZE
    parisc: Reduce overhead of parisc_requires_coherency()
    parisc: Initialize PCI bridge cache line and default latency

    Linus Torvalds
     
  • misc i915 fixes all over the place.

    * tag 'drm-intel-next-fixes-2016-01-14' of git://anongit.freedesktop.org/drm-intel:
    drm/i915/gen9: Set PIN_ZONE_4G end to 4GB - 1 page
    drm/i915: Widen return value for reservation_object_wait_timeout_rcu to long.
    drm/i915: intel_hpd_init(): Fix suspend/resume reprobing
    drm/i915: shut up gen8+ SDE irq dmesg noise, again
    drm/i915: Restore inhibiting the load of the default context
    drm/i915: Tune down rpm wakelock debug checks
    drm/i915: Avoid writing relocs with addresses in non-canonical form
    drm/i915: Move Braswell stop_machine GGTT insertion workaround

    Dave Airlie
     
  • Since your main drm-next pull isn't out of the door yet I figured I might
    as well flush out drm-misc instead of delaying for 4.6. It's really just
    random stuff all over, biggest thing probably connector_mask tracking from
    Maarten.

    * tag 'topic/drm-misc-2016-01-17' of git://anongit.freedesktop.org/drm-intel: (24 commits)
    drm/fb_cma_helper: Remove implicit call to disable_unused_functions
    drm/sysfs: use kobj_to_dev()
    drm/i915: Init power domains early in driver load
    drm: Do not set connector->encoder in drivers
    apple-gmux: Add initial documentation
    drm: move MODULE_PARM_DESC to other file
    drm/edid: index CEA/HDMI mode tables using the VIC
    drm/atomic: Remove drm_atomic_connectors_for_crtc.
    drm/i915: Update connector_mask during readout, v2.
    drm: Remove opencoded drm_gem_object_release_handle()
    drm: Do not set outparam on error during GEM handle allocation
    drm/docs: more leftovers from the big vtable documentation pile
    drm/atomic-helper: Reject legacy flips on a disabled pipe
    drm/atomic: add connector mask to drm_crtc_state.
    drm/tegra: Use __drm_atomic_helper_reset_connector for subclassing connector state, v2.
    drm/atomic: Add __drm_atomic_helper_connector_reset, v2.
    drm/i915: Set connector_state->connector using the helper.
    drm: Use a normal idr allocation for the obj->name
    drm: Only bump object-reference count when adding first handle
    drm: Balance error path for GEM handle allocation
    ...

    Dave Airlie
     
  • Merge second patch-bomb from Andrew Morton:

    - more MM stuff:

    - Kirill's page-flags rework

    - Kirill's now-allegedly-fixed THP rework

    - MADV_FREE implementation

    - DAX feature work (msync/fsync). This isn't quite complete but DAX
    is new and it's good enough and the guys have a handle on what
    needs to be done - I expect this to be wrapped in the next week or
    two.

    - some vsprintf maintenance work

    - various other misc bits

    * emailed patches from Andrew Morton : (145 commits)
    printk: change recursion_bug type to bool
    lib/vsprintf: factor out %pN[F] handler as netdev_bits()
    lib/vsprintf: refactor duplicate code to special_hex_number()
    printk-formats.txt: remove unimplemented %pT
    printk: help pr_debug and pr_devel to optimize out arguments
    lib/test_printf.c: test dentry printing
    lib/test_printf.c: add test for large bitmaps
    lib/test_printf.c: account for kvasprintf tests
    lib/test_printf.c: add a few number() tests
    lib/test_printf.c: test precision quirks
    lib/test_printf.c: check for out-of-bound writes
    lib/test_printf.c: don't BUG
    lib/kasprintf.c: add sanity check to kvasprintf
    lib/vsprintf.c: warn about too large precisions and field widths
    lib/vsprintf.c: help gcc make number() smaller
    lib/vsprintf.c: expand field_width to 24 bits
    lib/vsprintf.c: eliminate potential race in string()
    lib/vsprintf.c: move string() below widen_string()
    lib/vsprintf.c: pull out padding code from dentry_name()
    printk: do cond_resched() between lines while outputting to consoles
    ...

    Linus Torvalds
     
  • Pull GPIO updates from Linus Walleij:
    "Here is the bulk of GPIO changes for v4.5.

    Notably there are big refactorings mostly by myself, aimed at getting
    the gpio_chip into a shape that makes me believe I can proceed to
    preserve state for a proper userspace ABI (character device) that has
    already been proposed once, but resulted in the feedback that I need
    to go back and restructure stuff. So I've been restructuring stuff.
    On the way I ran into brokenness (return code from the get_value()
    callback) and had to fix it. Also, refactored generic GPIO to be
    simpler.

    Some of that is still waiting to trickle down from the subsystems all
    over the kernel that provide random gpio_chips, I've touched every
    single GPIO driver in the kernel now, oh man I didn't know I was
    responsible for so much...

    Apart from that we're churning along as usual.

    I took some effort to test and retest so it should merge nicely and we
    shook out a couple of bugs in -next.

    Infrastructural changes:

    - In struct gpio_chip, rename the .dev node to .parent to better
    reflect the fact that this is not the GPIO struct device
    abstraction. We will add that soon so this would be totallt
    confusing.

    - It was noted that the driver .get_value() callbacks was sometimes
    reporting negative -ERR values to the gpiolib core, expecting them
    to be propagated to consumer gpiod_get_value() and gpio_get_value()
    calls. This was not happening, so as there was a mess of drivers
    returning negative errors and some returning "anything else than
    zero" to indicate that a line was active. As some would have bit
    31 set to indicate "line active" it clashed with negative error
    codes. This is fixed by the largeish series clamping values in all
    drivers with !!value to [0,1] and then augmenting the code to
    propagate error codes to consumers. (Includes some ACKed patches
    in other subsystems.)

    - Add a void *data pointer to struct gpio_chip. The container_of()
    design pattern is indeed very nice, but we want to reform the
    struct gpio_chip to be a non-volative, stateless business, and keep
    states internal to the gpiolib to be able to hold on to the state
    when adding a proper userspace ABI (character device) further down
    the road. To achieve this, drivers need a handle at the internal
    state that is not dependent on their struct gpio_chip() so we add
    gpiochip_add_data() and gpiochip_get_data() following the pattern
    of many other subsystems. All the "use gpiochip data pointer"
    patches transforms drivers to this scheme.

    - The Generic GPIO chip header has been merged into the general
    header, and the custom header for that
    removed. Instead of having a separate mm_gpio_chip struct for
    these generic drivers, merge that into struct gpio_chip,
    simplifying the code and removing the need for separate and
    confusing includes.

    Misc improvements:

    - Stabilize the way GPIOs are looked up from the ACPI legacy
    specification.

    - Incremental driver features for PXA, PCA953X, Lantiq (patches from
    the OpenWRT community), RCAR, Zynq, PL061, 104-idi-48

    New drivers:

    - Add a GPIO chip to the ALSA SoC AC97 driver.

    - Add a new Broadcom NSP SoC driver (this lands in the pinctrl dir,
    but the branch is merged here too to account for infrastructural
    changes).

    - The sx150x driver now supports the sx1502"

    * tag 'gpio-v4.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (220 commits)
    gpio: generic: make bgpio_pdata always visible
    gpiolib: fix chip order in gpio list
    gpio: mpc8xxx: Do not use gpiochip_get_data() in mpc8xxx_gpio_save_regs()
    gpio: mm-lantiq: Do not use gpiochip_get_data() in ltq_mm_save_regs()
    gpio: brcmstb: Allow building driver for BMIPS_GENERIC
    gpio: brcmstb: Set endian flags for big-endian MIPS
    gpio: moxart: fix build regression
    gpio: xilinx: Do not use gpiochip_get_data() in xgpio_save_regs()
    leds: pca9532: use gpiochip data pointer
    leds: tca6507: use gpiochip data pointer
    hid: cp2112: use gpiochip data pointer
    bcma: gpio: use gpiochip data pointer
    avr32: gpio: use gpiochip data pointer
    video: fbdev: via: use gpiochip data pointer
    gpio: pch: Optimize pch_gpio_get()
    Revert "pinctrl: lantiq: Implement gpio_chip.to_irq"
    pinctrl: nsp-gpio: use gpiochip data pointer
    pinctrl: vt8500-wmt: use gpiochip data pointer
    pinctrl: exynos5440: use gpiochip data pointer
    pinctrl: at91-pio4: use gpiochip data pointer
    ...

    Linus Torvalds
     
  • Pull watchdog updates from Wim Van Sebroeck:
    "This adds following items:

    - watchdog restart handler support
    - watchdog reboot notifier support
    - watchdog sysfs attributes
    - support for the following new devices: AMD Mullins platform, AMD
    Carrizo platform, meson8b SoC, CSRatlas7, TS-4800, Alphascale
    asm9260-wdt, Zodiac, Sigma Designs SMP86xx/SMP87xx
    - Changes in refcounting for the watchdog core
    - watchdog core improvements
    - and small fixes"

    * git://www.linux-watchdog.org/linux-watchdog: (60 commits)
    watchdog: asm9260: remove __init and __exit annotations
    watchdog: Drop pointer to watchdog device from struct watchdog_device
    watchdog: ziirave: Use watchdog infrastructure to create sysfs attributes
    watchdog: Add support for creating driver specific sysfs attributes
    watchdog: kill unref/ref ops
    watchdog: stmp3xxx: Remove unused variables
    watchdog: add MT7621 watchdog support
    hwmon: (sch56xx) Drop watchdog driver data reference count callbacks
    watchdog: da9055_wdt: Drop reference counting
    watchdog: da9052_wdt: Drop reference counting
    watchdog: Separate and maintain variables based on variable lifetime
    watchdog: diag288: Stop re-using watchdog core internal flags
    watchdog: Create watchdog device in watchdog_dev.c
    watchdog: qcom-wdt: Do not set 'dev' in struct watchdog_device
    watchdog: mena21: Do not use device pointer from struct watchdog_device
    watchdog: gpio: Do not use device pointer from struct watchdog_device
    watchdog: tangox: Print info message using pointer to platform device
    watchdog: bcm2835_wdt: Drop log message if watchdog is stopped
    devicetree: watchdog: add binding for Sigma Designs SMP8642 watchdog
    watchdog: add support for Sigma Designs SMP86xx/SMP87xx
    ...

    Linus Torvalds
     
  • Pull sound updates from Takashi Iwai:
    "We've had quite busy weeks in this cycle. Looking at ALSA core, the
    significant changes are a few fixes wrt timer and sequencer ioctls
    that have been revealed by fuzzer recently. Other than that, ASoC
    core got a few updates about DAI link handling, but these are rather
    straightforward refactoring.

    In drivers scene, ASoC received quite lots of new drivers in addition
    to bunch of updates for still ongoing Intel Skylake support and
    topology API. HD-audio gained a new HDMI/DP hotplug notification via
    component. FireWire got a pile of code refactoring/updates with
    SCS.1x driver integration.

    More highlights are shown below.

    [ NOTE: this contains also many commits for DRM. This is due to the
    pull of drm stable branch into sound tree, as the base of i915 audio
    component work for HD-audio. The highlights below don't contain
    these DRM changes, as these are supposed to be pulled via drm tree
    in anyway sooner or later. ]

    Core:
    - Handful fixes to harden ALSA timer and sequencer ioctls against
    races reported by syzkaller fuzzer
    - Irq description string can be unique to each card; only for
    HD-audio for now

    ASoC:
    - Conversion of the array of DAI links to a list for supporting
    dynamically adding and removing DAI links
    - Topology API enhancements to make everything more component based
    and being able to specify PCM links via topology
    - Some more fixes for the topology code, though it is still not final
    and ready for enabling in production; we really need to get to the
    point where that can be done
    - A pile of changes for Intel SkyLake drivers which hopefully deliver
    some useful initial functionality for systems with this chipset,
    though there is more work still to come
    - Lots of new features and cleanups for the Renesas drivers
    - ANC support for WM5110
    - New drivers: Imagination Technologies IPs, Atmel class D speaker,
    Cirrus CS47L24 and WM1831, Dialog DA7128, Realtek RT5659 and
    RT56156, Rockchip RK3036, TI PC3168A, and AMD ACP
    - Rename PCM1792a driver to be generic pcm179x

    HD-Audio:
    - Use audio component for i915 HDMI/DP hotplug handling
    - On-demand binding with i915 driver
    - bdl_pos_adj parameter adjustment for Baytrail controllers
    - Enable power_save_node for CX20722; this shouldn't lead to
    regression, hopefully
    - Kabylake HDMI/DP codec support
    - Quirks for Lenovo E50-80, Dell Latitude E-series, and other Dell
    machines
    - A few code refactoring

    FireWire:
    - Lots of code cleanup and refactoring
    - Integrate the support of SCS.1x devices into snd-oxfw driver;
    snd-scs1x driver is obsoleted

    USB-audio:
    - Fix possible NULL dereference at disconnection
    - A regression fix for Native Instruments devices

    Misc:
    - A few code cleanups of fm801 driver"

    * tag 'sound-4.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (722 commits)
    ALSA: timer: Code cleanup
    ALSA: timer: Harden slave timer list handling
    ALSA: hda - Add fixup for Dell Latitidue E6540
    ALSA: timer: Fix race among timer ioctls
    ALSA: hda - add codec support for Kabylake display audio codec
    ALSA: timer: Fix double unlink of active_list
    ALSA: usb-audio: Fix mixer ctl regression of Native Instrument devices
    ALSA: hda - fix the headset mic detection problem for a Dell laptop
    ALSA: hda - Fix white noise on Dell Latitude E5550
    ALSA: hda_intel: add card number to irq description
    ALSA: seq: Fix race at timer setup and close
    ALSA: seq: Fix missing NULL check at remove_events ioctl
    ALSA: usb-audio: Avoid calling usb_autopm_put_interface() at disconnect
    ASoC: hdac_hdmi: remove unused hdac_hdmi_query_pin_connlist
    ASoC: AMD: Add missing include file
    ALSA: hda - Fixup inverted internal mic for Lenovo E50-80
    ALSA: usb: Add native DSD support for Oppo HA-1
    ASoC: Make aux_dev more like a generic component
    ASoC: bcm2835: cleanup includes by ordering them alphabetically
    ASoC: AMD: Manage ACP 2.x SRAM banks power
    ...

    Linus Torvalds
     
  • Pull documentation updates from Jon Corbet:
    "A relatively boring cycle in the docs tree. There's a few kernel-doc
    fixes and various document tweaks.

    One patch reaches out of the documentation subtree to fix a comment in
    init/do_mounts_rd.c. There didn't seem to be anybody more appropriate
    to take that one, so I accepted it"

    * tag 'docs-4.5' of git://git.lwn.net/linux: (29 commits)
    thermal: add description for integral_cutoff unit
    Documentation: update libhugetlbfs site url
    Documentation: Explain pci=conf1,conf2 more verbosely
    DMA-API: fix confusing sentence in Documentation/DMA-API.txt
    Documentation: translations: update linux cross reference link
    Documentation: fix typo in CodingStyle
    init, Documentation: Remove ramdisk_blocksize mentions
    Documentation-getdelays: Apply a recommendation from "checkpatch.pl" in main()
    Documentation: HOWTO: update versions from 3.x to 4.x
    Documentation: remove outdated references from translations
    Doc: treewide: Fix grammar "a" to "an"
    Documentation: cpu-hotplug: Fix sysfs mount instructions
    can-doc: Add hint about getting timestamps
    Fix CFQ I/O scheduler parameter name in documentation
    Documentation: arm: remove dead links from Marvell Berlin docs
    Documentation: HOWTO: update code cross reference link
    Doc: Docbook/iio: Fix typo in iio.tmpl
    DocBook: make index.html generation less verbose by default
    DocBook: Cleanup: remove an unused $(call) line
    DocBook: Add a help message for DOCBOOKS env var
    ...

    Linus Torvalds
     

17 Jan, 2016

26 commits

  • `recursion_bug' is used as recursion_bug toggle, so make it `bool'.

    Signed-off-by: Sergey Senozhatsky
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Sergey Senozhatsky
     
  • Move switch case to the netdev_features_string() and rename it to
    netdev_bits(). In the future we can extend it as needed.

    Here we replace the fallback of %pN from '%p' with possible flags to
    sticter '0x%p' without any flags variation.

    Signed-off-by: Andy Shevchenko
    Cc: Rasmus Villemoes
    Cc: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Shevchenko
     
  • special_hex_number() is a helper to print a fixed size type in a hex
    format with '0x' prefix, zero padding, and small letters. In the module
    we have already several copies of such code. Consolidate them under
    special_hex_number() helper.

    There are couple of differences though.

    It seems nobody cared about the output in case of CONFIG_KALLSYMS=n,
    when printing symbol address, because the asked field width is not
    enough to care last 2 characters in the string represantation of the
    pointer. Fixed here.

    The %pNF specifier used to be allowed with a specific field width,
    though there is neither any user of it nor mention the possibility in
    the documentation.

    Signed-off-by: Andy Shevchenko
    Cc: Rasmus Villemoes
    Cc: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Shevchenko
     
  • %pT for task->comm has been proposed (several times, I think), but is
    not actually implemented. Remove it from printk-formats.txt and add it
    back if/when it gets implemented.

    Signed-off-by: Rasmus Villemoes
    Reviewed-by: Andy Shevchenko
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     
  • Currently, pr_debug and pr_devel will not elide function call arguments
    appearing in calls to the no_printk for these macros. This is because
    all side effects must be honored before proceeding to the 0-value
    assignment in no_printk.

    The behavior is contrary to documentation found in the CodingStyle and
    the header file where these functions are declared.

    This patch corrects that behavior by shunting out the call to no_printk
    completely. The format string is still checked by gcc for correctness,
    but no code seems to be emitted in common cases.

    [akpm@linux-foundation.org: remove braces, per Joe]
    Fixes: 5264f2f75d86 ("include/linux/printk.h: use and neaten no_printk")
    Signed-off-by: Aaron Conole
    Reported-by: Dmitry Vyukov
    Cc: Joe Perches
    Cc: Jason Baron
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Aaron Conole
     
  • Signed-off-by: Rasmus Villemoes
    Cc: Al Viro
    Cc: Andy Shevchenko
    Cc: Ingo Molnar
    Cc: Joe Perches
    Cc: Kees Cook
    Cc: Maurizio Lombardi
    Cc: Tejun Heo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     
  • Following "lib/vsprintf.c: expand field_width to 24 bits", let's add a
    test to see that we now actually support bitmaps with 65536 bits.

    Signed-off-by: Rasmus Villemoes
    Acked-by: Kees Cook
    Cc: Al Viro
    Cc: Andy Shevchenko
    Cc: Ingo Molnar
    Cc: Joe Perches
    Cc: Maurizio Lombardi
    Cc: Tejun Heo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     
  • These should also count as performed tests.

    Signed-off-by: Rasmus Villemoes
    Acked-by: Kees Cook
    Cc: Al Viro
    Cc: Andy Shevchenko
    Cc: Ingo Molnar
    Cc: Joe Perches
    Cc: Maurizio Lombardi
    Cc: Tejun Heo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     
  • This adds a few tests to test_number, one of which serves to document
    another deviation from POSIX/C99 (printing 0 with an explicit precision
    of 0).

    Signed-off-by: Rasmus Villemoes
    Cc: Al Viro
    Cc: Andy Shevchenko
    Cc: Ingo Molnar
    Cc: Joe Perches
    Cc: Kees Cook
    Cc: Maurizio Lombardi
    Cc: Tejun Heo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     
  • The kernel's printf doesn't follow the standards in a few corner cases
    (which are probably mostly irrelevant). Add tests that document the
    current behaviour.

    Signed-off-by: Rasmus Villemoes
    Cc: Al Viro
    Cc: Andy Shevchenko
    Cc: Ingo Molnar
    Cc: Joe Perches
    Cc: Kees Cook
    Cc: Maurizio Lombardi
    Cc: Tejun Heo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     
  • Add a few padding bytes on either side of the test buffer, and check
    that these (and the part of the buffer not used) are untouched by
    vsnprintf.

    Signed-off-by: Rasmus Villemoes
    Acked-by: Kees Cook
    Cc: Al Viro
    Cc: Andy Shevchenko
    Cc: Ingo Molnar
    Cc: Joe Perches
    Cc: Maurizio Lombardi
    Cc: Tejun Heo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     
  • BUG is a completely unnecessarily big hammer, and we're more likely to
    get the internal bug reported if we just pr_err() and ensure the test
    suite fails.

    Signed-off-by: Rasmus Villemoes
    Acked-by: Kees Cook
    Cc: Al Viro
    Cc: Andy Shevchenko
    Cc: Ingo Molnar
    Cc: Joe Perches
    Cc: Maurizio Lombardi
    Cc: Tejun Heo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     
  • kasprintf relies on being able to replay the formatting and getting the
    same result (in particular, the same length). This will almost always
    work, but it is possible that the object pointed to by a %s or %p
    argument changed under us (so we might get truncated output). Add a
    somewhat paranoid sanity check and let's see if it ever triggers.

    Signed-off-by: Rasmus Villemoes
    Cc: Al Viro
    Cc: Andy Shevchenko
    Cc: Ingo Molnar
    Cc: Joe Perches
    Cc: Kees Cook
    Cc: Maurizio Lombardi
    Cc: Tejun Heo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     
  • The field width is overloaded to pass some extra information for some %p
    extensions (e.g. #bits for %pb). But we might silently truncate the
    passed value when we stash it in struct printf_spec (see e.g.
    "lib/vsprintf.c: expand field_width to 24 bits"). Hopefully 23 value
    bits should now be enough for everybody, but if not, let's make some
    noise.

    Do the same for the precision. In both cases, clamping seems more
    sensible than truncating. While, according to POSIX, "A negative
    precision is taken as if the precision were omitted.", the kernel's
    printf has always treated that case as if the precision was 0, so we use
    that as lower bound. For the field width, the smallest representable
    value is actually -(1<
    Cc: Al Viro
    Cc: Andy Shevchenko
    Cc: Ingo Molnar
    Cc: Joe Perches
    Cc: Kees Cook
    Cc: Maurizio Lombardi
    Cc: Tejun Heo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     
  • One consequence of the reorganization of struct printf_spec to make
    field_width 24 bits was that number() gained about 180 bytes. Since
    spec is never passed to other functions, we can help gcc make number()
    lose most of that extra weight by using local variables for the field
    width and precision.

    Reviewed-by: Andy Shevchenko
    Signed-off-by: Rasmus Villemoes
    Cc: Al Viro
    Cc: Ingo Molnar
    Cc: Joe Perches
    Cc: Kees Cook
    Cc: Maurizio Lombardi
    Cc: Tejun Heo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     
  • Maurizio Lombardi reported a problem [1] with the %pb extension: It
    doesn't work for sufficiently large bitmaps, since the size is stashed
    in the field_width field of the struct printf_spec, which is currently
    an s16. Concretely, this manifested itself in
    /sys/bus/pseudo/drivers/scsi_debug/map being empty, since the bitmap
    printer got a size of 0, which is the 16 bit truncation of the actual
    bitmap size.

    We do want to keep struct printf_spec at 8 bytes so that it can cheaply
    be passed by value. The qualifier field is only used for internal
    bookkeeping in format_decode, so we might as well use a local variable
    for that. This gives us an additional 8 bits, which we can then use for
    the field width.

    To stay in 8 bytes, we need to do a little rearranging and make the type
    member a bitfield as well. For consistency, change all the members to
    bit fields. gcc doesn't generate much worse code with these changes (in
    fact, bloat-o-meter says we save 300 bytes - which I think is a little
    surprising).

    I didn't find a BUILD_BUG/compiletime_assertion/... which would work
    outside function context, so for now I just open-coded it.

    [1] http://thread.gmane.org/gmane.linux.kernel/2034835

    [akpm@linux-foundation.org: avoid open-coded BUILD_BUG_ON]
    Signed-off-by: Rasmus Villemoes
    Reported-by: Maurizio Lombardi
    Acked-by: Tejun Heo
    Cc: Al Viro
    Cc: Andy Shevchenko
    Cc: Ingo Molnar
    Cc: Joe Perches
    Cc: Kees Cook
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     
  • If the string corresponding to a %s specifier can change under us, we
    might end up copying a \0 byte to the output buffer. There might be
    callers who expect the output buffer to contain a genuine C string whose
    length is exactly the snprintf return value (assuming truncation hasn't
    happened or has been checked for).

    We can avoid this by only passing over the source string once, stopping
    the first time we meet a nul byte (or when we reach the given
    precision), and then letting widen_string() handle left/right space
    padding. As a small bonus, this code reuse also makes the generated
    code slightly smaller.

    Signed-off-by: Rasmus Villemoes
    Cc: Al Viro
    Cc: Andy Shevchenko
    Cc: Ingo Molnar
    Cc: Joe Perches
    Cc: Kees Cook
    Cc: Maurizio Lombardi
    Cc: Tejun Heo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     
  • This is pure code movement, making sure the widen_string() helper is
    defined before the string() function.

    Signed-off-by: Rasmus Villemoes
    Cc: Al Viro
    Cc: Andy Shevchenko
    Cc: Ingo Molnar
    Cc: Joe Perches
    Cc: Kees Cook
    Cc: Maurizio Lombardi
    Cc: Tejun Heo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     
  • Pull out the logic in dentry_name() which handles field width space
    padding, in preparation for reusing it from string(). Rename the
    widen() helper to move_right(), since it is used for handling the
    !(flags & LEFT) case.

    Signed-off-by: Rasmus Villemoes
    Cc: Al Viro
    Cc: Andy Shevchenko
    Cc: Ingo Molnar
    Cc: Joe Perches
    Cc: Kees Cook
    Cc: Maurizio Lombardi
    Cc: Tejun Heo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     
  • @console_may_schedule tracks whether console_sem was acquired through
    lock or trylock. If the former, we're inside a sleepable context and
    console_conditional_schedule() performs cond_resched(). This allows
    console drivers which use console_lock for synchronization to yield
    while performing time-consuming operations such as scrolling.

    However, the actual console outputting is performed while holding
    irq-safe logbuf_lock, so console_unlock() clears @console_may_schedule
    before starting outputting lines. Also, only a few drivers call
    console_conditional_schedule() to begin with. This means that when a
    lot of lines need to be output by console_unlock(), for example on a
    console registration, the task doing console_unlock() may not yield for
    a long time on a non-preemptible kernel.

    If this happens with a slow console devices, for example a serial
    console, the outputting task may occupy the cpu for a very long time.
    Long enough to trigger softlockup and/or RCU stall warnings, which in
    turn pile more messages, sometimes enough to trigger the next cycle of
    warnings incapacitating the system.

    Fix it by making console_unlock() insert cond_resched() between lines if
    @console_may_schedule.

    Signed-off-by: Tejun Heo
    Reported-by: Calvin Owens
    Acked-by: Jan Kara
    Cc: Dave Jones
    Cc: Kyle McMartin
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tejun Heo
     
  • Boot consoles are typically replaced by proper consoles during the boot
    process. This can be problematic if the boot console data is part of
    the init section that is reclaimed late during boot. If the proper
    console does not register before this point in time, the boot console
    will need to be removed (so that the freed memory is not accessed),
    leaving the system without output for some time.

    There are various reasons why the proper console may not register early
    enough, such as deferred probe or the driver being a loadable module.
    If that happens, there is some amount of time where no console messages
    are visible to the user, which in turn can mean that they won't see
    crashes or other potentially useful information.

    To avoid this situation, only remove the boot console when it resides in
    the init section. Code exists to replace the boot console by the proper
    console when it is registered, keeping a seamless transition between the
    boot and proper consoles.

    Signed-off-by: Thierry Reding
    Cc: Arnd Bergmann
    Cc: Greg Kroah-Hartman
    Cc: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Thierry Reding
     
  • Add a helper to check if an object (given an address and a size) is part
    of a section (given beginning and end addresses). For convenience, also
    provide a helper that performs this check for __init data using the
    __init_begin and __init_end limits.

    Signed-off-by: Thierry Reding
    Cc: Arnd Bergmann
    Cc: Greg Kroah-Hartman
    Cc: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Thierry Reding
     
  • stop_machine.o is only built if CONFIG_SMP=y, so this ifdef always
    evaluates to true.

    [akpm@linux-foundation.org: remove now-unneeded ifdef]
    Reported-by: Valentin Rothberg
    Cc: Chris Wilson
    Cc: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     
  • uselib hasn't been used since libc5; glibc does not use it. Deprecate
    uselib a bit more, by making the default y only if libc5 was widely used
    on the plaform.

    This makes arm64 kernel built with defconfig slightly smaller

    bloat-o-meter:
    add/remove: 0/3 grow/shrink: 0/2 up/down: 0/-1390 (-1390)
    function old new delta
    kernel_config_data 18164 18162 -2
    uselib_flags 20 - -20
    padzero 216 192 -24
    sys_uselib 380 - -380
    load_elf_library 964 - -964

    Signed-off-by: Riku Voipio
    Reviewed-by: Josh Triplett
    Acked-by: Geert Uytterhoeven
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Riku Voipio
     
  • IS_ERR_VALUE() already contains it and so we need to add this only to
    the !ptr check. That will allow users of IS_ERR_OR_NULL(), to not add
    this compiler flag.

    Signed-off-by: Viresh Kumar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Viresh Kumar
     
  • As illustrated by commit a3afe70b83fd ("[S390] latencytop s390
    support."), HAVE_LATENCYTOP_SUPPORT is defined by an architecture to
    advertise an implementation of save_stack_trace_tsk.

    However, as of 9212ddb5eada ("stacktrace: provide save_stack_trace_tsk()
    weak alias") a dummy implementation is provided if STACKTRACE=y. Given
    that LATENCYTOP already depends on STACKTRACE_SUPPORT and selects
    STACKTRACE, we can remove HAVE_LATENCYTOP_SUPPORT altogether.

    Signed-off-by: Will Deacon
    Acked-by: Heiko Carstens
    Cc: Vineet Gupta
    Cc: Russell King
    Cc: James Hogan
    Cc: Michal Simek
    Cc: Helge Deller
    Acked-by: Michael Ellerman
    Cc: "David S. Miller"
    Cc: Guan Xuetao
    Cc: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Will Deacon