1. 30 Mar, 2017 7 commits
  2. 26 Mar, 2017 28 commits
  3. 22 Mar, 2017 5 commits
    • Greg Kroah-Hartman's avatar
      Linux 4.10.5 · 034612ee
      Greg Kroah-Hartman authored
      034612ee
    • Krzysztof Kozlowski's avatar
      crypto: s5p-sss - Fix spinlock recursion on LRW(AES) · 7814c9bd
      Krzysztof Kozlowski authored
      commit 28b62b14 upstream.
      
      Running TCRYPT with LRW compiled causes spinlock recursion:
      
          testing speed of async lrw(aes) (lrw(ecb-aes-s5p)) encryption
          tcrypt: test 0 (256 bit key, 16 byte blocks): 19007 operations in 1 seconds (304112 bytes)
          tcrypt: test 1 (256 bit key, 64 byte blocks): 15753 operations in 1 seconds (1008192 bytes)
          tcrypt: test 2 (256 bit key, 256 byte blocks): 14293 operations in 1 seconds (3659008 bytes)
          tcrypt: test 3 (256 bit key, 1024 byte blocks): 11906 operations in 1 seconds (12191744 bytes)
          tcrypt: test 4 (256 bit key, 8192 byte blocks):
          BUG: spinlock recursion on CPU#1, irq/84-10830000/89
           lock: 0xeea99a68, .magic: dead4ead, .owner: irq/84-10830000/89, .owner_cpu: 1
          CPU: 1 PID: 89 Comm: irq/84-10830000 Not tainted 4.11.0-rc1-00001-g897ca6d0800d #559
          Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
          [<c010e1ec>] (unwind_backtrace) from [<c010ae1c>] (show_stack+0x10/0x14)
          [<c010ae1c>] (show_stack) from [<c03449c0>] (dump_stack+0x78/0x8c)
          [<c03449c0>] (dump_stack) from [<c015de68>] (do_raw_spin_lock+0x11c/0x120)
          [<c015de68>] (do_raw_spin_lock) from [<c0720110>] (_raw_spin_lock_irqsave+0x20/0x28)
          [<c0720110>] (_raw_spin_lock_irqsave) from [<c0572ca0>] (s5p_aes_crypt+0x2c/0xb4)
          [<c0572ca0>] (s5p_aes_crypt) from [<bf1d8aa4>] (do_encrypt+0x78/0xb0 [lrw])
          [<bf1d8aa4>] (do_encrypt [lrw]) from [<bf1d8b00>] (encrypt_done+0x24/0x54 [lrw])
          [<bf1d8b00>] (encrypt_done [lrw]) from [<c05732a0>] (s5p_aes_complete+0x60/0xcc)
          [<c05732a0>] (s5p_aes_complete) from [<c0573440>] (s5p_aes_interrupt+0x134/0x1a0)
          [<c0573440>] (s5p_aes_interrupt) from [<c01667c4>] (irq_thread_fn+0x1c/0x54)
          [<c01667c4>] (irq_thread_fn) from [<c0166a98>] (irq_thread+0x12c/0x1e0)
          [<c0166a98>] (irq_thread) from [<c0136a28>] (kthread+0x108/0x138)
          [<c0136a28>] (kthread) from [<c0107778>] (ret_from_fork+0x14/0x3c)
      
      Interrupt handling routine was calling req->base.complete() under
      spinlock.  In most cases this wasn't fatal but when combined with some
      of the cipher modes (like LRW) this caused recursion - starting the new
      encryption (s5p_aes_crypt()) while still holding the spinlock from
      previous round (s5p_aes_complete()).
      
      Beside that, the s5p_aes_interrupt() error handling path could execute
      two completions in case of error for RX and TX blocks.
      
      Rewrite the interrupt handling routine and the completion by:
      
      1. Splitting the operations on scatterlist copies from
         s5p_aes_complete() into separate s5p_sg_done(). This still should be
         done under lock.
         The s5p_aes_complete() now only calls req->base.complete() and it has
         to be called outside of lock.
      
      2. Moving the s5p_aes_complete() out of spinlock critical sections.
         In interrupt service routine s5p_aes_interrupts(), it appeared in few
         places, including error paths inside other functions called from ISR.
         This code was not so obvious to read so simplify it by putting the
         s5p_aes_complete() only within ISR level.
      Reported-by: default avatarNathan Royce <nroycea+kernel@gmail.com>
      Signed-off-by: default avatarKrzysztof Kozlowski <krzk@kernel.org>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7814c9bd
    • Daniel Axtens's avatar
      crypto: powerpc - Fix initialisation of crc32c context · 4310604e
      Daniel Axtens authored
      commit aa2be9b3 upstream.
      
      Turning on crypto self-tests on a POWER8 shows:
      
          alg: hash: Test 1 failed for crc32c-vpmsum
          00000000: ff ff ff ff
      
      Comparing the code with the Intel CRC32c implementation on which
      ours is based shows that we are doing an init with 0, not ~0
      as CRC32c requires.
      
      This probably wasn't caught because btrfs does its own weird
      open-coded initialisation.
      
      Initialise our internal context to ~0 on init.
      
      This makes the self-tests pass, and btrfs continues to work.
      
      Fixes: 6dd7a82c ("crypto: powerpc - Add POWER8 optimised crc32c")
      Cc: Anton Blanchard <anton@samba.org>
      Signed-off-by: default avatarDaniel Axtens <dja@axtens.net>
      Acked-by: default avatarAnton Blanchard <anton@samba.org>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4310604e
    • Niklas Cassel's avatar
      locking/rwsem: Fix down_write_killable() for CONFIG_RWSEM_GENERIC_SPINLOCK=y · de3c88fa
      Niklas Cassel authored
      commit 17fcbd59 upstream.
      
      We hang if SIGKILL has been sent, but the task is stuck in down_read()
      (after do_exit()), even though no task is doing down_write() on the
      rwsem in question:
      
        INFO: task libupnp:21868 blocked for more than 120 seconds.
        libupnp         D    0 21868      1 0x08100008
        ...
        Call Trace:
        __schedule()
        schedule()
        __down_read()
        do_exit()
        do_group_exit()
        __wake_up_parent()
      
      This bug has already been fixed for CONFIG_RWSEM_XCHGADD_ALGORITHM=y in
      the following commit:
      
       04cafed7 ("locking/rwsem: Fix down_write_killable()")
      
      ... however, this bug also exists for CONFIG_RWSEM_GENERIC_SPINLOCK=y.
      Signed-off-by: default avatarNiklas Cassel <niklas.cassel@axis.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: <mhocko@suse.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Niklas Cassel <niklass@axis.com>
      Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Fixes: d4799608 ("locking/rwsem: Introduce basis for down_write_killable()")
      Link: http://lkml.kernel.org/r/1487981873-12649-1-git-send-email-niklass@axis.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      de3c88fa
    • Peter Zijlstra's avatar
      futex: Add missing error handling to FUTEX_REQUEUE_PI · d80e46d9
      Peter Zijlstra authored
      commit 9bbb25af upstream.
      
      Thomas spotted that fixup_pi_state_owner() can return errors and we
      fail to unlock the rt_mutex in that case.
      Reported-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Reviewed-by: default avatarDarren Hart <dvhart@linux.intel.com>
      Cc: juri.lelli@arm.com
      Cc: bigeasy@linutronix.de
      Cc: xlpang@redhat.com
      Cc: rostedt@goodmis.org
      Cc: mathieu.desnoyers@efficios.com
      Cc: jdesfossez@efficios.com
      Cc: dvhart@infradead.org
      Cc: bristot@redhat.com
      Link: http://lkml.kernel.org/r/20170304093558.867401760@infradead.orgSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d80e46d9