1. 30 Nov, 2017 24 commits
    • Takashi Iwai's avatar
      ALSA: timer: Remove kernel warning at compat ioctl error paths · 9f8eafa1
      Takashi Iwai authored
      commit 3d4e8303
      
       upstream.
      
      Some timer compat ioctls have NULL checks of timer instance with
      snd_BUG_ON() that bring up WARN_ON() when the debug option is set.
      Actually the condition can be met in the normal situation and it's
      confusing and bad to spew kernel warnings with stack trace there.
      Let's remove snd_BUG_ON() invocation and replace with the simple
      checks.  Also, correct the error code to EBADFD to follow the native
      ioctl error handling.
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9f8eafa1
    • Takashi Iwai's avatar
      ALSA: usb-audio: Add sanity checks in v2 clock parsers · 2033ec9c
      Takashi Iwai authored
      commit 0a62d6c9 upstream.
      
      The helper functions to parse and look for the clock source, selector
      and multiplier unit may return the descriptor with a too short length
      than required, while there is no sanity check in the caller side.
      Add some sanity checks in the parsers, at least, to guarantee the
      given descriptor size, for avoiding the potential crashes.
      
      Fixes: 79f920fb
      
       ("ALSA: usb-audio: parse clock topology of UAC2 devices")
      Reported-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2033ec9c
    • Takashi Iwai's avatar
      ALSA: usb-audio: Fix potential out-of-bound access at parsing SU · d1db6f6a
      Takashi Iwai authored
      commit f658f17b upstream.
      
      The usb-audio driver may trigger an out-of-bound access at parsing a
      malformed selector unit, as it checks the header length only after
      evaluating bNrInPins field, which can be already above the given
      length.  Fix it by adding the length check beforehand.
      
      Fixes: 99fc8645
      
       ("ALSA: usb-mixer: parse descriptors with structs")
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d1db6f6a
    • Takashi Iwai's avatar
      ALSA: usb-audio: Add sanity checks to FE parser · 7940c950
      Takashi Iwai authored
      commit d937cd67 upstream.
      
      When the usb-audio descriptor contains the malformed feature unit
      description with a too short length, the driver may access
      out-of-bounds.  Add a sanity check of the header size at the beginning
      of parse_audio_feature_unit().
      
      Fixes: 23caaf19
      
       ("ALSA: usb-mixer: Add support for Audio Class v2.0")
      Reported-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7940c950
    • Theodore Ts'o's avatar
      ext4: fix interaction between i_size, fallocate, and delalloc after a crash · 9b3f0217
      Theodore Ts'o authored
      commit 51e3ae81
      
       upstream.
      
      If there are pending writes subject to delayed allocation, then i_size
      will show size after the writes have completed, while i_disksize
      contains the value of i_size on the disk (since the writes have not
      been persisted to disk).
      
      If fallocate(2) is called with the FALLOC_FL_KEEP_SIZE flag, either
      with or without the FALLOC_FL_ZERO_RANGE flag set, and the new size
      after the fallocate(2) is between i_size and i_disksize, then after a
      crash, if a journal commit has resulted in the changes made by the
      fallocate() call to be persisted after a crash, but the delayed
      allocation write has not resolved itself, i_size would not be updated,
      and this would cause the following e2fsck complaint:
      
      Inode 12, end of extent exceeds allowed value
      	(logical block 33, physical block 33441, len 7)
      
      This can only take place on a sparse file, where the fallocate(2) call
      is allocating blocks in a range which is before a pending delayed
      allocation write which is extending i_size.  Since this situation is
      quite rare, and the window in which the crash must take place is
      typically < 30 seconds, in practice this condition will rarely happen.
      
      Nevertheless, it can be triggered in testing, and in particular by
      xfstests generic/456.
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Reported-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9b3f0217
    • Andrew Elble's avatar
      nfsd: deal with revoked delegations appropriately · 6b9f616e
      Andrew Elble authored
      commit 95da1b3a
      
       upstream.
      
      If a delegation has been revoked by the server, operations using that
      delegation should error out with NFS4ERR_DELEG_REVOKED in the >4.1
      case, and NFS4ERR_BAD_STATEID otherwise.
      
      The server needs NFSv4.1 clients to explicitly free revoked delegations.
      If the server returns NFS4ERR_DELEG_REVOKED, the client will do that;
      otherwise it may just forget about the delegation and be unable to
      recover when it later sees SEQ4_STATUS_RECALLABLE_STATE_REVOKED set on a
      SEQUENCE reply.  That can cause the Linux 4.1 client to loop in its
      stage manager.
      Signed-off-by: default avatarAndrew Elble <aweits@rit.edu>
      Reviewed-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6b9f616e
    • Chuck Lever's avatar
      nfs: Fix ugly referral attributes · c3014cd8
      Chuck Lever authored
      commit c05cefcc upstream.
      
      Before traversing a referral and performing a mount, the mounted-on
      directory looks strange:
      
      dr-xr-xr-x. 2 4294967294 4294967294 0 Dec 31  1969 dir.0
      
      nfs4_get_referral is wiping out any cached attributes with what was
      returned via GETATTR(fs_locations), but the bit mask for that
      operation does not request any file attributes.
      
      Retrieve owner and timestamp information so that the memcpy in
      nfs4_get_referral fills in more attributes.
      
      Changes since v1:
      - Don't request attributes that the client unconditionally replaces
      - Request only MOUNTED_ON_FILEID or FILEID attribute, not both
      - encode_fs_locations() doesn't use the third bitmask word
      
      Fixes: 6b97fd3d
      
       ("NFSv4: Follow a referral")
      Suggested-by: default avatarPradeep Thomas <pradeepthomas@gmail.com>
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c3014cd8
    • Joshua Watt's avatar
      NFS: Fix typo in nomigration mount option · 982a47b3
      Joshua Watt authored
      commit f02fee22
      
       upstream.
      
      The option was incorrectly masking off all other options.
      Signed-off-by: default avatarJoshua Watt <JPEWhacker@gmail.com>
      Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      982a47b3
    • Arnd Bergmann's avatar
      isofs: fix timestamps beyond 2027 · 491e4e3b
      Arnd Bergmann authored
      commit 34be4dbf
      
       upstream.
      
      isofs uses a 'char' variable to load the number of years since
      1900 for an inode timestamp. On architectures that use a signed
      char type by default, this results in an invalid date for
      anything beyond 2027.
      
      This changes the function argument to a 'u8' array, which
      is defined the same way on all architectures, and unambiguously
      lets us use years until 2155.
      
      This should be backported to all kernels that might still be
      in use by that date.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      491e4e3b
    • Coly Li's avatar
      bcache: check ca->alloc_thread initialized before wake up it · 001cefee
      Coly Li authored
      commit 91af8300
      
       upstream.
      
      In bcache code, sysfs entries are created before all resources get
      allocated, e.g. allocation thread of a cache set.
      
      There is posibility for NULL pointer deference if a resource is accessed
      but which is not initialized yet. Indeed Jorg Bornschein catches one on
      cache set allocation thread and gets a kernel oops.
      
      The reason for this bug is, when bch_bucket_alloc() is called during
      cache set registration and attaching, ca->alloc_thread is not properly
      allocated and initialized yet, call wake_up_process() on ca->alloc_thread
      triggers NULL pointer deference failure. A simple and fast fix is, before
      waking up ca->alloc_thread, checking whether it is allocated, and only
      wake up ca->alloc_thread when it is not NULL.
      Signed-off-by: default avatarColy Li <colyli@suse.de>
      Reported-by: default avatarJorg Bornschein <jb@capsec.org>
      Cc: Kent Overstreet <kent.overstreet@gmail.com>
      Reviewed-by: default avatarMichael Lyle <mlyle@lyle.org>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      001cefee
    • Dan Carpenter's avatar
      eCryptfs: use after free in ecryptfs_release_messaging() · 1f0e79c6
      Dan Carpenter authored
      commit db86be3a upstream.
      
      We're freeing the list iterator so we should be using the _safe()
      version of hlist_for_each_entry().
      
      Fixes: 88b4a07e
      
       ("[PATCH] eCryptfs: Public key transport mechanism")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarTyler Hicks <tyhicks@canonical.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1f0e79c6
    • Andreas Rohner's avatar
      nilfs2: fix race condition that causes file system corruption · e69699d4
      Andreas Rohner authored
      commit 31ccb1f7 upstream.
      
      There is a race condition between nilfs_dirty_inode() and
      nilfs_set_file_dirty().
      
      When a file is opened, nilfs_dirty_inode() is called to update the
      access timestamp in the inode.  It calls __nilfs_mark_inode_dirty() in a
      separate transaction.  __nilfs_mark_inode_dirty() caches the ifile
      buffer_head in the i_bh field of the inode info structure and marks it
      as dirty.
      
      After some data was written to the file in another transaction, the
      function nilfs_set_file_dirty() is called, which adds the inode to the
      ns_dirty_files list.
      
      Then the segment construction calls nilfs_segctor_collect_dirty_files(),
      which goes through the ns_dirty_files list and checks the i_bh field.
      If there is a cached buffer_head in i_bh it is not marked as dirty
      again.
      
      Since nilfs_dirty_inode() and nilfs_set_file_dirty() use separate
      transactions, it is possible that a segment construction that writes out
      the ifile occurs in-between the two.  If this happens the inode is not
      on the ns_dirty_files list, but its ifile block is still marked as dirty
      and written out.
      
      In the next segment construction, the data for the file is written out
      and nilfs_bmap_propagate() updates the b-tree.  Eventually the bmap root
      is written into the i_bh block, which is not dirty, because it was
      written out in another segment construction.
      
      As a result the bmap update can be lost, which leads to file system
      corruption.  Either the virtual block address points to an unallocated
      DAT block, or the DAT entry will be reused for something different.
      
      The error can remain undetected for a long time.  A typical error
      message would be one of the "bad btree" errors or a warning that a DAT
      entry could not be found.
      
      This bug can be reproduced reliably by a simple benchmark that creates
      and overwrites millions of 4k files.
      
      Link: http://lkml.kernel.org/r/1509367935-3086-2-git-send-email-konishi.ryusuke@lab.ntt.co.jp
      
      Signed-off-by: default avatarAndreas Rohner <andreas.rohner@gmx.net>
      Signed-off-by: default avatarRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
      Tested-by: default avatarAndreas Rohner <andreas.rohner@gmx.net>
      Tested-by: default avatarRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e69699d4
    • NeilBrown's avatar
      autofs: don't fail mount for transient error · 76b2a7f2
      NeilBrown authored
      commit ecc0c469 upstream.
      
      Currently if the autofs kernel module gets an error when writing to the
      pipe which links to the daemon, then it marks the whole moutpoint as
      catatonic, and it will stop working.
      
      It is possible that the error is transient.  This can happen if the
      daemon is slow and more than 16 requests queue up.  If a subsequent
      process tries to queue a request, and is then signalled, the write to
      the pipe will return -ERESTARTSYS and autofs will take that as total
      failure.
      
      So change the code to assess -ERESTARTSYS and -ENOMEM as transient
      failures which only abort the current request, not the whole mountpoint.
      
      It isn't a crash or a data corruption, but having autofs mountpoints
      suddenly stop working is rather inconvenient.
      
      Ian said:
      
      : And given the problems with a half dozen (or so) user space applications
      : consuming large amounts of CPU under heavy mount and umount activity this
      : could happen more easily than we expect.
      
      Link: http://lkml.kernel.org/r/87y3norvgp.fsf@notabene.neil.brown.name
      
      Signed-off-by: default avatarNeilBrown <neilb@suse.com>
      Acked-by: default avatarIan Kent <raven@themaw.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      76b2a7f2
    • Mirko Parthey's avatar
      MIPS: BCM47XX: Fix LED inversion for WRT54GSv1 · a170fea9
      Mirko Parthey authored
      commit 56a46acf upstream.
      
      The WLAN LED on the Linksys WRT54GSv1 is active low, but the software
      treats it as active high. Fix the inverted logic.
      
      Fixes: 7bb26b16
      
       ("MIPS: BCM47xx: Fix LEDs on WRT54GS V1.0")
      Signed-off-by: default avatarMirko Parthey <mirko.parthey@web.de>
      Looks-ok-by: default avatarRafał Miłecki <zajec5@gmail.com>
      Cc: Hauke Mehrtens <hauke@hauke-m.de>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/16071/
      
      Signed-off-by: default avatarJames Hogan <jhogan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a170fea9
    • Maciej W. Rozycki's avatar
      MIPS: Fix an n32 core file generation regset support regression · 778934f5
      Maciej W. Rozycki authored
      commit 547da673 upstream.
      
      Fix a commit 7aeb753b ("MIPS: Implement task_user_regset_view.")
      regression, then activated by commit 6a9c001b ("MIPS: Switch ELF
      core dumper to use regsets.)", that caused n32 processes to dump o32
      core files by failing to set the EF_MIPS_ABI2 flag in the ELF core file
      header's `e_flags' member:
      
      $ file tls-core
      tls-core: ELF 32-bit MSB executable, MIPS, N32 MIPS64 rel2 version 1 (SYSV), [...]
      $ ./tls-core
      Aborted (core dumped)
      $ file core
      core: ELF 32-bit MSB core file MIPS, MIPS-I version 1 (SYSV), SVR4-style
      $
      
      Previously the flag was set as the result of a:
      
      statement placed in arch/mips/kernel/binfmt_elfn32.c, however in the
      regset case, i.e. when CORE_DUMP_USE_REGSET is set, ELF_CORE_EFLAGS is
      no longer used by `fill_note_info' in fs/binfmt_elf.c, and instead the
      `->e_flags' member of the regset view chosen is.  We have the views
      defined in arch/mips/kernel/ptrace.c, however only an o32 and an n64
      one, and the latter is used for n32 as well.  Consequently an o32 core
      file is incorrectly dumped from n32 processes (the ELF32 vs ELF64 class
      is chosen elsewhere, and the 32-bit one is correctly selected for n32).
      
      Correct the issue then by defining an n32 regset view and using it as
      appropriate.  Issue discovered in GDB testing.
      
      Fixes: 7aeb753b
      
       ("MIPS: Implement task_user_regset_view.")
      Signed-off-by: default avatarMaciej W. Rozycki <macro@mips.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Djordje Todorovic <djordje.todorovic@rt-rk.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/17617/
      
      Signed-off-by: default avatarJames Hogan <jhogan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      778934f5
    • Hou Tao's avatar
      dm: fix race between dm_get_from_kobject() and __dm_destroy() · 84cc7b5d
      Hou Tao authored
      commit b9a41d21
      
       upstream.
      
      The following BUG_ON was hit when testing repeat creation and removal of
      DM devices:
      
          kernel BUG at drivers/md/dm.c:2919!
          CPU: 7 PID: 750 Comm: systemd-udevd Not tainted 4.1.44
          Call Trace:
           [<ffffffff81649e8b>] dm_get_from_kobject+0x34/0x3a
           [<ffffffff81650ef1>] dm_attr_show+0x2b/0x5e
           [<ffffffff817b46d1>] ? mutex_lock+0x26/0x44
           [<ffffffff811df7f5>] sysfs_kf_seq_show+0x83/0xcf
           [<ffffffff811de257>] kernfs_seq_show+0x23/0x25
           [<ffffffff81199118>] seq_read+0x16f/0x325
           [<ffffffff811de994>] kernfs_fop_read+0x3a/0x13f
           [<ffffffff8117b625>] __vfs_read+0x26/0x9d
           [<ffffffff8130eb59>] ? security_file_permission+0x3c/0x44
           [<ffffffff8117bdb8>] ? rw_verify_area+0x83/0xd9
           [<ffffffff8117be9d>] vfs_read+0x8f/0xcf
           [<ffffffff81193e34>] ? __fdget_pos+0x12/0x41
           [<ffffffff8117c686>] SyS_read+0x4b/0x76
           [<ffffffff817b606e>] system_call_fastpath+0x12/0x71
      
      The bug can be easily triggered, if an extra delay (e.g. 10ms) is added
      between the test of DMF_FREEING & DMF_DELETING and dm_get() in
      dm_get_from_kobject().
      
      To fix it, we need to ensure the test of DMF_FREEING & DMF_DELETING and
      dm_get() are done in an atomic way, so _minor_lock is used.
      
      The other callers of dm_get() have also been checked to be OK: some
      callers invoke dm_get() under _minor_lock, some callers invoke it under
      _hash_lock, and dm_start_request() invoke it after increasing
      md->open_count.
      Signed-off-by: default avatarHou Tao <houtao1@huawei.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      84cc7b5d
    • Eric Biggers's avatar
      dm bufio: fix integer overflow when limiting maximum cache size · 853d2670
      Eric Biggers authored
      commit 74d4108d upstream.
      
      The default max_cache_size_bytes for dm-bufio is meant to be the lesser
      of 25% of the size of the vmalloc area and 2% of the size of lowmem.
      However, on 32-bit systems the intermediate result in the expression
      
          (VMALLOC_END - VMALLOC_START) * DM_BUFIO_VMALLOC_PERCENT / 100
      
      overflows, causing the wrong result to be computed.  For example, on a
      32-bit system where the vmalloc area is 520093696 bytes, the result is
      1174405 rather than the expected 130023424, which makes the maximum
      cache size much too small (far less than 2% of lowmem).  This causes
      severe performance problems for dm-verity users on affected systems.
      
      Fix this by using mult_frac() to correctly multiply by a percentage.  Do
      this for all places in dm-bufio that multiply by a percentage.  Also
      replace (VMALLOC_END - VMALLOC_START) with VMALLOC_TOTAL, which contrary
      to the comment is now defined in include/linux/vmalloc.h.
      
      Depends-on: 9993bc63 ("sched/x86: Fix overflow in cyc2ns_offset")
      Fixes: 95d402f0
      
       ("dm: add bufio")
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      853d2670
    • Vijendar Mukunda's avatar
      ALSA: hda: Add Raven PCI ID · b0464fa2
      Vijendar Mukunda authored
      commit 9ceace3c
      
       upstream.
      
      This commit adds PCI ID for Raven platform
      Signed-off-by: default avatarVijendar Mukunda <Vijendar.Mukunda@amd.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b0464fa2
    • Philip Derrin's avatar
      ARM: 8721/1: mm: dump: check hardware RO bit for LPAE · f4f6d525
      Philip Derrin authored
      commit 3b0c0c92 upstream.
      
      When CONFIG_ARM_LPAE is set, the PMD dump relies on the software
      read-only bit to determine whether a page is writable. This
      concealed a bug which left the kernel text section writable
      (AP2=0) while marked read-only in the software bit.
      
      In a kernel with the AP2 bug, the dump looks like this:
      
          ---[ Kernel Mapping ]---
          0xc0000000-0xc0200000           2M RW NX SHD
          0xc0200000-0xc0600000           4M ro x  SHD
          0xc0600000-0xc0800000           2M ro NX SHD
          0xc0800000-0xc4800000          64M RW NX SHD
      
      The fix is to check that the software and hardware bits are both
      set before displaying "ro". The dump then shows the true perms:
      
          ---[ Kernel Mapping ]---
          0xc0000000-0xc0200000           2M RW NX SHD
          0xc0200000-0xc0600000           4M RW x  SHD
          0xc0600000-0xc0800000           2M RW NX SHD
          0xc0800000-0xc4800000          64M RW NX SHD
      
      Fixes: ded94779
      
       ("ARM: 8109/1: mm: Modify pte_write and pmd_write logic for LPAE")
      Signed-off-by: default avatarPhilip Derrin <philip@cog.systems>
      Tested-by: default avatarNeil Dick <neil@cog.systems>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f4f6d525
    • Masami Hiramatsu's avatar
      x86/decoder: Add new TEST instruction pattern · a63a5859
      Masami Hiramatsu authored
      commit 12a78d43
      
       upstream.
      
      The kbuild test robot reported this build warning:
      
        Warning: arch/x86/tools/test_get_len found difference at <jump_table>:ffffffff8103dd2c
      
        Warning: ffffffff8103dd82: f6 09 d8 testb $0xd8,(%rcx)
        Warning: objdump says 3 bytes, but insn_get_length() says 2
        Warning: decoded and checked 1569014 instructions with 1 warnings
      
      This sequence seems to be a new instruction not in the opcode map in the Intel SDM.
      
      The instruction sequence is "F6 09 d8", means Group3(F6), MOD(00)REG(001)RM(001), and 0xd8.
      Intel SDM vol2 A.4 Table A-6 said the table index in the group is "Encoding of Bits 5,4,3 of
      the ModR/M Byte (bits 2,1,0 in parenthesis)"
      
      In that table, opcodes listed by the index REG bits as:
      
        000         001       010 011  100        101        110         111
       TEST Ib/Iz,(undefined),NOT,NEG,MUL AL/rAX,IMUL AL/rAX,DIV AL/rAX,IDIV AL/rAX
      
      So, it seems TEST Ib is assigned to 001.
      
      Add the new pattern.
      Reported-by: default avatarkbuild test robot <fengguang.wu@intel.com>
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a63a5859
    • Eric Biggers's avatar
      lib/mpi: call cond_resched() from mpi_powm() loop · 03a2209f
      Eric Biggers authored
      commit 1d9ddde1
      
       upstream.
      
      On a non-preemptible kernel, if KEYCTL_DH_COMPUTE is called with the
      largest permitted inputs (16384 bits), the kernel spends 10+ seconds
      doing modular exponentiation in mpi_powm() without rescheduling.  If all
      threads do it, it locks up the system.  Moreover, it can cause
      rcu_sched-stall warnings.
      
      Notwithstanding the insanity of doing this calculation in kernel mode
      rather than in userspace, fix it by calling cond_resched() as each bit
      from the exponent is processed.  It's still noninterruptible, but at
      least it's preemptible now.
      
      Do the cond_resched() once per bit rather than once per MPI limb because
      each limb might still easily take 100+ milliseconds on slow CPUs.
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      03a2209f
    • Paul E. McKenney's avatar
      sched: Make resched_cpu() unconditional · 1c3a4e61
      Paul E. McKenney authored
      commit 7c2102e5
      
       upstream.
      
      The current implementation of synchronize_sched_expedited() incorrectly
      assumes that resched_cpu() is unconditional, which it is not.  This means
      that synchronize_sched_expedited() can hang when resched_cpu()'s trylock
      fails as follows (analysis by Neeraj Upadhyay):
      
      o	CPU1 is waiting for expedited wait to complete:
      
      	sync_rcu_exp_select_cpus
      	     rdp->exp_dynticks_snap & 0x1   // returns 1 for CPU5
      	     IPI sent to CPU5
      
      	synchronize_sched_expedited_wait
      		 ret = swait_event_timeout(rsp->expedited_wq,
      					   sync_rcu_preempt_exp_done(rnp_root),
      					   jiffies_stall);
      
      	expmask = 0x20, CPU 5 in idle path (in cpuidle_enter())
      
      o	CPU5 handles IPI and fails to acquire rq lock.
      
      	Handles IPI
      	     sync_sched_exp_handler
      		 resched_cpu
      		     returns while failing to try lock acquire rq->lock
      		 need_resched is not set
      
      o	CPU5 calls  rcu_idle_enter() and as need_resched is not set, goes to
      	idle (schedule() is not called).
      
      o	CPU 1 reports RCU stall.
      
      Given that resched_cpu() is now used only by RCU, this commit fixes the
      assumption by making resched_cpu() unconditional.
      Reported-by: default avatarNeeraj Upadhyay <neeraju@codeaurora.org>
      Suggested-by: default avatarNeeraj Upadhyay <neeraju@codeaurora.org>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Acked-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1c3a4e61
    • WANG Cong's avatar
      ipv6: only call ip6_route_dev_notify() once for NETDEV_UNREGISTER · 7982b5ed
      WANG Cong authored
      commit 76da0704 upstream.
      
      In commit 242d3a49 ("ipv6: reorder ip6_route_dev_notifier after ipv6_dev_notf")
      I assumed NETDEV_REGISTER and NETDEV_UNREGISTER are paired,
      unfortunately, as reported by jeffy, netdev_wait_allrefs()
      could rebroadcast NETDEV_UNREGISTER event until all refs are
      gone.
      
      We have to add an additional check to avoid this corner case.
      For netdev_wait_allrefs() dev->reg_state is NETREG_UNREGISTERED,
      for dev_change_net_namespace(), dev->reg_state is
      NETREG_REGISTERED. So check for dev->reg_state != NETREG_UNREGISTERED.
      
      Fixes: 242d3a49
      
       ("ipv6: reorder ip6_route_dev_notifier after ipv6_dev_notf")
      Reported-by: default avatarjeffy <jeffy.chen@rock-chips.com>
      Cc: David Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
      Acked-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7982b5ed
    • Vasily Gorbik's avatar
      s390/disassembler: increase show_code buffer size · 45cc2b6e
      Vasily Gorbik authored
      commit b192571d
      
       upstream.
      
      Current buffer size of 64 is too small. objdump shows that there are
      instructions which would require up to 75 bytes buffer (with current
      formating). 128 bytes "ought to be enough for anybody".
      
      Also replaces 8 spaces with a single tab to reduce the memory footprint.
      
      Fixes the following KASAN finding:
      
      BUG: KASAN: stack-out-of-bounds in number+0x3fe/0x538
      Write of size 1 at addr 000000005a4a75a0 by task bash/1282
      
      CPU: 1 PID: 1282 Comm: bash Not tainted 4.14.0+ #215
      Hardware name: IBM 2964 N96 702 (z/VM 6.4.0)
      Call Trace:
      ([<000000000011eeb6>] show_stack+0x56/0x88)
       [<0000000000e1ce1a>] dump_stack+0x15a/0x1b0
       [<00000000004e2994>] print_address_description+0xf4/0x288
       [<00000000004e2cf2>] kasan_report+0x13a/0x230
       [<0000000000e38ae6>] number+0x3fe/0x538
       [<0000000000e3dfe4>] vsnprintf+0x194/0x948
       [<0000000000e3ea42>] sprintf+0xa2/0xb8
       [<00000000001198dc>] print_insn+0x374/0x500
       [<0000000000119346>] show_code+0x4ee/0x538
       [<000000000011f234>] show_registers+0x34c/0x388
       [<000000000011f2ae>] show_regs+0x3e/0xa8
       [<000000000011f502>] die+0x1ea/0x2e8
       [<0000000000138f0e>] do_no_context+0x106/0x168
       [<0000000000139a1a>] do_protection_exception+0x4da/0x7d0
       [<0000000000e55914>] pgm_check_handler+0x16c/0x1c0
       [<000000000090639e>] sysrq_handle_crash+0x46/0x58
      ([<0000000000000007>] 0x7)
       [<00000000009073fa>] __handle_sysrq+0x102/0x218
       [<0000000000907c06>] write_sysrq_trigger+0xd6/0x100
       [<000000000061d67a>] proc_reg_write+0xb2/0x128
       [<0000000000520be6>] __vfs_write+0xee/0x368
       [<0000000000521222>] vfs_write+0x21a/0x278
       [<000000000052156a>] SyS_write+0xda/0x178
       [<0000000000e555cc>] system_call+0xc4/0x270
      
      The buggy address belongs to the page:
      page:000003d1016929c0 count:0 mapcount:0 mapping:          (null) index:0x0
      flags: 0x0()
      raw: 0000000000000000 0000000000000000 0000000000000000 ffffffff00000000
      raw: 0000000000000100 0000000000000200 0000000000000000 0000000000000000
      page dumped because: kasan: bad access detected
      
      Memory state around the buggy address:
       000000005a4a7480: 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1
       000000005a4a7500: 00 00 00 00 00 00 00 00 f2 f2 f2 f2 00 00 00 00
      >000000005a4a7580: 00 00 00 00 f3 f3 f3 f3 00 00 00 00 00 00 00 00
                                     ^
       000000005a4a7600: 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1 f8 f8
       000000005a4a7680: f2 f2 f2 f2 f2 f2 f8 f8 f2 f2 f3 f3 f3 f3 00 00
      ==================================================================
      Signed-off-by: default avatarVasily Gorbik <gor@linux.vnet.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      45cc2b6e
  2. 24 Nov, 2017 13 commits
  3. 21 Nov, 2017 3 commits