# git rev-parse -q --verify ad7b4e8022b9864c075fe71e1328b1d25cad82f6^{commit} ad7b4e8022b9864c075fe71e1328b1d25cad82f6 already have revision, skipping fetch # git checkout -q -f -B kisskb ad7b4e8022b9864c075fe71e1328b1d25cad82f6 # git clean -qxdf # < git log -1 # commit ad7b4e8022b9864c075fe71e1328b1d25cad82f6 # Author: Frederic Barrat # Date: Tue Apr 3 15:54:02 2018 +0200 # # cxl: Fix possible deadlock when processing page faults from cxllib # # cxllib_handle_fault() is called by an external driver when it needs to # have the host resolve page faults for a buffer. The buffer can cover # several pages and VMAs. The function iterates over all the pages used # by the buffer, based on the page size of the VMA. # # To ensure some stability while processing the faults, the thread T1 # grabs the mm->mmap_sem semaphore with read access (R1). However, when # processing a page fault for a single page, one of the underlying # functions, copro_handle_mm_fault(), also grabs the same semaphore with # read access (R2). So the thread T1 takes the semaphore twice. # # If another thread T2 tries to access the semaphore in write mode W1 # (say, because it wants to allocate memory and calls 'brk'), then that # thread T2 will have to wait because there's a reader (R1). If the # thread T1 is processing a new page at that time, it won't get an # automatic grant at R2, because there's now a writer thread # waiting (T2). And we have a deadlock. # # The timeline is: # 1. thread T1 owns the semaphore with read access R1 # 2. thread T2 requests write access W1 and waits # 3. thread T1 requests read access R2 and waits # # The fix is for the thread T1 to release the semaphore R1 once it got # the information it needs from the current VMA. The address space/VMAs # could evolve while T1 iterates over the full buffer, but in the # unlikely case where T1 misses a page, the external driver will raise a # new page fault when retrying the memory access. # # Fixes: 3ced8d730063 ("cxl: Export library to support IBM XSL") # Cc: stable@vger.kernel.org # 4.13+ # Signed-off-by: Frederic Barrat # Signed-off-by: Michael Ellerman # < /opt/cross/kisskb/gcc-4.6.3-nolibc/powerpc-linux/bin/powerpc-linux-gcc --version # < git log --format=%s --max-count=1 ad7b4e8022b9864c075fe71e1328b1d25cad82f6 # < make -s -j 40 ARCH=powerpc O=/kisskb/build/powerpc-next_powerpc-randconfig_powerpc CROSS_COMPILE=/opt/cross/kisskb/gcc-4.6.3-nolibc/powerpc-linux/bin/powerpc-linux- randconfig KCONFIG_SEED=0xE6379778 warning: (PPC_PSERIES && PM_SLEEP_SMP) selects HOTPLUG_CPU which has unmet direct dependencies (SMP && (PPC_PSERIES || PPC_PMAC || PPC_POWERNV || FSL_SOC_BOOKE)) # Added to kconfig CONFIG_STANDALONE=y # Added to kconfig CONFIG_BUILD_DOCSRC=n # Added to kconfig CONFIG_MODULE_SIG=n # Added to kconfig CONFIG_CPU_BIG_ENDIAN=y # Added to kconfig CONFIG_PPC64=y # Added to kconfig CONFIG_PPC_DISABLE_WERROR=y # Added to kconfig CONFIG_SECTION_MISMATCH_WARN_ONLY=y # Added to kconfig CONFIG_PREVENT_FIRMWARE_BUILD=y # Added to kconfig CONFIG_CC_STACKPROTECTOR_STRONG=n # Added to kconfig CONFIG_GCC_PLUGINS=n # Added to kconfig CONFIG_LD_HEAD_STUB_CATCH=y # Added to kconfig # yes \n | make -s -j 40 ARCH=powerpc O=/kisskb/build/powerpc-next_powerpc-randconfig_powerpc CROSS_COMPILE=/opt/cross/kisskb/gcc-4.6.3-nolibc/powerpc-linux/bin/powerpc-linux- oldconfig yes: standard output: Broken pipe yes: write error # make -s -j 40 ARCH=powerpc O=/kisskb/build/powerpc-next_powerpc-randconfig_powerpc CROSS_COMPILE=/opt/cross/kisskb/gcc-4.6.3-nolibc/powerpc-linux/bin/powerpc-linux- /kisskb/src/ipc/shm.c: In function 'SyS_shmdt': /kisskb/src/ipc/shm.c:1565:59: warning: 'file' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/ipc/shm.c:1487:15: note: 'file' was declared here /kisskb/src/lib/rhashtable.c: In function 'rhashtable_rehash_one': /kisskb/src/lib/rhashtable.c:269:2: warning: 'next' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/kernel/printk/printk.c: In function 'devkmsg_sysctl_set_loglvl': /kisskb/src/kernel/printk/printk.c:183:16: warning: 'old' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/kernel/rcu/srcutree.c: In function 'init_srcu_struct_nodes': /kisskb/src/kernel/rcu/srcutree.c:146:32: warning: 'levelspread[]' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/sound/core/pcm_iec958.c: In function 'create_iec958_consumer': /kisskb/src/sound/core/pcm_iec958.c:80:9: warning: 'ws' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/ata/ahci_qoriq.c: In function 'ahci_qoriq_hardreset': /kisskb/src/arch/powerpc/include/asm/io.h:179:1: warning: 'px_is' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/ata/ahci_qoriq.c:86:14: note: 'px_is' was declared here /kisskb/src/arch/powerpc/include/asm/io.h:179:1: warning: 'px_cmd' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/ata/ahci_qoriq.c:86:6: note: 'px_cmd' was declared here /kisskb/src/kernel/time/tick-sched.c: In function 'tick_nohz_idle_exit': /kisskb/src/kernel/time/tick-sched.c:1074:31: warning: 'now' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/lib/mpi/mpicoder.c: In function 'mpi_read_raw_from_sgl': /kisskb/src/lib/mpi/mpicoder.c:352:8: warning: 'buff' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/mm/ksm.c: In function 'stable_node_dup': /kisskb/src/mm/ksm.c:1358:15: warning: 'found_rmap_hlist_len' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/dma-buf/reservation.c: In function 'reservation_object_add_shared_replace': /kisskb/src/drivers/dma-buf/reservation.c:210:7: warning: 'i' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/char/tpm/tpm-sysfs.c: In function 'pubek_show': /kisskb/src/drivers/char/tpm/tpm-sysfs.c:37:16: warning: 'tpm_buf.data' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/net/core/gen_stats.c: In function '__gnet_stats_copy_basic': /kisskb/src/net/core/gen_stats.c:149:19: warning: 'seq' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/net/core/flow_dissector.c: In function '__skb_flow_dissect': /kisskb/src/net/core/flow_dissector.c:789:7: warning: 'vlan' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/net/core/dev.c: In function 'validate_xmit_skb_list': /kisskb/src/net/core/dev.c:3149:15: warning: 'tail' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/input/rmi4/rmi_f11.c: In function 'rmi_f11_finger_handler': /kisskb/src/drivers/input/rmi4/rmi_f11.c:631:3: warning: 'abs_fingers' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/input/joystick/analog.c:176:2: warning: #warning Precise timer not defined for this architecture. [-Wcpp] /kisskb/src/net/tipc/socket.c: In function 'tipc_recvmsg': /kisskb/src/net/tipc/socket.c:1694:27: warning: 'copy' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/input/touchscreen/hideep.c: In function 'hideep_update_firmware': /kisskb/src/drivers/input/touchscreen/hideep.c:646:16: warning: 'error' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/gpu/drm/scheduler/gpu_scheduler.c: In function 'drm_sched_job_recovery': /kisskb/src/drivers/gpu/drm/scheduler/gpu_scheduler.c:526:20: warning: 'guilty_context' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/slimbus/messaging.c: In function 'slim_do_transfer': /kisskb/src/drivers/slimbus/messaging.c:126:14: warning: 'tid' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/fs/udf/unicode.c: In function 'udf_name_conv_char': /kisskb/src/fs/udf/unicode.c:157:15: warning: 'c' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/net/ethernet/neterion/vxge/vxge-main.c: In function 'vxge_tx_msix_handle': /kisskb/src/drivers/net/ethernet/neterion/vxge/vxge-main.c:2240:1: warning: the frame size of 1040 bytes is larger than 1024 bytes [-Wframe-larger-than=] /kisskb/src/drivers/net/ethernet/neterion/vxge/vxge-main.c: In function 'vxge_poll_inta': /kisskb/src/drivers/net/ethernet/neterion/vxge/vxge-main.c:1869:1: warning: the frame size of 1040 bytes is larger than 1024 bytes [-Wframe-larger-than=] /kisskb/src/drivers/scsi/am53c974.c: In function 'pci_esp_dma_drain': /kisskb/src/drivers/scsi/am53c974.c:199:6: warning: 'resid' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxg94.c: In function 'g94_i2c_aux_xfer': /kisskb/src/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxg94.c:160:31: warning: 'stat' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/usb/serial/f81534.c: In function 'f81534_set_register': /kisskb/src/drivers/usb/serial/f81534.c:216:6: warning: 'status' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/usb/serial/f81534.c: In function 'f81534_get_register': /kisskb/src/drivers/usb/serial/f81534.c:282:5: warning: 'status' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c: In function 'gm200_i2c_aux_xfer': /kisskb/src/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c:160:31: warning: 'stat' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/gpu/drm/amd/amdgpu/../display/dc/dc_helper.c: In function 'generic_reg_wait': /kisskb/src/drivers/gpu/drm/amd/amdgpu/../display/dc/dc_helper.c:157:11: warning: 'reg_val' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/gpu/drm/nouveau/nvkm/subdev/top/gk104.c: In function 'gk104_top_oneinit': /kisskb/src/drivers/gpu/drm/nouveau/nvkm/subdev/top/gk104.c:89:20: warning: 'inst' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/gpu/drm/nouveau/nvkm/subdev/top/gk104.c:75:3: warning: 'type' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/gpu/drm/nouveau/nv50_display.c: In function 'nv50_head_lut_load': /kisskb/src/arch/powerpc/include/asm/io.h:178:1: warning: 'b' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/gpu/drm/nouveau/nv50_display.c:1813:18: note: 'b' was declared here /kisskb/src/arch/powerpc/include/asm/io.h:178:1: warning: 'g' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/gpu/drm/nouveau/nv50_display.c:1813:15: note: 'g' was declared here /kisskb/src/arch/powerpc/include/asm/io.h:178:1: warning: 'r' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/gpu/drm/nouveau/nv50_display.c:1813:12: note: 'r' was declared here WARNING: vmlinux.o(.text+0xabbe6c): Section mismatch in reference from the function .create_device_attrs() to the function .init.text:.make_sensor_label() The function .create_device_attrs() references the function __init .make_sensor_label(). This is often because .create_device_attrs lacks a __init annotation or the annotation of .make_sensor_label is wrong. WARNING: vmlinux.o(.text.unlikely+0x80): Section mismatch in reference from the function .init_fallback_flush() to the function .init.text:.ppc64_bolted_size() The function .init_fallback_flush() references the function __init .ppc64_bolted_size(). This is often because .init_fallback_flush lacks a __init annotation or the annotation of .ppc64_bolted_size is wrong. WARNING: vmlinux.o(.text.unlikely+0xac): Section mismatch in reference from the function .init_fallback_flush() to the function .init.text:.memblock_alloc_base() The function .init_fallback_flush() references the function __init .memblock_alloc_base(). This is often because .init_fallback_flush lacks a __init annotation or the annotation of .memblock_alloc_base is wrong. Completed OK # rm -rf /kisskb/build/powerpc-next_powerpc-randconfig_powerpc # Build took: 0:05:35.707504