08 Feb, 2018

1 commit

  • commit fd6e440f20b1a4304553775fc55938848ff617c9 upstream.

    The recent commit 87590ce6e373 ("sysfs/cpu: Add vulnerability folder")
    added a generic folder and set of files for reporting information on
    CPU vulnerabilities. One of those was for meltdown:

    /sys/devices/system/cpu/vulnerabilities/meltdown

    This commit wires up that file for 64-bit Book3S powerpc.

    For now we default to "Vulnerable" unless the RFI flush is enabled.
    That may not actually be true on all hardware, further patches will
    refine the reporting based on the CPU/platform etc. But for now we
    default to being pessimists.

    Signed-off-by: Michael Ellerman
    Signed-off-by: Greg Kroah-Hartman

    Michael Ellerman
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

08 Sep, 2017

1 commit

  • Pull powerpc updates from Michael Ellerman:
    "Nothing really major this release, despite quite a lot of activity.
    Just lots of things all over the place.

    Some things of note include:

    - Access via perf to a new type of PMU (IMC) on Power9, which can
    count both core events as well as nest unit events (Memory
    controller etc).

    - Optimisations to the radix MMU TLB flushing, mostly to avoid
    unnecessary Page Walk Cache (PWC) flushes when the structure of the
    tree is not changing.

    - Reworks/cleanups of do_page_fault() to modernise it and bring it
    closer to other architectures where possible.

    - Rework of our page table walking so that THP updates only need to
    send IPIs to CPUs where the affected mm has run, rather than all
    CPUs.

    - The size of our vmalloc area is increased to 56T on 64-bit hash MMU
    systems. This avoids problems with the percpu allocator on systems
    with very sparse NUMA layouts.

    - STRICT_KERNEL_RWX support on PPC32.

    - A new sched domain topology for Power9, to capture the fact that
    pairs of cores may share an L2 cache.

    - Power9 support for VAS, which is a new mechanism for accessing
    coprocessors, and initial support for using it with the NX
    compression accelerator.

    - Major work on the instruction emulation support, adding support for
    many new instructions, and reworking it so it can be used to
    implement the emulation needed to fixup alignment faults.

    - Support for guests under PowerVM to use the Power9 XIVE interrupt
    controller.

    And probably that many things again that are almost as interesting,
    but I had to keep the list short. Plus the usual fixes and cleanups as
    always.

    Thanks to: Alexey Kardashevskiy, Alistair Popple, Andreas Schwab,
    Aneesh Kumar K.V, Anju T Sudhakar, Arvind Yadav, Balbir Singh,
    Benjamin Herrenschmidt, Bhumika Goyal, Breno Leitao, Bryant G. Ly,
    Christophe Leroy, Cédric Le Goater, Dan Carpenter, Dou Liyang,
    Frederic Barrat, Gautham R. Shenoy, Geliang Tang, Geoff Levand, Hannes
    Reinecke, Haren Myneni, Ivan Mikhaylov, John Allen, Julia Lawall,
    LABBE Corentin, Laurentiu Tudor, Madhavan Srinivasan, Markus Elfring,
    Masahiro Yamada, Matt Brown, Michael Neuling, Murilo Opsfelder Araujo,
    Nathan Fontenot, Naveen N. Rao, Nicholas Piggin, Oliver O'Halloran,
    Paul Mackerras, Rashmica Gupta, Rob Herring, Rui Teng, Sam Bobroff,
    Santosh Sivaraj, Scott Wood, Shilpasri G Bhat, Sukadev Bhattiprolu,
    Suraj Jitindar Singh, Tobin C. Harding, Victor Aoqui"

    * tag 'powerpc-4.14-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (321 commits)
    powerpc/xive: Fix section __init warning
    powerpc: Fix kernel crash in emulation of vector loads and stores
    powerpc/xive: improve debugging macros
    powerpc/xive: add XIVE Exploitation Mode to CAS
    powerpc/xive: introduce H_INT_ESB hcall
    powerpc/xive: add the HW IRQ number under xive_irq_data
    powerpc/xive: introduce xive_esb_write()
    powerpc/xive: rename xive_poke_esb() in xive_esb_read()
    powerpc/xive: guest exploitation of the XIVE interrupt controller
    powerpc/xive: introduce a common routine xive_queue_page_alloc()
    powerpc/sstep: Avoid used uninitialized error
    axonram: Return directly after a failed kzalloc() in axon_ram_probe()
    axonram: Improve a size determination in axon_ram_probe()
    axonram: Delete an error message for a failed memory allocation in axon_ram_probe()
    powerpc/powernv/npu: Move tlb flush before launching ATSD
    powerpc/macintosh: constify wf_sensor_ops structures
    powerpc/iommu: Use permission-specific DEVICE_ATTR variants
    powerpc/eeh: Delete an error out of memory message at init time
    powerpc/mm: Use seq_putc() in two functions
    macintosh: Convert to using %pOF instead of full_name
    ...

    Linus Torvalds
     

01 Sep, 2017

1 commit

  • This replaces almost all of the instruction emulation code in
    fix_alignment() with calls to analyse_instr(), emulate_loadstore()
    and emulate_dcbz(). The only emulation code left is the SPE
    emulation code; analyse_instr() etc. do not handle SPE instructions
    at present.

    One result of this is that we can now handle alignment faults on
    all the new VSX load and store instructions that were added in POWER9.
    VSX loads/stores will take alignment faults for unaligned accesses
    to cache-inhibited memory.

    Another effect is that we no longer rely on the DAR and DSISR values
    set by the processor.

    With this, we now need to include the instruction emulation code
    unconditionally.

    Signed-off-by: Paul Mackerras
    Signed-off-by: Michael Ellerman

    Paul Mackerras
     

19 Aug, 2017

1 commit

  • Commit 05a4a9527931 ("kernel/watchdog: split up config options") lost
    the perf-based hardlockup detector's dependency on PERF_EVENTS, which
    can result in broken builds with some powerpc configurations.

    Restore the dependency. Add it in for x86 too, despite x86 always
    selecting PERF_EVENTS it seems reasonable to make the dependency
    explicit.

    Link: http://lkml.kernel.org/r/20170810114452.6673-1-npiggin@gmail.com
    Fixes: 05a4a9527931 ("kernel/watchdog: split up config options")
    Signed-off-by: Nicholas Piggin
    Acked-by: Don Zickus
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Nicholas Piggin
     

15 Aug, 2017

3 commits


14 Aug, 2017

1 commit

  • Commit 968159c0031ac ("powerpc/8xx: Getting rid of remaining use of
    CONFIG_8xx") removed all but 2 references to 8xx in Kconfigs.

    This patch removes the two remaining ones.

    Fixes: 968159c0031a ("powerpc/8xx: Getting rid of remaining use of CONFIG_8xx")
    Signed-off-by: Christophe Leroy
    Signed-off-by: Michael Ellerman

    Christophe Leroy
     

10 Aug, 2017

3 commits

  • Two config options exist to define powerpc MPC8xx:
    * CONFIG_PPC_8xx
    * CONFIG_8xx

    arch/powerpc/platforms/Kconfig.cputype has contained the following
    comment about CONFIG_8xx item for some years:
    "# this is temp to handle compat with arch=ppc"

    arch/powerpc is now the only place with remaining use of
    CONFIG_8xx: get rid of them.

    Signed-off-by: Christophe Leroy
    Signed-off-by: Michael Ellerman

    Christophe Leroy
     
  • 4xx, CPM2 and 8xx cannot be selected at the same time, so
    no need to test 8xx && !4xx && !CPM2. Testing 8xx is enough.

    Signed-off-by: Christophe Leroy
    Signed-off-by: Michael Ellerman

    Christophe Leroy
     
  • The powerpc kernel/watchdog.o should be built when HARDLOCKUP_DETECTOR
    and HAVE_HARDLOCKUP_DETECTOR_ARCH are both selected. If only the former
    is selected, then the generic perf watchdog has been selected.

    To simplify this check, introduce a new Kconfig symbol PPC_WATCHDOG that
    depends on both. This Kconfig option means the powerpc specific
    watchdog is enabled.

    Without this patch, Book3E will attempt to build the powerpc watchdog.

    Fixes: 2104180a53 ("powerpc/64s: implement arch-specific hardlockup watchdog")
    Signed-off-by: Nicholas Piggin
    Signed-off-by: Michael Ellerman

    Nicholas Piggin
     

13 Jul, 2017

3 commits

  • This adds support for compiling with a rough equivalent to the glibc
    _FORTIFY_SOURCE=1 feature, providing compile-time and runtime buffer
    overflow checks for string.h functions when the compiler determines the
    size of the source or destination buffer at compile-time. Unlike glibc,
    it covers buffer reads in addition to writes.

    GNU C __builtin_*_chk intrinsics are avoided because they would force a
    much more complex implementation. They aren't designed to detect read
    overflows and offer no real benefit when using an implementation based
    on inline checks. Inline checks don't add up to much code size and
    allow full use of the regular string intrinsics while avoiding the need
    for a bunch of _chk functions and per-arch assembly to avoid wrapper
    overhead.

    This detects various overflows at compile-time in various drivers and
    some non-x86 core kernel code. There will likely be issues caught in
    regular use at runtime too.

    Future improvements left out of initial implementation for simplicity,
    as it's all quite optional and can be done incrementally:

    * Some of the fortified string functions (strncpy, strcat), don't yet
    place a limit on reads from the source based on __builtin_object_size of
    the source buffer.

    * Extending coverage to more string functions like strlcat.

    * It should be possible to optionally use __builtin_object_size(x, 1) for
    some functions (C strings) to detect intra-object overflows (like
    glibc's _FORTIFY_SOURCE=2), but for now this takes the conservative
    approach to avoid likely compatibility issues.

    * The compile-time checks should be made available via a separate config
    option which can be enabled by default (or always enabled) once enough
    time has passed to get the issues it catches fixed.

    Kees said:
    "This is great to have. While it was out-of-tree code, it would have
    blocked at least CVE-2016-3858 from being exploitable (improper size
    argument to strlcpy()). I've sent a number of fixes for
    out-of-bounds-reads that this detected upstream already"

    [arnd@arndb.de: x86: fix fortified memcpy]
    Link: http://lkml.kernel.org/r/20170627150047.660360-1-arnd@arndb.de
    [keescook@chromium.org: avoid panic() in favor of BUG()]
    Link: http://lkml.kernel.org/r/20170626235122.GA25261@beast
    [keescook@chromium.org: move from -mm, add ARCH_HAS_FORTIFY_SOURCE, tweak Kconfig help]
    Link: http://lkml.kernel.org/r/20170526095404.20439-1-danielmicay@gmail.com
    Link: http://lkml.kernel.org/r/1497903987-21002-8-git-send-email-keescook@chromium.org
    Signed-off-by: Daniel Micay
    Signed-off-by: Kees Cook
    Signed-off-by: Arnd Bergmann
    Acked-by: Kees Cook
    Cc: Mark Rutland
    Cc: Daniel Axtens
    Cc: Rasmus Villemoes
    Cc: Andy Shevchenko
    Cc: Chris Metcalf
    Cc: Thomas Gleixner
    Cc: "H. Peter Anvin"
    Cc: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Daniel Micay
     
  • Implement an arch-speicfic watchdog rather than use the perf-based
    hardlockup detector.

    The new watchdog takes the soft-NMI directly, rather than going through
    perf. Perf interrupts are to be made maskable in future, so that would
    prevent the perf detector from working in those regions.

    Additionally, implement a SMP based detector where all CPUs watch one
    another by pinging a shared cpumask. This is because powerpc Book3S
    does not have a true periodic local NMI, but some platforms do implement
    a true NMI IPI.

    If a CPU is stuck with interrupts hard disabled, the soft-NMI watchdog
    does not work, but the SMP watchdog will. Even on platforms without a
    true NMI IPI to get a good trace from the stuck CPU, other CPUs will
    notice the lockup sufficiently to report it and panic.

    [npiggin@gmail.com: honor watchdog disable at boot/hotplug]
    Link: http://lkml.kernel.org/r/20170621001346.5bb337c9@roar.ozlabs.ibm.com
    [npiggin@gmail.com: fix false positive warning at CPU unplug]
    Link: http://lkml.kernel.org/r/20170630080740.20766-1-npiggin@gmail.com
    [akpm@linux-foundation.org: coding-style fixes]
    Link: http://lkml.kernel.org/r/20170616065715.18390-6-npiggin@gmail.com
    Signed-off-by: Nicholas Piggin
    Reviewed-by: Don Zickus
    Tested-by: Babu Moger [sparc]
    Cc: Benjamin Herrenschmidt
    Cc: Paul Mackerras
    Cc: Michael Ellerman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Nicholas Piggin
     
  • Split SOFTLOCKUP_DETECTOR from LOCKUP_DETECTOR, and split
    HARDLOCKUP_DETECTOR_PERF from HARDLOCKUP_DETECTOR.

    LOCKUP_DETECTOR implies the general boot, sysctl, and programming
    interfaces for the lockup detectors.

    An architecture that wants to use a hard lockup detector must define
    HAVE_HARDLOCKUP_DETECTOR_PERF or HAVE_HARDLOCKUP_DETECTOR_ARCH.

    Alternatively an arch can define HAVE_NMI_WATCHDOG, which provides the
    minimum arch_touch_nmi_watchdog, and it otherwise does its own thing and
    does not implement the LOCKUP_DETECTOR interfaces.

    sparc is unusual in that it has started to implement some of the
    interfaces, but not fully yet. It should probably be converted to a full
    HAVE_HARDLOCKUP_DETECTOR_ARCH.

    [npiggin@gmail.com: fix]
    Link: http://lkml.kernel.org/r/20170617223522.66c0ad88@roar.ozlabs.ibm.com
    Link: http://lkml.kernel.org/r/20170616065715.18390-4-npiggin@gmail.com
    Signed-off-by: Nicholas Piggin
    Reviewed-by: Don Zickus
    Reviewed-by: Babu Moger
    Tested-by: Babu Moger [sparc]
    Cc: Benjamin Herrenschmidt
    Cc: Paul Mackerras
    Cc: Michael Ellerman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Nicholas Piggin
     

08 Jul, 2017

2 commits

  • …/masahiroy/linux-kbuild

    Pull Kbuild thin archives updates from Masahiro Yamada:
    "Thin archives migration by Nicholas Piggin.

    THIN_ARCHIVES has been available for a while as an optional feature
    only for PowerPC architecture, but we do not need two different
    intermediate-artifact schemes.

    Using thin archives instead of conventional incremental linking has
    various advantages:

    - save disk space for builds

    - speed-up building a little

    - fix some link issues (for example, allyesconfig on ARM) due to more
    flexibility for the final linking

    - work better with dead code elimination we are planning

    As discussed before, this migration has been done unconditionally so
    that any problems caused by this will show up with "git bisect".

    With testing with 0-day and linux-next, some architectures actually
    showed up problems, but they were trivial and all fixed now"

    * tag 'kbuild-thinar-v4.13' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
    tile: remove unneeded extra-y in Makefile
    kbuild: thin archives make default for all archs
    x86/um: thin archives build fix
    tile: thin archives fix linking
    ia64: thin archives fix linking
    sh: thin archives fix linking
    kbuild: handle libs-y archives separately from built-in.o archives
    kbuild: thin archives use P option to ar
    kbuild: thin archives final link close --whole-archives option
    ia64: remove unneeded extra-y in Makefile.gate
    tile: fix dependency and .*.cmd inclusion for incremental build
    sparc64: Use indirect calls in hamming weight stubs

    Linus Torvalds
     
  • Pull powerpc updates from Michael Ellerman:
    "Highlights include:

    - Support for STRICT_KERNEL_RWX on 64-bit server CPUs.

    - Platform support for FSP2 (476fpe) board

    - Enable ZONE_DEVICE on 64-bit server CPUs.

    - Generic & powerpc spin loop primitives to optimise busy waiting

    - Convert VDSO update function to use new update_vsyscall() interface

    - Optimisations to hypercall/syscall/context-switch paths

    - Improvements to the CPU idle code on Power8 and Power9.

    As well as many other fixes and improvements.

    Thanks to: Akshay Adiga, Andrew Donnellan, Andrew Jeffery, Anshuman
    Khandual, Anton Blanchard, Balbir Singh, Benjamin Herrenschmidt,
    Christophe Leroy, Christophe Lombard, Colin Ian King, Dan Carpenter,
    Gautham R. Shenoy, Hari Bathini, Ian Munsie, Ivan Mikhaylov, Javier
    Martinez Canillas, Madhavan Srinivasan, Masahiro Yamada, Matt Brown,
    Michael Neuling, Michal Suchanek, Murilo Opsfelder Araujo, Naveen N.
    Rao, Nicholas Piggin, Oliver O'Halloran, Paul Mackerras, Pavel Machek,
    Russell Currey, Santosh Sivaraj, Stephen Rothwell, Thiago Jung
    Bauermann, Yang Li"

    * tag 'powerpc-4.13-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (158 commits)
    powerpc/Kconfig: Enable STRICT_KERNEL_RWX for some configs
    powerpc/mm/radix: Implement STRICT_RWX/mark_rodata_ro() for Radix
    powerpc/mm/hash: Implement mark_rodata_ro() for hash
    powerpc/vmlinux.lds: Align __init_begin to 16M
    powerpc/lib/code-patching: Use alternate map for patch_instruction()
    powerpc/xmon: Add patch_instruction() support for xmon
    powerpc/kprobes/optprobes: Use patch_instruction()
    powerpc/kprobes: Move kprobes over to patch_instruction()
    powerpc/mm/radix: Fix execute permissions for interrupt_vectors
    powerpc/pseries: Fix passing of pp0 in updatepp() and updateboltedpp()
    powerpc/64s: Blacklist rtas entry/exit from kprobes
    powerpc/64s: Blacklist functions invoked on a trap
    powerpc/64s: Un-blacklist system_call() from kprobes
    powerpc/64s: Move system_call() symbol to just after setting MSR_EE
    powerpc/64s: Blacklist system_call() and system_call_common() from kprobes
    powerpc/64s: Convert .L__replay_interrupt_return to a local label
    powerpc64/elfv1: Only dereference function descriptor for non-text symbols
    cxl: Export library to support IBM XSL
    powerpc/dts: Use #include "..." to include local DT
    powerpc/perf/hv-24x7: Aggregate result elements on POWER9 SMT8
    ...

    Linus Torvalds
     

04 Jul, 2017

1 commit

  • All code that patches kernel text has been moved over to using
    patch_instruction() and patch_instruction() is able to cope with the
    kernel text being read only.

    The linker script has been updated to ensure the read only data ends
    on a large page boundary, so it and the preceding kernel text can be
    marked R_X. We also have implementations of mark_rodata_ro() for Hash
    and Radix MMU modes.

    There are some corner-cases missing when the kernel is built
    relocatable, so for now make it depend on !RELOCATABLE.

    There's also a temporary workaround to depend on !HIBERNATION to avoid
    a build failure, that will be removed once we've merged with the PM
    tree.

    Signed-off-by: Balbir Singh
    [mpe: Make it depend on !RELOCATABLE, munge change log]
    Signed-off-by: Michael Ellerman

    Balbir Singh
     

03 Jul, 2017

1 commit


02 Jul, 2017

1 commit


30 Jun, 2017

1 commit


22 Jun, 2017

2 commits

  • Signed-off-by: Ingo Molnar

    Ingo Molnar
     
  • This converts the powerpc VDSO time update function to use the new
    interface introduced in commit 576094b7f0aa ("time: Introduce new
    GENERIC_TIME_VSYSCALL", 2012-09-11). Where the old interface gave
    us the time as of the last update in seconds and whole nanoseconds,
    with the new interface we get the nanoseconds part effectively in
    a binary fixed-point format with tk->tkr_mono.shift bits to the
    right of the binary point.

    With the old interface, the fractional nanoseconds got truncated,
    meaning that the value returned by the VDSO clock_gettime function
    would have about 1ns of jitter in it compared to the value computed
    by the generic timekeeping code in the kernel.

    The powerpc VDSO time functions (clock_gettime and gettimeofday)
    already work in units of 2^-32 seconds, or 0.23283 ns, because that
    makes it simple to split the result into seconds and fractional
    seconds, and represent the fractional seconds in either microseconds
    or nanoseconds. This is good enough accuracy for now, so this patch
    avoids changing how the VDSO works or the interface in the VDSO data
    page.

    This patch converts the powerpc update_vsyscall_old to be called
    update_vsyscall and use the new interface. We convert the fractional
    second to units of 2^-32 seconds without truncating to whole nanoseconds.
    (There is still a conversion to whole nanoseconds for any legacy users
    of the vdso_data/systemcfg stamp_xtime field.)

    In addition, this improves the accuracy of the computation of tb_to_xs
    for those systems with high-frequency timebase clocks (>= 268.5 MHz)
    by doing the right shift in two parts, one before the multiplication and
    one after, rather than doing the right shift before the multiplication.
    (We can't do all of the right shift after the multiplication unless we
    use 128-bit arithmetic.)

    Signed-off-by: Paul Mackerras
    Acked-by: John Stultz
    Signed-off-by: Michael Ellerman

    Paul Mackerras
     

13 Jun, 2017

1 commit

  • This patch provides all required callbacks required by the generic
    get_user_pages_fast() code and switches x86 over - and removes
    the platform specific implementation.

    Signed-off-by: Kirill A. Shutemov
    Cc: Andrew Morton
    Cc: Andy Lutomirski
    Cc: Andy Lutomirski
    Cc: Borislav Petkov
    Cc: Brian Gerst
    Cc: Dave Hansen
    Cc: Denys Vlasenko
    Cc: H. Peter Anvin
    Cc: Josh Poimboeuf
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: linux-arch@vger.kernel.org
    Cc: linux-mm@kvack.org
    Link: http://lkml.kernel.org/r/20170606113133.22974-2-kirill.shutemov@linux.intel.com
    Signed-off-by: Ingo Molnar

    Kirill A. Shutemov
     

12 Jun, 2017

1 commit

  • Pull key subsystem fixes from James Morris:
    "Here are a bunch of fixes for Linux keyrings, including:

    - Fix up the refcount handling now that key structs use the
    refcount_t type and the refcount_t ops don't allow a 0->1
    transition.

    - Fix a potential NULL deref after error in x509_cert_parse().

    - Don't put data for the crypto algorithms to use on the stack.

    - Fix the handling of a null payload being passed to add_key().

    - Fix incorrect cleanup an uninitialised key_preparsed_payload in
    key_update().

    - Explicit sanitisation of potentially secure data before freeing.

    - Fixes for the Diffie-Helman code"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (23 commits)
    KEYS: fix refcount_inc() on zero
    KEYS: Convert KEYCTL_DH_COMPUTE to use the crypto KPP API
    crypto : asymmetric_keys : verify_pefile:zero memory content before freeing
    KEYS: DH: add __user annotations to keyctl_kdf_params
    KEYS: DH: ensure the KDF counter is properly aligned
    KEYS: DH: don't feed uninitialized "otherinfo" into KDF
    KEYS: DH: forbid using digest_null as the KDF hash
    KEYS: sanitize key structs before freeing
    KEYS: trusted: sanitize all key material
    KEYS: encrypted: sanitize all key material
    KEYS: user_defined: sanitize key payloads
    KEYS: sanitize add_key() and keyctl() key payloads
    KEYS: fix freeing uninitialized memory in key_update()
    KEYS: fix dereferencing NULL payload with nonzero length
    KEYS: encrypted: use constant-time HMAC comparison
    KEYS: encrypted: fix race causing incorrect HMAC calculations
    KEYS: encrypted: fix buffer overread in valid_master_desc()
    KEYS: encrypted: avoid encrypting/decrypting stack buffers
    KEYS: put keyring if install_session_keyring_to_cred() fails
    KEYS: Delete an error message for a failed memory allocation in get_derived_key()
    ...

    Linus Torvalds
     

09 Jun, 2017

1 commit

  • CONFIG_KEYS_COMPAT is defined in arch-specific Kconfigs and is missing for
    several 64-bit architectures : mips, parisc, tile.

    At the moment and for those architectures, calling in 32-bit userspace the
    keyctl syscall would return an ENOSYS error.

    This patch moves the CONFIG_KEYS_COMPAT option to security/keys/Kconfig, to
    make sure the compatibility wrapper is registered by default for any 64-bit
    architecture as long as it is configured with CONFIG_COMPAT.

    [DH: Modified to remove arm64 compat enablement also as requested by Eric
    Biggers]

    Signed-off-by: Bilal Amarni
    Signed-off-by: David Howells
    Reviewed-by: Arnd Bergmann
    cc: Eric Biggers
    Signed-off-by: James Morris

    Bilal Amarni
     

08 Jun, 2017

1 commit

  • The PPC_DT_CPU_FTRs is a bit misplaced in menuconfig, it shows up with
    other general kernel options. It's really more at home in the "Platform
    Support" section, so move it there.

    Also enable it by default, for Book3s 64. It does mostly nothing unless
    the device tree properties are found, and we will want it enabled
    eventually in distro kernels, so turn it on to start getting more
    testing.

    Fixes: 5a61ef74f269 ("powerpc/64s: Support new device tree binding for discovering CPU features")
    Signed-off-by: Michael Ellerman

    Michael Ellerman
     

02 Jun, 2017

1 commit

  • With the __ilog2() function as defined in
    arch/powerpc/include/asm/bitops.h, GCC will not optimise the code
    in case of constant parameter.

    The generic ilog2() function in include/linux/log2.h is written
    to handle the case of the constant parameter.

    This patch discards the three __ilog2() functions and
    defines __ilog2() as ilog2()

    For non constant calls, the generated code is doing the same:
    int test__ilog2(unsigned long x)
    {
    return __ilog2(x);
    }

    int test__ilog2_u32(u32 n)
    {
    return __ilog2_u32(n);
    }

    int test__ilog2_u64(u64 n)
    {
    return __ilog2_u64(n);
    }

    On PPC32 before the patch:
    00000000 :
    0: 7c 63 00 34 cntlzw r3,r3
    4: 20 63 00 1f subfic r3,r3,31
    8: 4e 80 00 20 blr

    0000000c :
    c: 7c 63 00 34 cntlzw r3,r3
    10: 20 63 00 1f subfic r3,r3,31
    14: 4e 80 00 20 blr

    On PPC32 after the patch:
    00000000 :
    0: 7c 63 00 34 cntlzw r3,r3
    4: 20 63 00 1f subfic r3,r3,31
    8: 4e 80 00 20 blr

    0000000c :
    c: 7c 63 00 34 cntlzw r3,r3
    10: 20 63 00 1f subfic r3,r3,31
    14: 4e 80 00 20 blr

    On PPC64 before the patch:
    0000000000000000 :
    0: 7c 63 00 74 cntlzd r3,r3
    4: 20 63 00 3f subfic r3,r3,63
    8: 7c 63 07 b4 extsw r3,r3
    c: 4e 80 00 20 blr

    0000000000000010 :
    10: 7c 63 00 34 cntlzw r3,r3
    14: 20 63 00 1f subfic r3,r3,31
    18: 7c 63 07 b4 extsw r3,r3
    1c: 4e 80 00 20 blr

    0000000000000020 :
    20: 7c 63 00 74 cntlzd r3,r3
    24: 20 63 00 3f subfic r3,r3,63
    28: 7c 63 07 b4 extsw r3,r3
    2c: 4e 80 00 20 blr

    On PPC64 after the patch:
    0000000000000000 :
    0: 7c 63 00 74 cntlzd r3,r3
    4: 20 63 00 3f subfic r3,r3,63
    8: 7c 63 07 b4 extsw r3,r3
    c: 4e 80 00 20 blr

    0000000000000010 :
    10: 7c 63 00 34 cntlzw r3,r3
    14: 20 63 00 1f subfic r3,r3,31
    18: 7c 63 07 b4 extsw r3,r3
    1c: 4e 80 00 20 blr

    0000000000000020 :
    20: 7c 63 00 74 cntlzd r3,r3
    24: 20 63 00 3f subfic r3,r3,63
    28: 7c 63 07 b4 extsw r3,r3
    2c: 4e 80 00 20 blr

    Signed-off-by: Christophe Leroy
    Signed-off-by: Michael Ellerman

    Christophe Leroy
     

01 Jun, 2017

1 commit

  • Provide a dt_cpu_ftrs= cmdline option to disable the dt_cpu_ftrs CPU
    feature discovery, and fall back to the "cputable" based version.

    Also allow control of advertising unknown features to userspace and
    with this parameter, and remove the clunky CONFIG option.

    Signed-off-by: Nicholas Piggin
    [mpe: Add explicit early check of bootargs in dt_cpu_ftrs_init()]
    Signed-off-by: Michael Ellerman

    Nicholas Piggin
     

30 May, 2017

2 commits

  • Very large kernels may require linker stubs for branches from HEAD
    text code. The linker may place these stubs before the HEAD text
    sections, which breaks the assumption that HEAD text is located at 0
    (or the .text section being located at 0x7000/0x8000 on Book3S
    kernels).

    Provide an option to create a small section just before the .text
    section with an empty 256 - 4 bytes, and adjust the start of the .text
    section to match. The linker will tend to put stubs in that section
    and not break our relative-to-absolute offset assumptions.

    This causes a small waste of space on common kernels, but allows large
    kernels to build and boot. For now, it is an EXPERT config option,
    defaulting to =n, but a reference is provided for it in the build-time
    check for such breakage. This is good enough for allyesconfig and
    custom users / hackers.

    Signed-off-by: Nicholas Piggin
    Signed-off-by: Michael Ellerman

    Nicholas Piggin
     
  • Allow us to enable IRQ_TIME_ACCOUNTING. Even though we currently
    use VIRT_CPU_ACCOUNTING_NATIVE, that option is quite heavy
    weight and IRQ_TIME_ACCOUNTING might be better in some cases.

    Signed-off-by: Anton Blanchard
    Signed-off-by: Michael Ellerman

    Anton Blanchard
     

13 May, 2017

1 commit

  • Pull more powerpc updates from Michael Ellerman:
    "The change to the Linux page table geometry was delayed for more
    testing with 16G pages, and there's the new CPU features stuff which
    just needed one more polish before going in. Plus a few changes from
    Scott which came in a bit late. And then various fixes, mostly minor.

    Summary highlights:

    - rework the Linux page table geometry to lower memory usage on
    64-bit Book3S (IBM chips) using the Hash MMU.

    - support for a new device tree binding for discovering CPU features
    on future firmwares.

    - Freescale updates from Scott:
    "Includes a fix for a powerpc/next mm regression on 64e, a fix for
    a kernel hang on 64e when using a debugger inside a relocated
    kernel, a qman fix, and misc qe improvements."

    Thanks to: Christophe Leroy, Gavin Shan, Horia Geantă, LiuHailong,
    Nicholas Piggin, Roy Pledge, Scott Wood, Valentin Longchamp"

    * tag 'powerpc-4.12-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
    powerpc/64s: Support new device tree binding for discovering CPU features
    powerpc: Don't print cpu_spec->cpu_name if it's NULL
    of/fdt: introduce of_scan_flat_dt_subnodes and of_get_flat_dt_phandle
    powerpc/64s: Fix unnecessary machine check handler relocation branch
    powerpc/mm/book3s/64: Rework page table geometry for lower memory usage
    powerpc: Fix distclean with Makefile.postlink
    powerpc/64e: Don't place the stack beyond TASK_SIZE
    powerpc/powernv: Block PCI config access on BCM5718 during EEH recovery
    powerpc/8xx: Adding support of IRQ in MPC8xx GPIO
    soc/fsl/qbman: Disable IRQs for deferred QBMan work
    soc/fsl/qe: add EXPORT_SYMBOL for the 2 qe_tdm functions
    soc/fsl/qe: only apply QE_General4 workaround on affected SoCs
    soc/fsl/qe: round brg_freq to 1kHz granularity
    soc/fsl/qe: get rid of immrbar_virt_to_phys()
    net: ethernet: ucc_geth: fix MEM_PART_MURAM mode
    powerpc/64e: Fix hang when debugging programs with relocated kernel

    Linus Torvalds
     

11 May, 2017

1 commit

  • Pull RCU updates from Ingo Molnar:
    "The main changes are:

    - Debloat RCU headers

    - Parallelize SRCU callback handling (plus overlapping patches)

    - Improve the performance of Tree SRCU on a CPU-hotplug stress test

    - Documentation updates

    - Miscellaneous fixes"

    * 'core-rcu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (74 commits)
    rcu: Open-code the rcu_cblist_n_lazy_cbs() function
    rcu: Open-code the rcu_cblist_n_cbs() function
    rcu: Open-code the rcu_cblist_empty() function
    rcu: Separately compile large rcu_segcblist functions
    srcu: Debloat the header
    srcu: Adjust default auto-expediting holdoff
    srcu: Specify auto-expedite holdoff time
    srcu: Expedite first synchronize_srcu() when idle
    srcu: Expedited grace periods with reduced memory contention
    srcu: Make rcutorture writer stalls print SRCU GP state
    srcu: Exact tracking of srcu_data structures containing callbacks
    srcu: Make SRCU be built by default
    srcu: Fix Kconfig botch when SRCU not selected
    rcu: Make non-preemptive schedule be Tasks RCU quiescent state
    srcu: Expedite srcu_schedule_cbs_snp() callback invocation
    srcu: Parallelize callback handling
    kvm: Move srcu_struct fields to end of struct kvm
    rcu: Fix typo in PER_RCU_NODE_PERIOD header comment
    rcu: Use true/false in assignment to bool
    rcu: Use bool value directly
    ...

    Linus Torvalds
     

09 May, 2017

2 commits

  • The ibm,powerpc-cpu-features device tree binding describes CPU features with
    ASCII names and extensible compatibility, privilege, and enablement metadata
    that allows improved flexibility and compatibility with new hardware.

    The interface is described in detail in ibm,powerpc-cpu-features.txt in this
    patch.

    Currently this code is not enabled by default, and there are no released
    firmwares that provide the binding.

    Signed-off-by: Nicholas Piggin
    Signed-off-by: Michael Ellerman

    Nicholas Piggin
     
  • Now that crashkernel parameter parsing and vmcoreinfo related code is
    moved under CONFIG_CRASH_CORE instead of CONFIG_KEXEC_CORE, remove
    dependency with CONFIG_KEXEC for CONFIG_FA_DUMP. While here, get rid of
    definitions of fadump_append_elf_note() & fadump_final_note() functions
    to reuse similar functions compiled under CONFIG_CRASH_CORE.

    Link: http://lkml.kernel.org/r/149035343956.6881.1536459326017709354.stgit@hbathini.in.ibm.com
    Signed-off-by: Hari Bathini
    Reviewed-by: Mahesh Salgaonkar
    Acked-by: Michael Ellerman
    Cc: Fenghua Yu
    Cc: Tony Luck
    Cc: Dave Young
    Cc: Eric Biederman
    Cc: Vivek Goyal
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Hari Bathini
     

06 May, 2017

1 commit

  • Pull powerpc updates from Michael Ellerman:
    "Highlights include:

    - Larger virtual address space on 64-bit server CPUs. By default we
    use a 128TB virtual address space, but a process can request access
    to the full 512TB by passing a hint to mmap().

    - Support for the new Power9 "XIVE" interrupt controller.

    - TLB flushing optimisations for the radix MMU on Power9.

    - Support for CAPI cards on Power9, using the "Coherent Accelerator
    Interface Architecture 2.0".

    - The ability to configure the mmap randomisation limits at build and
    runtime.

    - Several small fixes and cleanups to the kprobes code, as well as
    support for KPROBES_ON_FTRACE.

    - Major improvements to handling of system reset interrupts,
    correctly treating them as NMIs, giving them a dedicated stack and
    using a new hypervisor call to trigger them, all of which should
    aid debugging and robustness.

    - Many fixes and other minor enhancements.

    Thanks to: Alastair D'Silva, Alexey Kardashevskiy, Alistair Popple,
    Andrew Donnellan, Aneesh Kumar K.V, Anshuman Khandual, Anton
    Blanchard, Balbir Singh, Ben Hutchings, Benjamin Herrenschmidt,
    Bhupesh Sharma, Chris Packham, Christian Zigotzky, Christophe Leroy,
    Christophe Lombard, Daniel Axtens, David Gibson, Gautham R. Shenoy,
    Gavin Shan, Geert Uytterhoeven, Guilherme G. Piccoli, Hamish Martin,
    Hari Bathini, Kees Cook, Laurent Dufour, Madhavan Srinivasan, Mahesh J
    Salgaonkar, Mahesh Salgaonkar, Masami Hiramatsu, Matt Brown, Matthew
    R. Ochs, Michael Neuling, Naveen N. Rao, Nicholas Piggin, Oliver
    O'Halloran, Pan Xinhui, Paul Mackerras, Rashmica Gupta, Russell
    Currey, Sukadev Bhattiprolu, Thadeu Lima de Souza Cascardo, Tobin C.
    Harding, Tyrel Datwyler, Uma Krishnan, Vaibhav Jain, Vipin K Parashar,
    Yang Shi"

    * tag 'powerpc-4.12-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (214 commits)
    powerpc/64s: Power9 has no LPCR[VRMASD] field so don't set it
    powerpc/powernv: Fix TCE kill on NVLink2
    powerpc/mm/radix: Drop support for CPUs without lockless tlbie
    powerpc/book3s/mce: Move add_taint() later in virtual mode
    powerpc/sysfs: Move #ifdef CONFIG_HOTPLUG_CPU out of the function body
    powerpc/smp: Document irq enable/disable after migrating IRQs
    powerpc/mpc52xx: Don't select user-visible RTAS_PROC
    powerpc/powernv: Document cxl dependency on special case in pnv_eeh_reset()
    powerpc/eeh: Clean up and document event handling functions
    powerpc/eeh: Avoid use after free in eeh_handle_special_event()
    cxl: Mask slice error interrupts after first occurrence
    cxl: Route eeh events to all drivers in cxl_pci_error_detected()
    cxl: Force context lock during EEH flow
    powerpc/64: Allow CONFIG_RELOCATABLE if COMPILE_TEST
    powerpc/xmon: Teach xmon oops about radix vectors
    powerpc/mm/hash: Fix off-by-one in comment about kernel contexts ids
    powerpc/pseries: Enable VFIO
    powerpc/powernv: Fix iommu table size calculation hook for small tables
    powerpc/powernv: Check kzalloc() return value in pnv_pci_table_alloc
    powerpc: Add arch/powerpc/tools directory
    ...

    Linus Torvalds
     

01 May, 2017

1 commit

  • This was a hack we added to work around the allmodconfig build breaking, see
    commit fb43e8477ed9 ("powerpc: Disable RELOCATABLE for COMPILE_TEST with
    PPC64").

    Since we merged the thin archives support in commit 43c9127d94d6 ("powerpc: Add
    option to use thin archives") this hasn't been necessary, so remove it.

    Signed-off-by: Nicholas Piggin
    Signed-off-by: Michael Ellerman

    Nicholas Piggin
     

28 Apr, 2017

1 commit

  • Add a simple NMI IPI system that handles concurrency and reentrancy.

    The platform does not have to implement a true non-maskable interrupt,
    the default is to simply use the debugger break IPI message. This has
    now been co-opted for a general IPI message, and users (debugger and
    crash) have been reimplemented on top of the NMI system.

    Signed-off-by: Nicholas Piggin
    [mpe: Incorporate incremental fixes from Nick]
    Signed-off-by: Michael Ellerman

    Nicholas Piggin
     

27 Apr, 2017

2 commits