16 Jun, 2018

15 commits


15 Jun, 2018

25 commits

  • Changeset 9919cba7ff71 ("watchdog: Update documentation") updated
    the documentation, removing the old nmi_watchdog.txt and adding
    a file with a new content.

    Update Kconfig files accordingly.

    Fixes: 9919cba7ff71 ("watchdog: Update documentation")

    Signed-off-by: Mauro Carvalho Chehab
    Acked-by: Jonathan Corbet

    Mauro Carvalho Chehab
     
  • ./Documentation/crypto/crypto_engine.rst:13: WARNING: Unexpected indentation.
    ./Documentation/crypto/crypto_engine.rst:15: WARNING: Block quote ends without a blank line; unexpected unindent.

    Signed-off-by: Mauro Carvalho Chehab
    Acked-by: Jonathan Corbet

    Mauro Carvalho Chehab
     
  • As stated at:
    http://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#footnotes

    A footnote should contain either a number, a reference or
    an auto number, e. g.:
    [1], [#f1] or [#].

    While using [*] accidentaly works for html, it fails for other
    document outputs. In particular, it causes an error with LaTeX
    output, causing all books after networking to not be built.

    So, replace it by a valid syntax.

    Acked-by: Oliver Hartkopp
    Signed-off-by: Mauro Carvalho Chehab
    Acked-by: Jonathan Corbet

    Mauro Carvalho Chehab
     
  • …nel/git/shuah/linux-kselftest

    Pull more Kselftest updates from Shuah Khan:

    - fix a signedness bug in cgroups test

    - add ppc support for kprobe args tests

    * tag 'linux-kselftest-4.18-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
    kselftest/cgroup: fix a signedness bug
    selftests/ftrace: Add ppc support for kprobe args tests

    Linus Torvalds
     
  • Pull sound fixes from Takashi Iwai:
    "Here is a collection of small fixes on top of the previous update.

    All small and obvious fixes. Mostly for usual suspects, USB-audio and
    HD-audio, but a few trivial error handling fixes for misc drivers as
    well"

    * tag 'sound-fix-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
    ALSA: usb-audio: Always create the interrupt pipe for the mixer
    ALSA: usb-audio: Add insertion control for UAC3 BADD
    ALSA: usb-audio: Change in connectors control creation interface
    ALSA: usb-audio: Add bi-directional terminal types
    ALSA: lx6464es: add error handling for pci_ioremap_bar
    ALSA: sonicvibes: add error handling for snd_ctl_add
    ALSA: usb-audio: Remove explicitly listed Mytek devices
    ALSA: usb-audio: Generic DSD detection for XMOS-based implementations
    ALSA: usb-audio: Add native DSD support for Mytek DACs
    ALSA: hda/realtek - Add shutup hint
    ALSA: usb-audio: Disable the quirk for Nura headset
    ALSA: hda: add dock and led support for HP ProBook 640 G4
    ALSA: hda: add dock and led support for HP EliteBook 830 G5
    ALSA: emu10k1: add error handling for snd_ctl_add
    ALSA: fm801: add error handling for snd_ctl_add

    Linus Torvalds
     
  • Pull amd drm fixes from Dave Airlie:
    "Just a single set of AMD fixes for stuff in -next for -rc1"

    * tag 'drm-next-2018-06-15' of git://anongit.freedesktop.org/drm/drm: (47 commits)
    drm/amd/powerplay: Set higher SCLK&MCLK frequency than dpm7 in OD (v2)
    drm/amd/powerplay: remove uncessary extra gfxoff control call
    drm/amdgpu: fix parsing indirect register list v2
    drm/amd/include: Update df 3.6 mask and shift definition
    drm/amd/pp: Fix OD feature enable failed on Vega10 workstation cards
    drm/amd/display: Fix stale buffer object (bo) use
    drm/amd/pp: initialize result to before or'ing in data
    drm/amd/powerplay: fix wrong clock adjust sequence
    drm/amdgpu: Grab/put runtime PM references in atomic_commit_tail()
    drm/amd/powerplay: fix missed hwmgr check warning before call gfx_off_control handler
    drm/amdgpu: fix CG enabling hang with gfxoff enabled
    drm/amdgpu: fix clear_all and replace handling in the VM (v2)
    drm/amdgpu: add checking for sos version
    drm/amdgpu: fix the missed vcn fw version report
    Revert "drm/amdgpu: Add an ATPX quirk for hybrid laptop"
    drm/amdgpu/df: fix potential array out-of-bounds read
    drm/amdgpu: Fix NULL pointer when load kfd driver with PP block is disabled
    drm/gfx9: Update gc goldensetting for vega20.
    drm/amd/pp: Allow underclocking when od table is empty in vbios
    drm/amdgpu/display: check if ppfuncs exists before using it
    ...

    Linus Torvalds
     
  • Fixes for 4.18. Highlights:
    - Fixes for gfxoff on Raven
    - Remove an ATPX quirk now that the root cause is fixed
    - Runtime PM fixes
    - Vega20 register header update
    - Wattman fixes
    - Misc bug fixes

    Signed-off-by: Dave Airlie
    Link: https://patchwork.freedesktop.org/patch/msgid/20180614141428.2909-1-alexander.deucher@amd.com

    Dave Airlie
     
  • Merge more updates from Andrew Morton:

    - MM remainders

    - various misc things

    - kcov updates

    * emailed patches from Andrew Morton : (27 commits)
    lib/test_printf.c: call wait_for_random_bytes() before plain %p tests
    hexagon: drop the unused variable zero_page_mask
    hexagon: fix printk format warning in setup.c
    mm: fix oom_kill event handling
    treewide: use PHYS_ADDR_MAX to avoid type casting ULLONG_MAX
    mm: use octal not symbolic permissions
    ipc: use new return type vm_fault_t
    sysvipc/sem: mitigate semnum index against spectre v1
    fault-injection: reorder config entries
    arm: port KCOV to arm
    sched/core / kcov: avoid kcov_area during task switch
    kcov: prefault the kcov_area
    kcov: ensure irq code sees a valid area
    kernel/relay.c: change return type to vm_fault_t
    exofs: avoid VLA in structures
    coredump: fix spam with zero VMA process
    fat: use fat_fs_error() instead of BUG_ON() in __fat_get_block()
    proc: skip branch in /proc/*/* lookup
    mremap: remove LATENCY_LIMIT from mremap to reduce the number of TLB shootdowns
    mm/memblock: add missing include
    ...

    Linus Torvalds
     
  • If the test_printf module is loaded before the crng is initialized, the
    plain 'p' tests will fail because the printed address will not be hashed
    and the buffer will contain '(ptrval)' instead.

    This patch adds a call to wait_for_random_bytes() before plain 'p' tests
    to make sure the crng is initialized.

    Link: http://lkml.kernel.org/r/20180604113708.11554-1-thierry.escande@linaro.org
    Signed-off-by: Thierry Escande
    Acked-by: Tobin C. Harding
    Reviewed-by: Andrew Morton
    Cc: David Miller
    Cc: Rasmus Villemoes
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Thierry Escande
     
  • Hexagon arch does not seem to have subscribed to _HAVE_COLOR_ZERO_PAGE
    framework. Hence zero_page_mask variable is not needed.

    Link: http://lkml.kernel.org/r/20180517061105.30447-1-khandual@linux.vnet.ibm.com
    Signed-off-by: Anshuman Khandual
    Reviewed-by: Andrew Morton
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Anshuman Khandual
     
  • Fix printk format warning in hexagon/kernel/setup.c:

    ../arch/hexagon/kernel/setup.c: In function 'setup_arch':
    ../arch/hexagon/kernel/setup.c:69:2: warning: format '%x' expects argument of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat]

    where:
    extern unsigned long __phys_offset;
    #define PHYS_OFFSET __phys_offset

    Link: http://lkml.kernel.org/r/adce8db5-4b01-dc10-7fbb-6a64e0787eb5@infradead.org
    Signed-off-by: Randy Dunlap
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Randy Dunlap
     
  • Commit e27be240df53 ("mm: memcg: make sure memory.events is uptodate
    when waking pollers") converted most of memcg event counters to
    per-memcg atomics, which made them less confusing for a user. The
    "oom_kill" counter remained untouched, so now it behaves differently
    than other counters (including "oom"). This adds nothing but confusion.

    Let's fix this by adding the MEMCG_OOM_KILL event, and follow the
    MEMCG_OOM approach.

    This also removes a hack from count_memcg_event_mm(), introduced earlier
    specially for the OOM_KILL counter.

    [akpm@linux-foundation.org: fix for droppage of memcg-replace-mm-owner-with-mm-memcg.patch]
    Link: http://lkml.kernel.org/r/20180508124637.29984-1-guro@fb.com
    Signed-off-by: Roman Gushchin
    Acked-by: Konstantin Khlebnikov
    Acked-by: Johannes Weiner
    Acked-by: Michal Hocko
    Cc: Vladimir Davydov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Roman Gushchin
     
  • With PHYS_ADDR_MAX there is now a type safe variant for all bits set.
    Make use of it.

    Patch created using a semantic patch as follows:

    //
    @@
    typedef phys_addr_t;
    @@
    -(phys_addr_t)ULLONG_MAX
    +PHYS_ADDR_MAX
    //

    Link: http://lkml.kernel.org/r/20180419214204.19322-1-stefan@agner.ch
    Signed-off-by: Stefan Agner
    Reviewed-by: Andrew Morton
    Acked-by: Ard Biesheuvel
    Acked-by: Catalin Marinas [arm64]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Stefan Agner
     
  • mm/*.c files use symbolic and octal styles for permissions.

    Using octal and not symbolic permissions is preferred by many as more
    readable.

    https://lkml.org/lkml/2016/8/2/1945

    Prefer the direct use of octal for permissions.

    Done using
    $ scripts/checkpatch.pl -f --types=SYMBOLIC_PERMS --fix-inplace mm/*.c
    and some typing.

    Before: $ git grep -P -w "0[0-7]{3,3}" mm | wc -l
    44
    After: $ git grep -P -w "0[0-7]{3,3}" mm | wc -l
    86

    Miscellanea:

    o Whitespace neatening around these conversions.

    Link: http://lkml.kernel.org/r/2e032ef111eebcd4c5952bae86763b541d373469.1522102887.git.joe@perches.com
    Signed-off-by: Joe Perches
    Acked-by: David Rientjes
    Acked-by: Michal Hocko
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Use new return type vm_fault_t for fault handler. For now, this is just
    documenting that the function returns a VM_FAULT value rather than an
    errno. Once all instances are converted, vm_fault_t will become a
    distinct type.

    Commit 1c8f422059ae ("mm: change return type to vm_fault_t")

    Link: http://lkml.kernel.org/r/20180425043413.GA21467@jordon-HP-15-Notebook-PC
    Signed-off-by: Souptick Joarder
    Reviewed-by: Matthew Wilcox
    Reviewed-by: Andrew Morton
    Acked-by: Davidlohr Bueso
    Cc: Manfred Spraul
    Cc: Eric W. Biederman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Souptick Joarder
     
  • Both smatch and coverity are reporting potential issues with spectre
    variant 1 with the 'semnum' index within the sma->sems array, ie:

    ipc/sem.c:388 sem_lock() warn: potential spectre issue 'sma->sems'
    ipc/sem.c:641 perform_atomic_semop_slow() warn: potential spectre issue 'sma->sems'
    ipc/sem.c:721 perform_atomic_semop() warn: potential spectre issue 'sma->sems'

    Avoid any possible speculation by using array_index_nospec() thus
    ensuring the semnum value is bounded to [0, sma->sem_nsems). With the
    exception of sem_lock() all of these are slowpaths.

    Link: http://lkml.kernel.org/r/20180423171131.njs4rfm2yzyeg6do@linux-n805
    Signed-off-by: Davidlohr Bueso
    Reported-by: Dan Carpenter
    Cc: Peter Zijlstra
    Cc: "Gustavo A. R. Silva"
    Cc: Manfred Spraul
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Davidlohr Bueso
     
  • Reorder Kconfig entries, so that menuconfig displays proper indentation.

    Link: http://lkml.kernel.org/r/alpine.LRH.2.02.1804251601160.30569@file01.intranet.prod.int.rdu2.redhat.com
    Signed-off-by: Mikulas Patocka
    Acked-by: Randy Dunlap
    Tested-by: Randy Dunlap
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mikulas Patocka
     
  • KCOV is code coverage collection facility used, in particular, by
    syzkaller system call fuzzer. There is some interest in using syzkaller
    on arm devices. So port KCOV to arm.

    On implementation level this merely declares that KCOV is supported and
    disables instrumentation of 3 special cases. Reasons for disabling are
    commented in code.

    Tested with qemu-system-arm/vexpress-a15.

    Link: http://lkml.kernel.org/r/20180511143248.112484-1-dvyukov@google.com
    Signed-off-by: Dmitry Vyukov
    Acked-by: Mark Rutland
    Cc: Russell King
    Cc: Abbott Liu
    Cc: Catalin Marinas
    Cc: Koguchi Takuo
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dmitry Vyukov
     
  • During a context switch, we first switch_mm() to the next task's mm,
    then switch_to() that new task. This means that vmalloc'd regions which
    had previously been faulted in can transiently disappear in the context
    of the prev task.

    Functions instrumented by KCOV may try to access a vmalloc'd kcov_area
    during this window, and as the fault handling code is instrumented, this
    results in a recursive fault.

    We must avoid accessing any kcov_area during this window. We can do so
    with a new flag in kcov_mode, set prior to switching the mm, and cleared
    once the new task is live. Since task_struct::kcov_mode isn't always a
    specific enum kcov_mode value, this is made an unsigned int.

    The manipulation is hidden behind kcov_{prepare,finish}_switch() helpers,
    which are empty for !CONFIG_KCOV kernels.

    The code uses macros because I can't use static inline functions without a
    circular include dependency between and ,
    since the definition of task_struct uses things defined in

    Link: http://lkml.kernel.org/r/20180504135535.53744-4-mark.rutland@arm.com
    Signed-off-by: Mark Rutland
    Acked-by: Andrey Ryabinin
    Cc: Dmitry Vyukov
    Cc: Ingo Molnar
    Cc: Peter Zijlstra
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mark Rutland
     
  • On many architectures the vmalloc area is lazily faulted in upon first
    access. This is problematic for KCOV, as __sanitizer_cov_trace_pc
    accesses the (vmalloc'd) kcov_area, and fault handling code may be
    instrumented. If an access to kcov_area faults, this will result in
    mutual recursion through the fault handling code and
    __sanitizer_cov_trace_pc(), eventually leading to stack corruption
    and/or overflow.

    We can avoid this by faulting in the kcov_area before
    __sanitizer_cov_trace_pc() is permitted to access it. Once it has been
    faulted in, it will remain present in the process page tables, and will
    not fault again.

    [akpm@linux-foundation.org: code cleanup]
    [akpm@linux-foundation.org: add comment explaining kcov_fault_in_area()]
    [akpm@linux-foundation.org: fancier code comment from Mark]
    Link: http://lkml.kernel.org/r/20180504135535.53744-3-mark.rutland@arm.com
    Signed-off-by: Mark Rutland
    Acked-by: Andrey Ryabinin
    Cc: Dmitry Vyukov
    Cc: Ingo Molnar
    Cc: Peter Zijlstra
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mark Rutland
     
  • Patch series "kcov: fix unexpected faults".

    These patches fix a few issues where KCOV code could trigger recursive
    faults, discovered while debugging a patch enabling KCOV for arch/arm:

    * On CONFIG_PREEMPT kernels, there's a small race window where
    __sanitizer_cov_trace_pc() can see a bogus kcov_area.

    * Lazy faulting of the vmalloc area can cause mutual recursion between
    fault handling code and __sanitizer_cov_trace_pc().

    * During the context switch, switching the mm can cause the kcov_area to
    be transiently unmapped.

    These are prerequisites for enabling KCOV on arm, but the issues
    themsevles are generic -- we just happen to avoid them by chance rather
    than design on x86-64 and arm64.

    This patch (of 3):

    For kernels built with CONFIG_PREEMPT, some C code may execute before or
    after the interrupt handler, while the hardirq count is zero. In these
    cases, in_task() can return true.

    A task can be interrupted in the middle of a KCOV_DISABLE ioctl while it
    resets the task's kcov data via kcov_task_init(). Instrumented code
    executed during this period will call __sanitizer_cov_trace_pc(), and as
    in_task() returns true, will inspect t->kcov_mode before trying to write
    to t->kcov_area.

    In kcov_init_task() we update t->kcov_{mode,area,size} with plain stores,
    which may be re-ordered, torn, etc. Thus __sanitizer_cov_trace_pc() may
    see bogus values for any of these fields, and may attempt to write to
    memory which is not mapped.

    Let's avoid this by using WRITE_ONCE() to set t->kcov_mode, with a
    barrier() to ensure this is ordered before we clear t->kov_{area,size}.
    This ensures that any code execute while kcov_init_task() is preempted
    will either see valid values for t->kcov_{area,size}, or will see that
    t->kcov_mode is KCOV_MODE_DISABLED, and bail out without touching
    t->kcov_area.

    Link: http://lkml.kernel.org/r/20180504135535.53744-2-mark.rutland@arm.com
    Signed-off-by: Mark Rutland
    Acked-by: Andrey Ryabinin
    Cc: Dmitry Vyukov
    Cc: Ingo Molnar
    Cc: Peter Zijlstra
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mark Rutland
     
  • Use new return type vm_fault_t for fault handler. For now, this is just
    documenting that the function returns a VM_FAULT value rather than an
    errno. Once all instances are converted, vm_fault_t will become a
    distinct type.

    commit 1c8f422059ae ("mm: change return type to vm_fault_t")

    Link: http://lkml.kernel.org/r/20180510140335.GA25363@jordon-HP-15-Notebook-PC
    Signed-off-by: Souptick Joarder
    Reviewed-by: Matthew Wilcox
    Reviewed-by: Andrew Morton
    Cc: Eric Biggers
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Souptick Joarder
     
  • On the quest to remove all VLAs from the kernel[1] this adjusts several
    cases where allocation is made after an array of structures that points
    back into the allocation. The allocations are changed to perform
    explicit calculations instead of using a Variable Length Array in a
    structure.

    Additionally, this lets Clang compile this code now, since Clang does
    not support VLAIS[2].

    [1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qPXydAacU1RqZWA@mail.gmail.com
    [2] https://lkml.kernel.org/r/CA+55aFy6h1c3_rP_bXFedsTXzwW+9Q9MfJaW7GUmMBrAp-fJ9A@mail.gmail.com

    [keescook@chromium.org: v2]
    Link: http://lkml.kernel.org/r/20180418163546.GA45794@beast
    Link: http://lkml.kernel.org/r/20180327203904.GA1151@beast
    Signed-off-by: Kees Cook
    Reviewed-by: Nick Desaulniers
    Cc: Boaz Harrosh
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kees Cook
     
  • Nobody ever tried to self destruct by unmapping whole address space at
    once:

    munmap((void *)0, (1ULL << 47) - 4096);

    Doing this produces 2 warnings for zero-length vmalloc allocations:

    a.out[1353]: segfault at 7f80bcc4b757 ip 00007f80bcc4b757 sp 00007fff683939b8 error 14
    a.out: vmalloc: allocation failure: 0 bytes, mode:0xcc0(GFP_KERNEL), nodemask=(null)
    ...
    a.out: vmalloc: allocation failure: 0 bytes, mode:0xcc0(GFP_KERNEL), nodemask=(null)
    ...

    Fix is to switch to kvmalloc().

    Steps to reproduce:

    // vsyscall=none
    #include
    #include
    int main(void)
    {
    setrlimit(RLIMIT_CORE, &(struct rlimit){RLIM_INFINITY, RLIM_INFINITY});
    munmap((void *)0, (1ULL << 47) - 4096);
    return 0;
    }

    Link: http://lkml.kernel.org/r/20180410180353.GA2515@avx2
    Signed-off-by: Alexey Dobriyan
    Reviewed-by: Andrew Morton
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     
  • If file size and FAT cluster chain is not matched (corrupted image), we
    can hit BUG_ON(!phys) in __fat_get_block().

    So, use fat_fs_error() instead.

    [hirofumi@mail.parknet.co.jp: fix printk warning]
    Link: http://lkml.kernel.org/r/87po12aq5p.fsf@mail.parknet.co.jp
    Link: http://lkml.kernel.org/r/874lilcu67.fsf@mail.parknet.co.jp
    Signed-off-by: OGAWA Hirofumi
    Reported-by: Anatoly Trosinenko
    Tested-by: Anatoly Trosinenko
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi