linux/arch/powerpc/crypto
Michael Ellerman 4749228f02 powerpc/crypto/crc32c-vpmsum: Fix missing preempt_disable()
In crc32c_vpmsum() we call enable_kernel_altivec() without first
disabling preemption, which is not allowed:

  WARNING: CPU: 9 PID: 2949 at ../arch/powerpc/kernel/process.c:277 enable_kernel_altivec+0x100/0x120
  Modules linked in: dm_thin_pool dm_persistent_data dm_bio_prison dm_bufio libcrc32c vmx_crypto ...
  CPU: 9 PID: 2949 Comm: docker Not tainted 4.11.0-rc5-compiler_gcc-6.3.1-00033-g308ac7563944 #381
  ...
  NIP [c00000000001e320] enable_kernel_altivec+0x100/0x120
  LR [d000000003df0910] crc32c_vpmsum+0x108/0x150 [crc32c_vpmsum]
  Call Trace:
    0xc138fd09 (unreliable)
    crc32c_vpmsum+0x108/0x150 [crc32c_vpmsum]
    crc32c_vpmsum_update+0x3c/0x60 [crc32c_vpmsum]
    crypto_shash_update+0x88/0x1c0
    crc32c+0x64/0x90 [libcrc32c]
    dm_bm_checksum+0x48/0x80 [dm_persistent_data]
    sb_check+0x84/0x120 [dm_thin_pool]
    dm_bm_validate_buffer.isra.0+0xc0/0x1b0 [dm_persistent_data]
    dm_bm_read_lock+0x80/0xf0 [dm_persistent_data]
    __create_persistent_data_objects+0x16c/0x810 [dm_thin_pool]
    dm_pool_metadata_open+0xb0/0x1a0 [dm_thin_pool]
    pool_ctr+0x4cc/0xb60 [dm_thin_pool]
    dm_table_add_target+0x16c/0x3c0
    table_load+0x184/0x400
    ctl_ioctl+0x2f0/0x560
    dm_ctl_ioctl+0x38/0x50
    do_vfs_ioctl+0xd8/0x920
    SyS_ioctl+0x68/0xc0
    system_call+0x38/0xfc

It used to be sufficient just to call pagefault_disable(), because that
also disabled preemption. But the two were decoupled in commit 8222dbe21e
("sched/preempt, mm/fault: Decouple preemption from the page fault
logic") in mid 2015.

So add the missing preempt_disable/enable(). We should also call
disable_kernel_fp(), although it does nothing by default, there is a
debug switch to make it active and all enables should be paired with
disables.

Fixes: 6dd7a82cc5 ("crypto: powerpc - Add POWER8 optimised crc32c")
Cc: stable@vger.kernel.org # v4.8+
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2017-04-07 21:12:58 +10:00
..
aes-spe-core.S powerpc: Fix misspellings in comments. 2016-03-01 19:27:20 +11:00
aes-spe-glue.c powerpc updates for 4.6 2016-03-19 15:38:41 -07:00
aes-spe-keys.S crypto: powerpc/aes - key handling 2015-03-01 23:02:28 +13:00
aes-spe-modes.S crypto: powerpc/aes - ECB/CBC/CTR/XTS modes 2015-03-01 23:02:28 +13:00
aes-spe-regs.h crypto: powerpc - Fix typo 2016-05-31 16:41:55 +08:00
aes-tab-4k.S crypto: powerpc/aes - aes tables 2015-03-01 23:02:27 +13:00
crc32c-vpmsum_asm.S crypto: powerpc - Add POWER8 optimised crc32c 2016-07-05 23:05:19 +08:00
crc32c-vpmsum_glue.c powerpc/crypto/crc32c-vpmsum: Fix missing preempt_disable() 2017-04-07 21:12:58 +10:00
Makefile crypto: crc32c-vpmsum - Rename CRYPT_CRC32C_VPMSUM option 2016-11-28 21:23:17 +08:00
md5-asm.S crypto: powerpc/md5 - assembler 2015-03-04 22:12:40 +13:00
md5-glue.c crypto: powerpc/md5 - use md5 IV MD5_HX instead of their raw value 2015-05-18 12:20:20 +08:00
sha1-powerpc-asm.S crypto: sha1-powerpc - little-endian support 2016-10-02 22:31:53 +08:00
sha1-spe-asm.S crypto: powerpc - move files to fix build error 2015-03-09 21:06:19 +11:00
sha1-spe-glue.c powerpc: Create disable_kernel_{fp,altivec,vsx,spe}() 2015-12-01 13:52:25 +11:00
sha1.c crypto: add missing crypto module aliases 2015-01-13 22:29:11 +11:00
sha256-spe-asm.S crypto: ppc/sha256 - assembler 2015-02-27 22:48:45 +13:00
sha256-spe-glue.c powerpc: Create disable_kernel_{fp,altivec,vsx,spe}() 2015-12-01 13:52:25 +11:00