1. 09 Sep, 2018 14 commits
  2. 05 Sep, 2018 26 commits
    • Greg Kroah-Hartman's avatar
      Linux 4.14.68 · ee13f7ed
      Greg Kroah-Hartman authored
      ee13f7ed
    • Kees Cook's avatar
      gcc-plugins: Use dynamic initializers · 77d1658e
      Kees Cook authored
      commit b8672910 upstream.
      
      GCC 8 changed the order of some fields and is very picky about ordering
      in static initializers, so instead just move to dynamic initializers,
      and drop the redundant already-zero field assignments.
      Suggested-by: default avatarValdis Kletnieks <valdis.kletnieks@vt.edu>
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Cc: Lance Albertson <lance@osuosl.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      77d1658e
    • Valdis Kletnieks's avatar
      gcc-plugins: Add include required by GCC release 8 · 616d41d1
      Valdis Kletnieks authored
      commit 80d17243 upstream.
      
      GCC requires another #include to get the gcc-plugins to build cleanly.
      Signed-off-by: default avatarValdis Kletnieks <valdis.kletnieks@vt.edu>
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Cc: Lance Albertson <lance@osuosl.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      616d41d1
    • Scott Bauer's avatar
      cdrom: Fix info leak/OOB read in cdrom_ioctl_drive_status · 73b2e707
      Scott Bauer authored
      commit 8f3fafc9 upstream.
      
      Like d88b6d04: "cdrom: information leak in cdrom_ioctl_media_changed()"
      
      There is another cast from unsigned long to int which causes
      a bounds check to fail with specially crafted input. The value is
      then used as an index in the slot array in cdrom_slot_status().
      Signed-off-by: default avatarScott Bauer <scott.bauer@intel.com>
      Signed-off-by: default avatarScott Bauer <sbauer@plzdonthack.me>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      73b2e707
    • Vincent Whitchurch's avatar
      watchdog: Mark watchdog touch functions as notrace · 63a0f9de
      Vincent Whitchurch authored
      commit cb9d7fd5 upstream.
      
      Some architectures need to use stop_machine() to patch functions for
      ftrace, and the assumption is that the stopped CPUs do not make function
      calls to traceable functions when they are in the stopped state.
      
      Commit ce4f06dc ("stop_machine: Touch_nmi_watchdog() after
      MULTI_STOP_PREPARE") added calls to the watchdog touch functions from
      the stopped CPUs and those functions lack notrace annotations.  This
      leads to crashes when enabling/disabling ftrace on ARM kernels built
      with the Thumb-2 instruction set.
      
      Fix it by adding the necessary notrace annotations.
      
      Fixes: ce4f06dc ("stop_machine: Touch_nmi_watchdog() after MULTI_STOP_PREPARE")
      Signed-off-by: default avatarVincent Whitchurch <vincent.whitchurch@axis.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: oleg@redhat.com
      Cc: tj@kernel.org
      Cc: stable@vger.kernel.org
      Link: https://lkml.kernel.org/r/20180821152507.18313-1-vincent.whitchurch@axis.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      63a0f9de
    • H. Nikolaus Schaller's avatar
      power: generic-adc-battery: check for duplicate properties copied from iio channels · f9f67667
      H. Nikolaus Schaller authored
      commit a427503e upstream.
      
      If an iio channel defines a basic property, there are duplicate entries
      in /sys/class/power/*/uevent.
      
      So add a check to avoid duplicates. Since all channels may be duplicates,
      we have to modify the related error check.
      Signed-off-by: default avatarH. Nikolaus Schaller <hns@goldelico.com>
      Cc: stable@vger.kernel.org
      Fixes: e60fea79 ("power: battery: Generic battery driver using IIO")
      Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.co.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f9f67667
    • H. Nikolaus Schaller's avatar
      power: generic-adc-battery: fix out-of-bounds write when copying channel properties · 54cecb74
      H. Nikolaus Schaller authored
      commit 932d4744 upstream.
      
      We did have sporadic problems in the pinctrl framework during boot
      where a pin group name unexpectedly became NULL leading to a NULL
      dereference in strcmp.
      
      Detailled analysis of the failing cases did reveal that there were
      two devm allocated objects close to each other. The second one was
      the affected group_desc in pinmux and the first one was the
      psy_desc->properties buffer of the gab driver.
      
      Review of the gab code showed that the address calculation for
      one memcpy() is wrong. It does
      
      	properties + sizeof(type) * index
      
      but C is defined to do the index multiplication already for
      pointer + integer additions. Hence the factor was applied twice
      and the memcpy() does write outside of the properties buffer.
      Sometimes it happened to be the pinctrl and triggered the strcmp(NULL).
      
      Anyways, it is overkill to use a memcpy() here instead of a simple
      assignment, which is easier to read and has less risk for wrong
      address calculations. So we change code to a simple assignment.
      
      If we initialize the index to the first free location, we can even
      remove the local variable 'properties'.
      
      This bug seems to exist right from the beginning in 3.7-rc1 in
      
      commit e60fea79 ("power: battery: Generic battery driver using IIO")
      Signed-off-by: default avatarH. Nikolaus Schaller <hns@goldelico.com>
      Cc: stable@vger.kernel.org
      Fixes: e60fea79 ("power: battery: Generic battery driver using IIO")
      Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.co.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      54cecb74
    • Dan Carpenter's avatar
      PM / clk: signedness bug in of_pm_clk_add_clks() · d2a97eba
      Dan Carpenter authored
      commit 5e2e2f9f upstream.
      
      "count" needs to be signed for the error handling to work.  I made "i"
      signed as well so they match.
      
      Fixes: 02113ba9 (PM / clk: Add support for obtaining clocks from device-tree)
      Cc: 4.6+ <stable@vger.kernel.org> # 4.6+
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d2a97eba
    • Alberto Panizzo's avatar
      clk: rockchip: fix clk_i2sout parent selection bits on rk3399 · 2adc2541
      Alberto Panizzo authored
      commit a64ad008 upstream.
      
      Register, shift and mask were wrong according to datasheet.
      
      Fixes: 11551005 ("clk: rockchip: add clock controller for the RK3399")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarAlberto Panizzo <alberto@amarulasolutions.com>
      Signed-off-by: default avatarAnthony Brandon <anthony@amarulasolutions.com>
      Signed-off-by: default avatarHeiko Stuebner <heiko@sntech.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2adc2541
    • Mike Christie's avatar
      iscsi target: fix session creation failure handling · ae302d68
      Mike Christie authored
      commit 26abc916 upstream.
      
      The problem is that iscsi_login_zero_tsih_s1 sets conn->sess early in
      iscsi_login_set_conn_values. If the function fails later like when we
      alloc the idr it does kfree(sess) and leaves the conn->sess pointer set.
      iscsi_login_zero_tsih_s1 then returns -Exyz and we then call
      iscsi_target_login_sess_out and access the freed memory.
      
      This patch has iscsi_login_zero_tsih_s1 either completely setup the
      session or completely tear it down, so later in
      iscsi_target_login_sess_out we can just check for it being set to the
      connection.
      
      Cc: stable@vger.kernel.org
      Fixes: 0957627a ("iscsi-target: Fix sess allocation leak in...")
      Signed-off-by: default avatarMike Christie <mchristi@redhat.com>
      Acked-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarMatthew Wilcox <willy@infradead.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ae302d68
    • Bart Van Assche's avatar
      scsi: core: Avoid that SCSI device removal through sysfs triggers a deadlock · 5b55b24c
      Bart Van Assche authored
      commit 0ee223b2 upstream.
      
      A long time ago the unfortunate decision was taken to add a self-deletion
      attribute to the sysfs SCSI device directory. That decision was unfortunate
      because self-deletion is really tricky. We can't drop that attribute
      because widely used user space software depends on it, namely the
      rescan-scsi-bus.sh script. Hence this patch that avoids that writing into
      that attribute triggers a deadlock. See also commit 7973cbd9 ("[PATCH]
      add sysfs attributes to scan and delete scsi_devices").
      
      This patch avoids that self-removal triggers the following deadlock:
      
      ======================================================
      WARNING: possible circular locking dependency detected
      4.18.0-rc2-dbg+ #5 Not tainted
      ------------------------------------------------------
      modprobe/6539 is trying to acquire lock:
      000000008323c4cd (kn->count#202){++++}, at: kernfs_remove_by_name_ns+0x45/0x90
      
      but task is already holding lock:
      00000000a6ec2c69 (&shost->scan_mutex){+.+.}, at: scsi_remove_host+0x21/0x150 [scsi_mod]
      
      which lock already depends on the new lock.
      
      the existing dependency chain (in reverse order) is:
      
      -> #1 (&shost->scan_mutex){+.+.}:
             __mutex_lock+0xfe/0xc70
             mutex_lock_nested+0x1b/0x20
             scsi_remove_device+0x26/0x40 [scsi_mod]
             sdev_store_delete+0x27/0x30 [scsi_mod]
             dev_attr_store+0x3e/0x50
             sysfs_kf_write+0x87/0xa0
             kernfs_fop_write+0x190/0x230
             __vfs_write+0xd2/0x3b0
             vfs_write+0x101/0x270
             ksys_write+0xab/0x120
             __x64_sys_write+0x43/0x50
             do_syscall_64+0x77/0x230
             entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      -> #0 (kn->count#202){++++}:
             lock_acquire+0xd2/0x260
             __kernfs_remove+0x424/0x4a0
             kernfs_remove_by_name_ns+0x45/0x90
             remove_files.isra.1+0x3a/0x90
             sysfs_remove_group+0x5c/0xc0
             sysfs_remove_groups+0x39/0x60
             device_remove_attrs+0x82/0xb0
             device_del+0x251/0x580
             __scsi_remove_device+0x19f/0x1d0 [scsi_mod]
             scsi_forget_host+0x37/0xb0 [scsi_mod]
             scsi_remove_host+0x9b/0x150 [scsi_mod]
             sdebug_driver_remove+0x4b/0x150 [scsi_debug]
             device_release_driver_internal+0x241/0x360
             device_release_driver+0x12/0x20
             bus_remove_device+0x1bc/0x290
             device_del+0x259/0x580
             device_unregister+0x1a/0x70
             sdebug_remove_adapter+0x8b/0xf0 [scsi_debug]
             scsi_debug_exit+0x76/0xe8 [scsi_debug]
             __x64_sys_delete_module+0x1c1/0x280
             do_syscall_64+0x77/0x230
             entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      other info that might help us debug this:
      
       Possible unsafe locking scenario:
      
             CPU0                    CPU1
             ----                    ----
        lock(&shost->scan_mutex);
                                     lock(kn->count#202);
                                     lock(&shost->scan_mutex);
        lock(kn->count#202);
      
       *** DEADLOCK ***
      
      2 locks held by modprobe/6539:
       #0: 00000000efaf9298 (&dev->mutex){....}, at: device_release_driver_internal+0x68/0x360
       #1: 00000000a6ec2c69 (&shost->scan_mutex){+.+.}, at: scsi_remove_host+0x21/0x150 [scsi_mod]
      
      stack backtrace:
      CPU: 10 PID: 6539 Comm: modprobe Not tainted 4.18.0-rc2-dbg+ #5
      Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.0.0-prebuilt.qemu-project.org 04/01/2014
      Call Trace:
       dump_stack+0xa4/0xf5
       print_circular_bug.isra.34+0x213/0x221
       __lock_acquire+0x1a7e/0x1b50
       lock_acquire+0xd2/0x260
       __kernfs_remove+0x424/0x4a0
       kernfs_remove_by_name_ns+0x45/0x90
       remove_files.isra.1+0x3a/0x90
       sysfs_remove_group+0x5c/0xc0
       sysfs_remove_groups+0x39/0x60
       device_remove_attrs+0x82/0xb0
       device_del+0x251/0x580
       __scsi_remove_device+0x19f/0x1d0 [scsi_mod]
       scsi_forget_host+0x37/0xb0 [scsi_mod]
       scsi_remove_host+0x9b/0x150 [scsi_mod]
       sdebug_driver_remove+0x4b/0x150 [scsi_debug]
       device_release_driver_internal+0x241/0x360
       device_release_driver+0x12/0x20
       bus_remove_device+0x1bc/0x290
       device_del+0x259/0x580
       device_unregister+0x1a/0x70
       sdebug_remove_adapter+0x8b/0xf0 [scsi_debug]
       scsi_debug_exit+0x76/0xe8 [scsi_debug]
       __x64_sys_delete_module+0x1c1/0x280
       do_syscall_64+0x77/0x230
       entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      See also https://www.mail-archive.com/linux-scsi@vger.kernel.org/msg54525.html.
      
      Fixes: ac0ece91 ("scsi: use device_remove_file_self() instead of device_schedule_callback()")
      Signed-off-by: default avatarBart Van Assche <bart.vanassche@wdc.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Acked-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Johannes Thumshirn <jthumshirn@suse.de>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      5b55b24c
    • Bart Van Assche's avatar
      scsi: sysfs: Introduce sysfs_{un,}break_active_protection() · c984f4d1
      Bart Van Assche authored
      commit 2afc9166 upstream.
      
      Introduce these two functions and export them such that the next patch
      can add calls to these functions from the SCSI core.
      Signed-off-by: default avatarBart Van Assche <bart.vanassche@wdc.com>
      Acked-by: default avatarTejun Heo <tj@kernel.org>
      Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c984f4d1
    • Bart Van Assche's avatar
      scsi: mpt3sas: Fix _transport_smp_handler() error path · d071004e
      Bart Van Assche authored
      commit 91b7bdb2 upstream.
      
      This patch avoids that smatch complains about a double unlock on
      ioc->transport_cmds.mutex.
      
      Fixes: 651a0136 ("scsi: scsi_transport_sas: switch to bsg-lib for SMP passthrough")
      Signed-off-by: default avatarBart Van Assche <bart.vanassche@wdc.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Sathya Prakash <sathya.prakash@broadcom.com>
      Cc: Chaitra P B <chaitra.basappa@broadcom.com>
      Cc: Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d071004e
    • Ricardo Schwarzmeier's avatar
      tpm: Return the actual size when receiving an unsupported command · 61ec14f4
      Ricardo Schwarzmeier authored
      commit 36a11029 upstream.
      
      The userpace expects to read the number of bytes stated in the header.
      Returning the size of the buffer instead would be unexpected.
      
      Cc: stable@vger.kernel.org
      Fixes: 095531f8 ("tpm: return a TPM_RC_COMMAND_CODE response if command is not implemented")
      Signed-off-by: default avatarRicardo Schwarzmeier <Ricardo.Schwarzmeier@infineon.com>
      Reviewed-by: default avatarJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
      Signed-off-by: default avatarJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      61ec14f4
    • Paul Burton's avatar
      MIPS: lib: Provide MIPS64r6 __multi3() for GCC < 7 · ba0797a8
      Paul Burton authored
      commit 690d9163 upstream.
      
      Some versions of GCC suboptimally generate calls to the __multi3()
      intrinsic for MIPS64r6 builds, resulting in link failures due to the
      missing function:
      
          LD      vmlinux.o
          MODPOST vmlinux.o
        kernel/bpf/verifier.o: In function `kmalloc_array':
        include/linux/slab.h:631: undefined reference to `__multi3'
        fs/select.o: In function `kmalloc_array':
        include/linux/slab.h:631: undefined reference to `__multi3'
        ...
      
      We already have a workaround for this in which we provide the
      instrinsic, but we do so selectively for GCC 7 only. Unfortunately the
      issue occurs with older GCC versions too - it has been observed with
      both GCC 5.4.0 & GCC 6.4.0.
      
      MIPSr6 support was introduced in GCC 5, so all major GCC versions prior
      to GCC 8 are affected and we extend our workaround accordingly to all
      MIPS64r6 builds using GCC versions older than GCC 8.
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Reported-by: default avatarVladimir Kondratiev <vladimir.kondratiev@intel.com>
      Fixes: ebabcf17 ("MIPS: Implement __multi3 for GCC7 MIPS64r6 builds")
      Patchwork: https://patchwork.linux-mips.org/patch/20297/
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      Cc: stable@vger.kernel.org # 4.15+
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ba0797a8
    • Huacai Chen's avatar
      MIPS: Change definition of cpu_relax() for Loongson-3 · 1c40cd97
      Huacai Chen authored
      commit a3071886 upstream.
      
      Linux expects that if a CPU modifies a memory location, then that
      modification will eventually become visible to other CPUs in the system.
      
      Loongson 3 CPUs include a Store Fill Buffer (SFB) which sits between a
      core & its L1 data cache, queueing memory accesses & allowing for faster
      forwarding of data from pending stores to younger loads from the core.
      Unfortunately the SFB prioritizes loads such that a continuous stream of
      loads may cause a pending write to be buffered indefinitely. This is
      problematic if we end up with 2 CPUs which each perform a store that the
      other polls for - one or both CPUs may end up with their stores buffered
      in the SFB, never reaching cache due to the continuous reads from the
      poll loop. Such a deadlock condition has been observed whilst running
      qspinlock code.
      
      This patch changes the definition of cpu_relax() to smp_mb() for
      Loongson-3, forcing a flush of the SFB on SMP systems which will cause
      any pending writes to make it as far as the L1 caches where they will
      become visible to other CPUs. If the kernel is not compiled for SMP
      support, this will expand to a barrier() as before.
      
      This workaround matches that currently implemented for ARM when
      CONFIG_ARM_ERRATA_754327=y, which was introduced by commit 534be1d5
      ("ARM: 6194/1: change definition of cpu_relax() for ARM11MPCore").
      
      Although the workaround is only required when the Loongson 3 SFB
      functionality is enabled, and we only began explicitly enabling that
      functionality in v4.7 with commit 1e820da3 ("MIPS: Loongson-3:
      Introduce CONFIG_LOONGSON3_ENHANCEMENT"), existing or future firmware
      may enable the SFB which means we may need the workaround backported to
      earlier kernels too.
      
      [paul.burton@mips.com:
        - Reword commit message & comment.
        - Limit stable backport to v3.15+ where we support Loongson 3 CPUs.]
      Signed-off-by: default avatarHuacai Chen <chenhc@lemote.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      References: 534be1d5 ("ARM: 6194/1: change definition of cpu_relax() for ARM11MPCore")
      References: 1e820da3 ("MIPS: Loongson-3: Introduce CONFIG_LOONGSON3_ENHANCEMENT")
      Patchwork: https://patchwork.linux-mips.org/patch/19830/
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: linux-mips@linux-mips.org
      Cc: Fuxin Zhang <zhangfx@lemote.com>
      Cc: Zhangjin Wu <wuzhangjin@gmail.com>
      Cc: Huacai Chen <chenhuacai@gmail.com>
      Cc: stable@vger.kernel.org # v3.15+
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1c40cd97
    • Paul Burton's avatar
      MIPS: Always use -march=<arch>, not -<arch> shortcuts · 156b5e33
      Paul Burton authored
      commit 344ebf09 upstream.
      
      The VDSO Makefile filters CFLAGS to select a subset which it uses whilst
      building the VDSO ELF. One of the flags it allows through is the -march=
      flag that selects the architecture/ISA to target.
      
      Unfortunately in cases where CONFIG_CPU_MIPS32_R{1,2}=y and the
      toolchain defaults to building for MIPS64, the main MIPS Makefile ends
      up using the short-form -<arch> flags in cflags-y. This is because the
      calls to cc-option always fail to use the long-form -march=<arch> flag
      due to the lack of an -mabi=<abi> flag in KBUILD_CFLAGS at the point
      where the cc-option function is executed. The resulting GCC invocation
      is something like:
      
        $ mips64-linux-gcc -Werror -march=mips32r2 -c -x c /dev/null -o tmp
        cc1: error: '-march=mips32r2' is not compatible with the selected ABI
      
      These short-form -<arch> flags are dropped by the VDSO Makefile's
      filtering, and so we attempt to build the VDSO without specifying any
      architecture. This results in an attempt to build the VDSO using
      whatever the compiler's default architecture is, regardless of whether
      that is suitable for the kernel configuration.
      
      One encountered build failure resulting from this mismatch is a
      rejection of the sync instruction if the kernel is configured for a
      MIPS32 or MIPS64 r1 or r2 target but the toolchain defaults to an older
      architecture revision such as MIPS1 which did not include the sync
      instruction:
      
          CC      arch/mips/vdso/gettimeofday.o
        /tmp/ccGQKoOj.s: Assembler messages:
        /tmp/ccGQKoOj.s:273: Error: opcode not supported on this processor: mips1 (mips1) `sync'
        /tmp/ccGQKoOj.s:329: Error: opcode not supported on this processor: mips1 (mips1) `sync'
        /tmp/ccGQKoOj.s:520: Error: opcode not supported on this processor: mips1 (mips1) `sync'
        /tmp/ccGQKoOj.s:714: Error: opcode not supported on this processor: mips1 (mips1) `sync'
        /tmp/ccGQKoOj.s:1009: Error: opcode not supported on this processor: mips1 (mips1) `sync'
        /tmp/ccGQKoOj.s:1066: Error: opcode not supported on this processor: mips1 (mips1) `sync'
        /tmp/ccGQKoOj.s:1114: Error: opcode not supported on this processor: mips1 (mips1) `sync'
        /tmp/ccGQKoOj.s:1279: Error: opcode not supported on this processor: mips1 (mips1) `sync'
        /tmp/ccGQKoOj.s:1334: Error: opcode not supported on this processor: mips1 (mips1) `sync'
        /tmp/ccGQKoOj.s:1374: Error: opcode not supported on this processor: mips1 (mips1) `sync'
        /tmp/ccGQKoOj.s:1459: Error: opcode not supported on this processor: mips1 (mips1) `sync'
        /tmp/ccGQKoOj.s:1514: Error: opcode not supported on this processor: mips1 (mips1) `sync'
        /tmp/ccGQKoOj.s:1814: Error: opcode not supported on this processor: mips1 (mips1) `sync'
        /tmp/ccGQKoOj.s:2002: Error: opcode not supported on this processor: mips1 (mips1) `sync'
        /tmp/ccGQKoOj.s:2066: Error: opcode not supported on this processor: mips1 (mips1) `sync'
        make[2]: *** [scripts/Makefile.build:318: arch/mips/vdso/gettimeofday.o] Error 1
        make[1]: *** [scripts/Makefile.build:558: arch/mips/vdso] Error 2
        make[1]: *** Waiting for unfinished jobs....
      
      This can be reproduced for example by attempting to build
      pistachio_defconfig using Arnd's GCC 8.1.0 mips64 toolchain from
      kernel.org:
      
        https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/8.1.0/x86_64-gcc-8.1.0-nolibc-mips64-linux.tar.xz
      
      Resolve this problem by using the long-form -march=<arch> in all cases,
      which makes it through the arch/mips/vdso/Makefile's filtering & is thus
      consistently used to build both the kernel proper & the VDSO.
      
      The use of cc-option to prefer the long-form & fall back to the
      short-form flags makes no sense since the short-form is just an
      abbreviation for the also-supported long-form in all GCC versions that
      we support building with. This means there is no case in which we have
      to use the short-form -<arch> flags, so we can simply remove them.
      
      The manual redefinition of _MIPS_ISA is removed naturally along with the
      use of the short-form flags that it accompanied, and whilst here we
      remove the separate assembler ISA selection. I suspect that both of
      these were only required due to the mips32 vs mips2 mismatch that was
      introduced by commit 59b3e8e9 ("[MIPS] Makefile crapectomy.") and
      fixed but not cleaned up by commit 9200c0b2 ("[MIPS] Fix Makefile
      bugs for MIPS32/MIPS64 R1 and R2.").
      
      I've marked this for backport as far as v4.4 where the MIPS VDSO was
      introduced. In earlier kernels there should be no ill effect to using
      the short-form flags.
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      Cc: stable@vger.kernel.org # v4.4+
      Reviewed-by: default avatarJames Hogan <jhogan@kernel.org>
      Patchwork: https://patchwork.linux-mips.org/patch/19579/Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      156b5e33
    • Maciej W. Rozycki's avatar
      MIPS: Correct the 64-bit DSP accumulator register size · 62c59b1d
      Maciej W. Rozycki authored
      commit f5958b4c upstream.
      
      Use the `unsigned long' rather than `__u32' type for DSP accumulator
      registers, like with the regular MIPS multiply/divide accumulator and
      general-purpose registers, as all are 64-bit in 64-bit implementations
      and using a 32-bit data type leads to contents truncation on context
      saving.
      
      Update `arch_ptrace' and `compat_arch_ptrace' accordingly, removing
      casts that are similarly not used with multiply/divide accumulator or
      general-purpose register accesses.
      Signed-off-by: default avatarMaciej W. Rozycki <macro@mips.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Fixes: e50c0a8f ("Support the MIPS32 / MIPS64 DSP ASE.")
      Patchwork: https://patchwork.linux-mips.org/patch/19329/
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-fsdevel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Cc: stable@vger.kernel.org # 2.6.15+
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      62c59b1d
    • Masami Hiramatsu's avatar
      kprobes: Make list and blacklist root user read only · 4bdf9c17
      Masami Hiramatsu authored
      commit f2a3ab36 upstream.
      
      Since the blacklist and list files on debugfs indicates
      a sensitive address information to reader, it should be
      restricted to the root user.
      Suggested-by: default avatarThomas Richter <tmricht@linux.ibm.com>
      Suggested-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
      Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: David Howells <dhowells@redhat.com>
      Cc: David S . Miller <davem@davemloft.net>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Jon Medhurst <tixy@linaro.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tobin C . Harding <me@tobin.cc>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: acme@kernel.org
      Cc: akpm@linux-foundation.org
      Cc: brueckner@linux.vnet.ibm.com
      Cc: linux-arch@vger.kernel.org
      Cc: rostedt@goodmis.org
      Cc: schwidefsky@de.ibm.com
      Cc: stable@vger.kernel.org
      Link: https://lkml.kernel.org/lkml/152491890171.9916.5183693615601334087.stgit@devboxSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4bdf9c17
    • Masami Hiramatsu's avatar
      kprobes/arm: Fix %p uses in error messages · 6ba27d3e
      Masami Hiramatsu authored
      commit 75b2f5f5 upstream.
      
      Fix %p uses in error messages by removing it and
      using general dumper.
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
      Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: David Howells <dhowells@redhat.com>
      Cc: David S . Miller <davem@davemloft.net>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Jon Medhurst <tixy@linaro.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Tobin C . Harding <me@tobin.cc>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: acme@kernel.org
      Cc: akpm@linux-foundation.org
      Cc: brueckner@linux.vnet.ibm.com
      Cc: linux-arch@vger.kernel.org
      Cc: rostedt@goodmis.org
      Cc: schwidefsky@de.ibm.com
      Cc: stable@vger.kernel.org
      Link: https://lkml.kernel.org/lkml/152491905361.9916.15300852365956231645.stgit@devboxSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6ba27d3e
    • Sebastian Ott's avatar
      s390/pci: fix out of bounds access during irq setup · 0536c9e4
      Sebastian Ott authored
      commit 866f3576 upstream.
      
      During interrupt setup we allocate interrupt vectors, walk the list of msi
      descriptors, and fill in the message data. Requesting more interrupts than
      supported on s390 can lead to an out of bounds access.
      
      When we restrict the number of interrupts we should also stop walking the
      msi list after all supported interrupts are handled.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSebastian Ott <sebott@linux.ibm.com>
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0536c9e4
    • Martin Schwidefsky's avatar
      s390/numa: move initial setup of node_to_cpumask_map · 2ac8fbd1
      Martin Schwidefsky authored
      commit fb7d7518 upstream.
      
      The numa_init_early initcall sets the node_to_cpumask_map[0] to the
      full cpu_possible_mask. Unfortunately this early_initcall is too late,
      the NUMA setup for numa=emu is done even earlier. The order of calls
      is numa_setup() -> emu_update_cpu_topology(), then the early_initcalls(),
      followed by sched_init_domains().
      
      Starting with git commit 051f3ca0
      "sched/topology: Introduce NUMA identity node sched domain"
      the incorrect node_to_cpumask_map[0] really screws up the domain
      setup and the kernel panics with the follow oops:
      
      Cc: <stable@vger.kernel.org> # v4.15+
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2ac8fbd1
    • Julian Wiedmann's avatar
      s390/qdio: reset old sbal_state flags · 97e3dcc0
      Julian Wiedmann authored
      commit 64e03ff7 upstream.
      
      When allocating a new AOB fails, handle_outbound() is still capable of
      transmitting the selected buffer (just without async completion).
      
      But if a previous transfer on this queue slot used async completion, its
      sbal_state flags field is still set to QDIO_OUTBUF_STATE_FLAG_PENDING.
      So when the upper layer driver sees this stale flag, it expects an async
      completion that never happens.
      
      Fix this by unconditionally clearing the flags field.
      
      Fixes: 104ea556 ("qdio: support asynchronous delivery of storage blocks")
      Cc: <stable@vger.kernel.org> #v3.2+
      Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      97e3dcc0
    • Martin Schwidefsky's avatar
      s390: fix br_r1_trampoline for machines without exrl · bcd169a2
      Martin Schwidefsky authored
      commit 26f84384 upstream.
      
      For machines without the exrl instruction the BFP jit generates
      code that uses an "br %r1" instruction located in the lowcore page.
      Unfortunately there is a cut & paste error that puts an additional
      "larl %r1,.+14" instruction in the code that clobbers the branch
      target address in %r1. Remove the larl instruction.
      
      Cc: <stable@vger.kernel.org> # v4.17+
      Fixes: de5cb6eb ("s390: use expoline thunks in the BPF JIT")
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bcd169a2
    • Gerald Schaefer's avatar
      s390/mm: fix addressing exception after suspend/resume · 9fae74e9
      Gerald Schaefer authored
      commit 37a366fa upstream.
      
      Commit c9b5ad54 "s390/mm: tag normal pages vs pages used in page tables"
      accidentally changed the logic in arch_set_page_states(), which is used by
      the suspend/resume code. set_page_stable(page, order) was changed to
      set_page_stable_dat(page, 0). After this, only the first page of higher order
      pages will be set to stable, and a write to one of the unstable pages will
      result in an addressing exception.
      
      Fix this by using "order" again, instead of "0".
      
      Fixes: c9b5ad54 ("s390/mm: tag normal pages vs pages used in page tables")
      Cc: stable@vger.kernel.org # 4.14+
      Reviewed-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarGerald Schaefer <gerald.schaefer@de.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9fae74e9
    • Jann Horn's avatar
      x86/entry/64: Wipe KASAN stack shadow before rewind_stack_do_exit() · bbcbaf56
      Jann Horn authored
      commit f12d11c5 upstream.
      
      Reset the KASAN shadow state of the task stack before rewinding RSP.
      Without this, a kernel oops will leave parts of the stack poisoned, and
      code running under do_exit() can trip over such poisoned regions and cause
      nonsensical false-positive KASAN reports about stack-out-of-bounds bugs.
      
      This does not wipe the exception stacks; if an oops happens on an exception
      stack, it might result in random KASAN false-positives from other tasks
      afterwards. This is probably relatively uninteresting, since if the kernel
      oopses on an exception stack, there are most likely bigger things to worry
      about. It'd be more interesting if vmapped stacks and KASAN were
      compatible, since then handle_stack_overflow() would oops from exception
      stack context.
      
      Fixes: 2deb4be2 ("x86/dumpstack: When OOPSing, rewind the stack before do_exit()")
      Signed-off-by: default avatarJann Horn <jannh@google.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Acked-by: default avatarAndrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: kasan-dev@googlegroups.com
      Cc: stable@vger.kernel.org
      Link: https://lkml.kernel.org/r/20180828184033.93712-1-jannh@google.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bbcbaf56