06 Apr, 2019

1 commit

  • [ Upstream commit 840018668ce2d96783356204ff282d6c9b0e5f66 ]

    When pmu::setup_aux() is called the coresight PMU needs to know which
    sink to use for the session by looking up the information in the
    event's attr::config2 field.

    As such simply replace the cpu information by the complete perf_event
    structure and change all affected customers.

    Signed-off-by: Mathieu Poirier
    Reviewed-by: Suzuki Poulouse
    Acked-by: Peter Zijlstra
    Cc: Adrian Hunter
    Cc: Alexander Shishkin
    Cc: Alexei Starovoitov
    Cc: Greg Kroah-Hartman
    Cc: H. Peter Anvin
    Cc: Heiko Carstens
    Cc: Jiri Olsa
    Cc: Mark Rutland
    Cc: Martin Schwidefsky
    Cc: Namhyung Kim
    Cc: Thomas Gleixner
    Cc: Will Deacon
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: linux-s390@vger.kernel.org
    Link: http://lkml.kernel.org/r/20190131184714.20388-2-mathieu.poirier@linaro.org
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin

    Mathieu Poirier
     

24 Mar, 2019

3 commits

  • commit 86a86804e4f18fc3880541b3d5a07f4df0fe29cb upstream.

    The fix to make WARN work in the early boot code created a problem
    on older machines without EDAT-1. The setup_lowcore_dat_on function
    uses the pointer from lowcore_ptr[0] to set the DAT bit in the new
    PSWs. That does not work if the kernel page table is set up with
    4K pages as the prefix address maps to absolute zero.

    To make this work the PSWs need to be changed with via address 0 in
    form of the S390_lowcore definition.

    Reported-by: Guenter Roeck
    Tested-by: Cornelia Huck
    Fixes: 94f85ed3e2f8 ("s390/setup: fix early warning messages")
    Signed-off-by: Martin Schwidefsky
    Signed-off-by: Greg Kroah-Hartman

    Martin Schwidefsky
     
  • commit 152482580a1b0accb60676063a1ac57b2d12daf6 upstream.

    kvm_arch_memslots_updated() is at this point in time an x86-specific
    hook for handling MMIO generation wraparound. x86 stashes 19 bits of
    the memslots generation number in its MMIO sptes in order to avoid
    full page fault walks for repeat faults on emulated MMIO addresses.
    Because only 19 bits are used, wrapping the MMIO generation number is
    possible, if unlikely. kvm_arch_memslots_updated() alerts x86 that
    the generation has changed so that it can invalidate all MMIO sptes in
    case the effective MMIO generation has wrapped so as to avoid using a
    stale spte, e.g. a (very) old spte that was created with generation==0.

    Given that the purpose of kvm_arch_memslots_updated() is to prevent
    consuming stale entries, it needs to be called before the new generation
    is propagated to memslots. Invalidating the MMIO sptes after updating
    memslots means that there is a window where a vCPU could dereference
    the new memslots generation, e.g. 0, and incorrectly reuse an old MMIO
    spte that was created with (pre-wrap) generation==0.

    Fixes: e59dbe09f8e6 ("KVM: Introduce kvm_arch_memslots_updated()")
    Cc:
    Signed-off-by: Sean Christopherson
    Signed-off-by: Paolo Bonzini
    Signed-off-by: Greg Kroah-Hartman

    Sean Christopherson
     
  • commit 8727638426b0aea59d7f904ad8ddf483f9234f88 upstream.

    The setup_lowcore() function creates a new prefix page for the boot CPU.
    The PSW mask for the system_call, external interrupt, i/o interrupt and
    the program check handler have the DAT bit set in this new prefix page.

    At the time setup_lowcore is called the system still runs without virtual
    address translation, the paging_init() function creates the kernel page
    table and loads the CR13 with the kernel ASCE.

    Any code between setup_lowcore() and the end of paging_init() that has
    a BUG or WARN statement will create a program check that can not be
    handled correctly as there is no kernel page table yet.

    To allow early WARN statements initially setup the lowcore with DAT off
    and set the DAT bit only after paging_init() has completed.

    Cc: stable@vger.kernel.org
    Signed-off-by: Martin Schwidefsky
    Signed-off-by: Greg Kroah-Hartman

    Martin Schwidefsky
     

13 Feb, 2019

1 commit

  • [ Upstream commit be534791011100d204602e2e0496e9e6ce8edf63 ]

    There exist very few ap messages which need to have the 'special' flag
    enabled. This flag tells the firmware layer to do some pre- and maybe
    postprocessing. However, it may happen that this special flag is
    enabled but the firmware is unable to deal with this kind of message
    and thus returns with reply code 0x41. For example older firmware may
    not know the newest messages triggered by the zcrypt device driver and
    thus react with reject and the named reply code. Unfortunately this
    reply code is not known to the zcrypt error routines and thus default
    behavior is to switch the ap queue offline.

    This patch now makes the ap error routine aware of the reply code and
    so userspace is informed about the bad processing result but the queue
    is not switched to offline state any more.

    Signed-off-by: Harald Freudenberger
    Signed-off-by: Martin Schwidefsky
    Signed-off-by: Sasha Levin

    Harald Freudenberger
     

31 Jan, 2019

4 commits

  • commit 60f1bf29c0b2519989927cae640cd1f50f59dc7f upstream.

    When calling smp_call_ipl_cpu() from the IPL CPU, we will try to read
    from pcpu_devices->lowcore. However, due to prefixing, that will result
    in reading from absolute address 0 on that CPU. We have to go via the
    actual lowcore instead.

    This means that right now, we will read lc->nodat_stack == 0 and
    therfore work on a very wrong stack.

    This BUG essentially broke rebooting under QEMU TCG (which will report
    a low address protection exception). And checking under KVM, it is
    also broken under KVM. With 1 VCPU it can be easily triggered.

    :/# echo 1 > /proc/sys/kernel/sysrq
    :/# echo b > /proc/sysrq-trigger
    [ 28.476745] sysrq: SysRq : Resetting
    [ 28.476793] Kernel stack overflow.
    [ 28.476817] CPU: 0 PID: 424 Comm: sh Not tainted 5.0.0-rc1+ #13
    [ 28.476820] Hardware name: IBM 2964 NE1 716 (KVM/Linux)
    [ 28.476826] Krnl PSW : 0400c00180000000 0000000000115c0c (pcpu_delegate+0x12c/0x140)
    [ 28.476861] R:0 T:1 IO:0 EX:0 Key:0 M:0 W:0 P:0 AS:3 CC:0 PM:0 RI:0 EA:3
    [ 28.476863] Krnl GPRS: ffffffffffffffff 0000000000000000 000000000010dff8 0000000000000000
    [ 28.476864] 0000000000000000 0000000000000000 0000000000ab7090 000003e0006efbf0
    [ 28.476864] 000000000010dff8 0000000000000000 0000000000000000 0000000000000000
    [ 28.476865] 000000007fffc000 0000000000730408 000003e0006efc58 0000000000000000
    [ 28.476887] Krnl Code: 0000000000115bfe: 4170f000 la %r7,0(%r15)
    [ 28.476887] 0000000000115c02: 41f0a000 la %r15,0(%r10)
    [ 28.476887] #0000000000115c06: e370f0980024 stg %r7,152(%r15)
    [ 28.476887] >0000000000115c0c: c0e5fffff86e brasl %r14,114ce8
    [ 28.476887] 0000000000115c12: 41f07000 la %r15,0(%r7)
    [ 28.476887] 0000000000115c16: a7f4ffa8 brc 15,115b66
    [ 28.476887] 0000000000115c1a: 0707 bcr 0,%r7
    [ 28.476887] 0000000000115c1c: 0707 bcr 0,%r7
    [ 28.476901] Call Trace:
    [ 28.476902] Last Breaking-Event-Address:
    [ 28.476920] [] arch_call_rest_init+0x22/0x80
    [ 28.476927] Kernel panic - not syncing: Corrupt kernel stack, can't continue.
    [ 28.476930] CPU: 0 PID: 424 Comm: sh Not tainted 5.0.0-rc1+ #13
    [ 28.476932] Hardware name: IBM 2964 NE1 716 (KVM/Linux)
    [ 28.476932] Call Trace:

    Fixes: 2f859d0dad81 ("s390/smp: reduce size of struct pcpu")
    Cc: stable@vger.kernel.org # 4.0+
    Reported-by: Cornelia Huck
    Signed-off-by: David Hildenbrand
    Signed-off-by: Martin Schwidefsky
    Signed-off-by: Greg Kroah-Hartman

    David Hildenbrand
     
  • commit b7cb707c373094ce4008d4a6ac9b6b366ec52da5 upstream.

    smp_rescan_cpus() is called without the device_hotplug_lock, which can lead
    to a dedlock when a new CPU is found and immediately set online by a udev
    rule.

    This was observed on an older kernel version, where the cpu_hotplug_begin()
    loop was still present, and it resulted in hanging chcpu and systemd-udev
    processes. This specific deadlock will not show on current kernels. However,
    there may be other possible deadlocks, and since smp_rescan_cpus() can still
    trigger a CPU hotplug operation, the device_hotplug_lock should be held.

    For reference, this was the deadlock with the old cpu_hotplug_begin() loop:

    chcpu (rescan) systemd-udevd

    echo 1 > /sys/../rescan
    -> smp_rescan_cpus()
    -> (*) get_online_cpus()
    (increases refcount)
    -> smp_add_present_cpu()
    (new CPU found)
    -> register_cpu()
    -> device_add()
    -> udev "add" event triggered -----------> udev rule sets CPU online
    -> echo 1 > /sys/.../online
    -> lock_device_hotplug_sysfs()
    (this is missing in rescan path)
    -> device_online()
    -> (**) device_lock(new CPU dev)
    -> cpu_up()
    -> cpu_hotplug_begin()
    (loops until refcount == 0)
    -> deadlock with (*)
    -> bus_probe_device()
    -> device_attach()
    -> device_lock(new CPU dev)
    -> deadlock with (**)

    Fix this by taking the device_hotplug_lock in the CPU rescan path.

    Cc:
    Signed-off-by: Gerald Schaefer
    Signed-off-by: Martin Schwidefsky
    Signed-off-by: Greg Kroah-Hartman

    Gerald Schaefer
     
  • commit 03aa047ef2db4985e444af6ee1c1dd084ad9fb4c upstream.

    Right now the early machine detection code check stsi 3.2.2 for "KVM"
    and set MACHINE_IS_VM if this is different. As the console detection
    uses diagnose 8 if MACHINE_IS_VM returns true this will crash Linux
    early for any non z/VM system that sets a different value than KVM.
    So instead of assuming z/VM, do not set any of MACHINE_IS_LPAR,
    MACHINE_IS_VM, or MACHINE_IS_KVM.

    CC: stable@vger.kernel.org
    Reviewed-by: Heiko Carstens
    Signed-off-by: Christian Borntraeger
    Signed-off-by: Martin Schwidefsky
    Signed-off-by: Greg Kroah-Hartman

    Christian Borntraeger
     
  • commit a38662084c8bdb829ff486468c7ea801c13fcc34 upstream.

    The ASCE of an mm_struct can be modified after a task has been created,
    e.g. via crst_table_downgrade for a compat process. The active_mm logic
    to avoid the switch_mm call if the next task is a kernel thread can
    lead to a situation where switch_mm is called where 'prev == next' is
    true but 'prev->context.asce == next->context.asce' is not.

    This can lead to a situation where a CPU uses the outdated ASCE to run
    a task. The result can be a crash, endless loops and really subtle
    problem due to TLBs being created with an invalid ASCE.

    Cc: stable@kernel.org # v3.15+
    Fixes: 53e857f30867 ("s390/mm,tlb: race of lazy TLB flush vs. recreation")
    Reported-by: Heiko Carstens
    Reviewed-by: Heiko Carstens
    Signed-off-by: Martin Schwidefsky
    Signed-off-by: Greg Kroah-Hartman

    Martin Schwidefsky
     

10 Jan, 2019

1 commit

  • commit 98dfd32620e970eb576ebce5ea39d905cb005e72 upstream.

    When triggered by pci hotplug (PEC 0x306) clp_get_state is called
    with spinlocks held resulting in the following warning:

    zpci: n/a: Event 0x306 reconfigured PCI function 0x0
    BUG: sleeping function called from invalid context at mm/page_alloc.c:4324
    in_atomic(): 1, irqs_disabled(): 0, pid: 98, name: kmcheck
    2 locks held by kmcheck/98:

    Change the allocation to use GFP_ATOMIC.

    Cc: stable@vger.kernel.org # 4.13+
    Signed-off-by: Sebastian Ott
    Signed-off-by: Martin Schwidefsky
    Signed-off-by: Greg Kroah-Hartman

    Sebastian Ott
     

17 Dec, 2018

1 commit

  • [ Upstream commit 613a41b0d16e617f46776a93b975a1eeea96417c ]

    On s390 command perf top fails
    [root@s35lp76 perf] # ./perf top -F100000 --stdio
    Error:
    cycles: PMU Hardware doesn't support sampling/overflow-interrupts.
    Try 'perf stat'
    [root@s35lp76 perf] #

    Using event -e rb0000 works as designed. Event rb0000 is the event
    number of the sampling facility for basic sampling.

    During system start up the following PMUs are installed in the kernel's
    PMU list (from head to tail):
    cpum_cf --> s390 PMU counter facility device driver
    cpum_sf --> s390 PMU sampling facility device driver
    uprobe
    kprobe
    tracepoint
    task_clock
    cpu_clock

    Perf top executes following functions and calls perf_event_open(2) system
    call with different parameters many times:

    cmd_top
    --> __cmd_top
    --> perf_evlist__add_default
    --> __perf_evlist__add_default
    --> perf_evlist__new_cycles (creates event type:0 (HW)
    config 0 (CPU_CYCLES)
    --> perf_event_attr__set_max_precise_ip
    Uses perf_event_open(2) to detect correct
    precise_ip level. Fails 3 times on s390 which is ok.

    Then functions cmd_top
    --> __cmd_top
    --> perf_top__start_counters
    -->perf_evlist__config
    --> perf_can_comm_exec
    --> perf_probe_api
    This functions test support for the following events:
    "cycles:u", "instructions:u", "cpu-clock:u" using
    --> perf_do_probe_api
    --> perf_event_open_cloexec
    Test the close on exec flag support with
    perf_event_open(2).
    perf_do_probe_api returns true if the event is
    supported.
    The function returns true because event cpu-clock is
    supported by the PMU cpu_clock.
    This is achieved by many calls to perf_event_open(2).

    Function perf_top__start_counters now calls perf_evsel__open() for every
    event, which is the default event cpu_cycles (config:0) and type HARDWARE
    (type:0) which a predfined frequence of 4000.

    Given the above order of the PMU list, the PMU cpum_cf gets called first
    and returns 0, which indicates support for this sampling. The event is
    fully allocated in the function perf_event_open (file kernel/event/core.c
    near line 10521 and the following check fails:

    event = perf_event_alloc(&attr, cpu, task, group_leader, NULL,
    NULL, NULL, cgroup_fd);
    if (IS_ERR(event)) {
    err = PTR_ERR(event);
    goto err_cred;
    }

    if (is_sampling_event(event)) {
    if (event->pmu->capabilities & PERF_PMU_CAP_NO_INTERRUPT) {
    err = -EOPNOTSUPP;
    goto err_alloc;
    }
    }

    The check for the interrupt capabilities fails and the system call
    perf_event_open() returns -EOPNOTSUPP (-95).

    Add a check to return -ENODEV when sampling is requested in PMU cpum_cf.
    This allows common kernel code in the perf_event_open() system call to
    test the next PMU in above list.

    Fixes: 97b1198fece0 (" "s390, perf: Use common PMU interrupt disabled code")
    Signed-off-by: Thomas Richter
    Reviewed-by: Hendrik Brueckner
    Signed-off-by: Martin Schwidefsky
    Signed-off-by: Sasha Levin

    Thomas Richter
     

06 Dec, 2018

1 commit

  • commit 18588e1487b19e45bd90bd55ec8d3a1d44f3257f upstream.

    The function_graph_enter() function does the work of calling the function
    graph hook function and the management of the shadow stack, simplifying the
    work done in the architecture dependent prepare_ftrace_return().

    Have s390 use the new code, and remove the shadow stack management as well as
    having to set up the trace structure.

    This is needed to prepare for a fix of a design bug on how the curr_ret_stack
    is used.

    Acked-by: Martin Schwidefsky
    Cc: Heiko Carstens
    Cc: Julian Wiedmann
    Cc: linux-s390@vger.kernel.org
    Cc: stable@kernel.org
    Fixes: 03274a3ffb449 ("tracing/fgraph: Adjust fgraph depth before calling trace return callback")
    Reviewed-by: Masami Hiramatsu
    Signed-off-by: Steven Rostedt (VMware)
    Signed-off-by: Greg Kroah-Hartman

    Steven Rostedt (VMware)
     

27 Nov, 2018

5 commits

  • [ Upstream commit 0bb2ae1b26e1fb7543ec7474cdd374ac4b88c4da ]

    The function perf_init_event() creates a new event and
    assignes it to a PMU. This a done in a loop over all existing
    PMUs. For each listed PMU the event init function is called
    and if this function does return any other error than -ENOENT,
    the loop is terminated the creation of the event fails.

    If the event is invalid, return -ENOENT to try other PMUs.

    Signed-off-by: Thomas Richter
    Reviewed-by: Hendrik Brueckner
    Signed-off-by: Martin Schwidefsky
    Signed-off-by: Sasha Levin

    Thomas Richter
     
  • [ Upstream commit a541f0ebcc08ed8bc0cc492eec9a86cb280a9f24 ]

    Fixes:
    ERROR: "__node_distance" [drivers/nvme/host/nvme-core.ko] undefined!
    make[1]: *** [scripts/Makefile.modpost:92: __modpost] Error 1
    make: *** [Makefile:1275: modules] Error 2
    + exit 1

    Signed-off-by: Justin M. Forbes
    Signed-off-by: Heiko Carstens
    Signed-off-by: Martin Schwidefsky
    Signed-off-by: Sasha Levin

    Justin M. Forbes
     
  • [ Upstream commit e12e4044aede97974f2222eb7f0ed726a5179a32 ]

    In case a fork or a clone system fails in copy_process and the error
    handling does the mmput() at the bad_fork_cleanup_mm label, the
    following warning messages will appear on the console:

    BUG: non-zero pgtables_bytes on freeing mm: 16384

    The reason for that is the tricks we play with mm_inc_nr_puds() and
    mm_inc_nr_pmds() in init_new_context().

    A normal 64-bit process has 3 levels of page table, the p4d level and
    the pud level are folded. On process termination the free_pud_range()
    function in mm/memory.c will subtract 16KB from pgtable_bytes with a
    mm_dec_nr_puds() call, but there actually is not really a pud table.

    One issue with this is the fact that pgtable_bytes is usually off
    by a few kilobytes, but the more severe problem is that for a failed
    fork or clone the free_pgtables() function is not called. In this case
    there is no mm_dec_nr_puds() or mm_dec_nr_pmds() that go together with
    the mm_inc_nr_puds() and mm_inc_nr_pmds in init_new_context().
    The pgtable_bytes will be off by 16384 or 32768 bytes and we get the
    BUG message. The message itself is purely cosmetic, but annoying.

    To fix this override the mm_pmd_folded, mm_pud_folded and mm_p4d_folded
    function to check for the true size of the address space.

    Reported-by: Li Wang
    Tested-by: Li Wang
    Signed-off-by: Martin Schwidefsky
    Signed-off-by: Sasha Levin

    Martin Schwidefsky
     
  • [ Upstream commit b44b136a3773d8a9c7853f8df716bd1483613cbb ]

    According to Documentation/kbuild/makefiles.txt all build targets using
    if_changed should use FORCE as well. Add missing FORCE to make sure
    vdso targets are rebuild properly when not just immediate prerequisites
    have changed but also when build command differs.

    Reviewed-by: Philipp Rudo
    Signed-off-by: Vasily Gorbik
    Signed-off-by: Martin Schwidefsky
    Signed-off-by: Sasha Levin

    Vasily Gorbik
     
  • [ Upstream commit ef5febae1543f35a45f01614123e829d77326d0f ]

    According to Documentation/kbuild/makefiles.txt all build targets
    using if_changed should use FORCE as well. Add missing FORCE to make
    sure vmlinux decompressor targets are rebuild properly when not just
    immediate prerequisites have changed but also when build command differs.

    Reviewed-by: Philipp Rudo
    Signed-off-by: Vasily Gorbik
    Signed-off-by: Martin Schwidefsky
    Signed-off-by: Sasha Levin

    Vasily Gorbik
     

14 Nov, 2018

2 commits

  • commit 578bdaabd015b9b164842c3e8ace9802f38e7ecc upstream.

    These are unused, undesired, and have never actually been used by
    anybody. The original authors of this code have changed their mind about
    its inclusion. While originally proposed for disk encryption on low-end
    devices, the idea was discarded [1] in favor of something else before
    that could really get going. Therefore, this patch removes Speck.

    [1] https://marc.info/?l=linux-crypto-vger&m=153359499015659

    Signed-off-by: Jason A. Donenfeld
    Acked-by: Eric Biggers
    Cc: stable@vger.kernel.org
    Acked-by: Ard Biesheuvel
    Signed-off-by: Herbert Xu
    Signed-off-by: Greg Kroah-Hartman

    Jason A. Donenfeld
     
  • [ Upstream commit b5130dc2224d1881f24224c0590c6d97f2168d6a ]

    When running as a level 3 guest with no host provided sthyi support
    sclp_ocf_cpc_name_copy() will only return zeroes. Zeroes are not a
    valid group name, so let's not indicate that the group name field is
    valid.

    Also the group name is not dependent on stsi, let's not return based
    on stsi before setting it.

    Fixes: 95ca2cb57985 ("KVM: s390: Add sthyi emulation")
    Signed-off-by: Janosch Frank
    Signed-off-by: Martin Schwidefsky
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Janosch Frank
     

10 Oct, 2018

1 commit

  • Martin writes:
    "s390 fixes for 4.19-rc8

    Four more patches for 4.19:
    - Fix resume after suspend-to-disk if resume-CPU != suspend-CPU
    - Fix vfio-ccw check for pinned pages
    - Two patches to avoid a usercopy-whitelist warning in vfio-ccw"

    * tag 's390-4.19-4' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
    s390/cio: Fix how vfio-ccw checks pinned pages
    s390/cio: Refactor alloc of ccw_io_region
    s390/cio: Convert ccw_io_region to pointer
    s390/hibernate: fix error handling when suspend cpu != resume cpu

    Greg Kroah-Hartman
     

20 Sep, 2018

1 commit

  • The resume code checks if the resume cpu is the same as the suspend cpu.
    If not, and if it is also not possible to switch to the suspend cpu, an
    error message should be printed and the resume process should be stopped
    by loading a disabled wait psw.

    The current logic is broken in multiple ways, the message is never printed,
    and the disabled wait psw never loaded because the kernel panics before that:
    - sam31 and SIGP_SET_ARCHITECTURE to ESA mode is wrong, this will break
    on the first 64bit instruction in sclp_early_printk().
    - The init stack should be used, but the stack pointer is not set up correctly
    (missing aghi %r15,-STACK_FRAME_OVERHEAD).
    - __sclp_early_printk() checks the sclp_init_state. If it is not
    sclp_init_state_uninitialized, it simply returns w/o printing anything.
    In the resumed kernel however, sclp_init_state will never be uninitialized.

    This patch fixes those issues by removing the sam31/ESA logic, adding a
    correct init stack pointer, and also introducing sclp_early_printk_force()
    to allow using sclp_early_printk() even when sclp_init_state is not
    uninitialized.

    Reviewed-by: Heiko Carstens
    Signed-off-by: Gerald Schaefer
    Signed-off-by: Martin Schwidefsky

    Gerald Schaefer
     

18 Sep, 2018

1 commit


14 Sep, 2018

1 commit


12 Sep, 2018

2 commits

  • We currently do not notify all gmaps when using gmap_pmdp_xchg(), due
    to locking constraints. This makes ucontrol VMs, which is the only VM
    type that creates multiple gmaps, incompatible with huge pages. Also
    we would need to hold the guest_table_lock of all gmaps that have this
    vmaddr maped to synchronize access to the pmd.

    ucontrol VMs are rather exotic and creating a new locking concept is
    no easy task. Hence we return EINVAL when trying to active
    KVM_CAP_S390_HPAGE_1M and report it as being not available when
    checking for it.

    Fixes: a4499382 ("KVM: s390: Add huge page enablement control")
    Signed-off-by: Janosch Frank
    Reviewed-by: David Hildenbrand
    Reviewed-by: Claudio Imbrenda
    Message-Id:
    Signed-off-by: Janosch Frank

    Janosch Frank
     
  • Userspace could have munmapped the area before doing unmapping from
    the gmap. This would leave us with a valid vmaddr, but an invalid vma
    from which we would try to zap memory.

    Let's check before using the vma.

    Fixes: 1e133ab296f3 ("s390/mm: split arch/s390/mm/pgtable.c")
    Signed-off-by: Janosch Frank
    Reviewed-by: David Hildenbrand
    Reported-by: Dan Carpenter
    Message-Id:
    Signed-off-by: Janosch Frank

    Janosch Frank
     

04 Sep, 2018

4 commits

  • We have to do down_write on the mm semaphore to set a bitfield in the
    mm context.

    Signed-off-by: Janosch Frank
    Fixes: a4499382 ("KVM: s390: Add huge page enablement control")
    Reviewed-by: Christian Borntraeger
    Signed-off-by: Christian Borntraeger

    Janosch Frank
     
  • Copy the key mask to the right offset inside the shadow CRYCB

    Fixes: bbeaa58b3 ("KVM: s390: vsie: support aes dea wrapping keys")
    Signed-off-by: Pierre Morel
    Reviewed-by: David Hildenbrand
    Reviewed-by: Cornelia Huck
    Reviewed-by: Janosch Frank
    Cc: stable@vger.kernel.org # v4.8+
    Message-Id:
    Signed-off-by: Janosch Frank
    Signed-off-by: Christian Borntraeger

    Pierre Morel
     
  • We should not return with a lock.
    We also have to increase the address when we do page clearing.

    Fixes: bd096f644319 ("KVM: s390: Add skey emulation fault handling")
    Signed-off-by: Janosch Frank
    Message-Id:
    Reviewed-by: David Hildenbrand
    Signed-off-by: Christian Borntraeger

    Janosch Frank
     
  • The return code of cpacf_kmc() is less than the number of
    bytes to process in case of an error, not greater.
    The crypt routines for the other cipher modes already have
    this correctly.

    Cc: stable@vger.kernel.org # v4.11+
    Fixes: 279378430768 ("s390/crypt: Add protected key AES module")
    Signed-off-by: Ingo Franzki
    Acked-by: Harald Freudenberger
    Signed-off-by: Martin Schwidefsky

    Ingo Franzki
     

26 Aug, 2018

1 commit

  • Pull more Kbuild updates from Masahiro Yamada:

    - add build_{menu,n,g,x}config targets for compile-testing Kconfig

    - fix and improve recursive dependency detection in Kconfig

    - fix parallel building of menuconfig/nconfig

    - fix syntax error in clang-version.sh

    - suppress distracting log from syncconfig

    - remove obsolete "rpm" target

    - remove VMLINUX_SYMBOL(_STR) macro entirely

    - fix microblaze build with CONFIG_DYNAMIC_FTRACE

    - move compiler test for dead code/data elimination to Kconfig

    - rename well-known LDFLAGS variable to KBUILD_LDFLAGS

    - misc fixes and cleanups

    * tag 'kbuild-v4.19-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
    kbuild: rename LDFLAGS to KBUILD_LDFLAGS
    kbuild: pass LDFLAGS to recordmcount.pl
    kbuild: test dead code/data elimination support in Kconfig
    initramfs: move gen_initramfs_list.sh from scripts/ to usr/
    vmlinux.lds.h: remove stale include
    export.h: remove VMLINUX_SYMBOL() and VMLINUX_SYMBOL_STR()
    Coccinelle: remove pci_alloc_consistent semantic to detect in zalloc-simple.cocci
    kbuild: make sorting initramfs contents independent of locale
    kbuild: remove "rpm" target, which is alias of "rpm-pkg"
    kbuild: Fix LOADLIBES rename in Documentation/kbuild/makefiles.txt
    kconfig: suppress "configuration written to .config" for syncconfig
    kconfig: fix "Can't open ..." in parallel build
    kbuild: Add a space after `!` to prevent parsing as file pattern
    scripts: modpost: check memory allocation results
    kconfig: improve the recursive dependency report
    kconfig: report recursive dependency involving 'imply'
    kconfig: error out when seeing recursive dependency
    kconfig: add build-only configurator targets
    scripts/dtc: consolidate include path options in Makefile

    Linus Torvalds
     

25 Aug, 2018

1 commit

  • Pull s390 updates from Martin Schwidefsky:

    - A couple of patches for the zcrypt driver:
    + Add two masks to determine which AP cards and queues are host
    devices, this will be useful for KVM AP device passthrough
    + Add-on patch to improve the parsing of the new apmask and aqmask
    + Some code beautification

    - Second try to reenable the GCC plugins, the first patch set had a
    patch to do this but the merge somehow missed this

    - Remove the s390 specific GCC version check and use the generic one

    - Three patches for kdump, two bug fixes and one cleanup

    - Three patches for the PCI layer, one bug fix and two cleanups

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
    s390: remove gcc version check (4.3 or newer)
    s390/zcrypt: hex string mask improvements for apmask and aqmask.
    s390/zcrypt: AP bus support for alternate driver(s)
    s390/zcrypt: code beautify
    s390/zcrypt: switch return type to bool for ap_instructions_available()
    s390/kdump: Remove kzalloc_panic
    s390/kdump: Fix memleak in nt_vmcoreinfo
    s390/kdump: Make elfcorehdr size calculation ABI compliant
    s390/pci: remove fmb address from debug output
    s390/pci: remove stale rc
    s390/pci: fix out of bounds access during irq setup
    s390/zcrypt: fix ap_instructions_available() returncodes
    s390: reenable gcc plugins for real

    Linus Torvalds
     

24 Aug, 2018

2 commits

  • The ebcdic.c file contains tables for converting between ebcdic and PC
    codepage 437. I could however not identify which encoding was used for
    the comments. This seems to be some variation of ISO_8859-1 with
    non-UTF-8 escape characters.

    I have converted this to UTF-8 by manually removing the escape
    characters and then running it through recode, to get the same encoding
    that we use for the rest of the kernel.

    Link: http://lkml.kernel.org/r/20180724111600.4158975-2-arnd@arndb.de
    Signed-off-by: Arnd Bergmann
    Cc: Martin Schwidefsky
    Cc: Heiko Carstens
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arnd Bergmann
     
  • Commit a0f97e06a43c ("kbuild: enable 'make CFLAGS=...' to add
    additional options to CC") renamed CFLAGS to KBUILD_CFLAGS.

    Commit 222d394d30e7 ("kbuild: enable 'make AFLAGS=...' to add
    additional options to AS") renamed AFLAGS to KBUILD_AFLAGS.

    Commit 06c5040cdb13 ("kbuild: enable 'make CPPFLAGS=...' to add
    additional options to CPP") renamed CPPFLAGS to KBUILD_CPPFLAGS.

    For some reason, LDFLAGS was not renamed.

    Using a well-known variable like LDFLAGS may result in accidental
    override of the variable.

    Kbuild generally uses KBUILD_ prefixed variables for the internally
    appended options, so here is one more conversion to sanitize the
    naming convention.

    I did not touch Makefiles under tools/ since the tools build system
    is a different world.

    Signed-off-by: Masahiro Yamada
    Acked-by: Kirill A. Shutemov
    Reviewed-by: Palmer Dabbelt

    Masahiro Yamada
     

22 Aug, 2018

1 commit

  • …iederm/user-namespace

    Pull core signal handling updates from Eric Biederman:
    "It was observed that a periodic timer in combination with a
    sufficiently expensive fork could prevent fork from every completing.
    This contains the changes to remove the need for that restart.

    This set of changes is split into several parts:

    - The first part makes PIDTYPE_TGID a proper pid type instead
    something only for very special cases. The part starts using
    PIDTYPE_TGID enough so that in __send_signal where signals are
    actually delivered we know if the signal is being sent to a a group
    of processes or just a single process.

    - With that prep work out of the way the logic in fork is modified so
    that fork logically makes signals received while it is running
    appear to be received after the fork completes"

    * 'siginfo-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace: (22 commits)
    signal: Don't send signals to tasks that don't exist
    signal: Don't restart fork when signals come in.
    fork: Have new threads join on-going signal group stops
    fork: Skip setting TIF_SIGPENDING in ptrace_init_task
    signal: Add calculate_sigpending()
    fork: Unconditionally exit if a fatal signal is pending
    fork: Move and describe why the code examines PIDNS_ADDING
    signal: Push pid type down into complete_signal.
    signal: Push pid type down into __send_signal
    signal: Push pid type down into send_signal
    signal: Pass pid type into do_send_sig_info
    signal: Pass pid type into send_sigio_to_task & send_sigurg_to_task
    signal: Pass pid type into group_send_sig_info
    signal: Pass pid and pid type into send_sigqueue
    posix-timers: Noralize good_sigevent
    signal: Use PIDTYPE_TGID to clearly store where file signals will be sent
    pid: Implement PIDTYPE_TGID
    pids: Move the pgrp and session pid pointers from task_struct to signal_struct
    kvm: Don't open code task_pid in kvm_vcpu_ioctl
    pids: Compute task_tgid using signal->leader_pid
    ...

    Linus Torvalds
     

21 Aug, 2018

2 commits

  • git commit cafa0010cd51 ("Raise the minimum required gcc version to 4.6")
    raised the minimum gcc version to 4.6. Therefore remove the s390 specific
    gcc 4.3 version check, which wasn't sufficient anyway.

    Signed-off-by: Heiko Carstens
    Signed-off-by: Martin Schwidefsky

    Heiko Carstens
     
  • Pull tracing updates from Steven Rostedt:

    - Restructure of lockdep and latency tracers

    This is the biggest change. Joel Fernandes restructured the hooks
    from irqs and preemption disabling and enabling. He got rid of a lot
    of the preprocessor #ifdef mess that they caused.

    He turned both lockdep and the latency tracers to use trace events
    inserted in the preempt/irqs disabling paths. But unfortunately,
    these started to cause issues in corner cases. Thus, parts of the
    code was reverted back to where lockdep and the latency tracers just
    get called directly (without using the trace events). But because the
    original change cleaned up the code very nicely we kept that, as well
    as the trace events for preempt and irqs disabling, but they are
    limited to not being called in NMIs.

    - Have trace events use SRCU for "rcu idle" calls. This was required
    for the preempt/irqs off trace events. But it also had to not allow
    them to be called in NMI context. Waiting till Paul makes an NMI safe
    SRCU API.

    - New notrace SRCU API to allow trace events to use SRCU.

    - Addition of mcount-nop option support

    - SPDX headers replacing GPL templates.

    - Various other fixes and clean ups.

    - Some fixes are marked for stable, but were not fully tested before
    the merge window opened.

    * tag 'trace-v4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: (44 commits)
    tracing: Fix SPDX format headers to use C++ style comments
    tracing: Add SPDX License format tags to tracing files
    tracing: Add SPDX License format to bpf_trace.c
    blktrace: Add SPDX License format header
    s390/ftrace: Add -mfentry and -mnop-mcount support
    tracing: Add -mcount-nop option support
    tracing: Avoid calling cc-option -mrecord-mcount for every Makefile
    tracing: Handle CC_FLAGS_FTRACE more accurately
    Uprobe: Additional argument arch_uprobe to uprobe_write_opcode()
    Uprobes: Simplify uprobe_register() body
    tracepoints: Free early tracepoints after RCU is initialized
    uprobes: Use synchronize_rcu() not synchronize_sched()
    tracing: Fix synchronizing to event changes with tracepoint_synchronize_unregister()
    ftrace: Remove unused pointer ftrace_swapper_pid
    tracing: More reverting of "tracing: Centralize preemptirq tracepoints and unify their usage"
    tracing/irqsoff: Handle preempt_count for different configs
    tracing: Partial revert of "tracing: Centralize preemptirq tracepoints and unify their usage"
    tracing: irqsoff: Account for additional preempt_disable
    trace: Use rcu_dereference_raw for hooks from trace-event subsystem
    tracing/kprobes: Fix within_notrace_func() to check only notrace functions
    ...

    Linus Torvalds
     

20 Aug, 2018

3 commits

  • Code beautify by following most of the checkpatch suggestions:
    - SPDX license identifier line complains by checkpatch
    - missing space or newline complains by checkpatch
    - octal numbers for permssions complains by checkpatch
    - renaming of static sysfs functions complains by checkpatch
    - fix of block comment complains by checkpatch
    - fix printf like calls where function name instead of %s __func__
    was used
    - __packed instead of __attribute__((packed))
    - init to zero for static variables removed
    - use of DEVICE_ATTR_RO and DEVICE_ATTR_RW macros

    No functional code changes or API changes!

    Signed-off-by: Harald Freudenberger
    Signed-off-by: Martin Schwidefsky

    Harald Freudenberger
     
  • Function ap_instructions_available() had returntype int but
    in fact returned 1 for true and 0 for false. Changed returntype
    to bool.

    Signed-off-by: Harald Freudenberger
    Signed-off-by: Martin Schwidefsky

    Harald Freudenberger
     
  • Pull first set of KVM updates from Paolo Bonzini:
    "PPC:
    - minor code cleanups

    x86:
    - PCID emulation and CR3 caching for shadow page tables
    - nested VMX live migration
    - nested VMCS shadowing
    - optimized IPI hypercall
    - some optimizations

    ARM will come next week"

    * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (85 commits)
    kvm: x86: Set highest physical address bits in non-present/reserved SPTEs
    KVM/x86: Use CC_SET()/CC_OUT in arch/x86/kvm/vmx.c
    KVM: X86: Implement PV IPIs in linux guest
    KVM: X86: Add kvm hypervisor init time platform setup callback
    KVM: X86: Implement "send IPI" hypercall
    KVM/x86: Move X86_CR4_OSXSAVE check into kvm_valid_sregs()
    KVM: x86: Skip pae_root shadow allocation if tdp enabled
    KVM/MMU: Combine flushing remote tlb in mmu_set_spte()
    KVM: vmx: skip VMWRITE of HOST_{FS,GS}_BASE when possible
    KVM: vmx: skip VMWRITE of HOST_{FS,GS}_SEL when possible
    KVM: vmx: always initialize HOST_{FS,GS}_BASE to zero during setup
    KVM: vmx: move struct host_state usage to struct loaded_vmcs
    KVM: vmx: compute need to reload FS/GS/LDT on demand
    KVM: nVMX: remove a misleading comment regarding vmcs02 fields
    KVM: vmx: rename __vmx_load_host_state() and vmx_save_host_state()
    KVM: vmx: add dedicated utility to access guest's kernel_gs_base
    KVM: vmx: track host_state.loaded using a loaded_vmcs pointer
    KVM: vmx: refactor segmentation code in vmx_save_host_state()
    kvm: nVMX: Fix fault priority for VMX operations
    kvm: nVMX: Fix fault vector for VMX operation at CPL > 0
    ...

    Linus Torvalds
     

18 Aug, 2018

1 commit

  • 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.

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

    In this patch all the caller of handle_mm_fault() are changed to return
    vm_fault_t type.

    Link: http://lkml.kernel.org/r/20180617084810.GA6730@jordon-HP-15-Notebook-PC
    Signed-off-by: Souptick Joarder
    Cc: Matthew Wilcox
    Cc: Richard Henderson
    Cc: Tony Luck
    Cc: Matt Turner
    Cc: Vineet Gupta
    Cc: Russell King
    Cc: Catalin Marinas
    Cc: Will Deacon
    Cc: Richard Kuo
    Cc: Geert Uytterhoeven
    Cc: Michal Simek
    Cc: James Hogan
    Cc: Ley Foon Tan
    Cc: Jonas Bonn
    Cc: James E.J. Bottomley
    Cc: Benjamin Herrenschmidt
    Cc: Palmer Dabbelt
    Cc: Yoshinori Sato
    Cc: David S. Miller
    Cc: Richard Weinberger
    Cc: Guan Xuetao
    Cc: Thomas Gleixner
    Cc: "H. Peter Anvin"
    Cc: "Levin, Alexander (Sasha Levin)"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Souptick Joarder