# git rev-parse -q --verify 0be0ee71816b2b6725e2b4f32ad6726c9d729777^{commit} 0be0ee71816b2b6725e2b4f32ad6726c9d729777 already have revision, skipping fetch # git checkout -q -f -B kisskb 0be0ee71816b2b6725e2b4f32ad6726c9d729777 # git clean -qxdf # < git log -1 # commit 0be0ee71816b2b6725e2b4f32ad6726c9d729777 # Author: Linus Torvalds # Date: Mon Nov 11 15:51:03 2019 -0800 # # vfs: properly and reliably lock f_pos in fdget_pos() # # fdget_pos() is used by file operations that will read and update f_pos: # things like "read()", "write()" and "lseek()" (but not, for example, # "pread()/pwrite" that get their file positions elsewhere). # # However, it had two separate escape clauses for this, because not # everybody wants or needs serialization of the file position. # # The first and most obvious case is the "file descriptor doesn't have a # position at all", ie a stream-like file. Except we didn't actually use # FMODE_STREAM, but instead used FMODE_ATOMIC_POS. The reason for that # was that FMODE_STREAM didn't exist back in the days, but also that we # didn't want to mark all the special cases, so we only marked the ones # that _required_ position atomicity according to POSIX - regular files # and directories. # # The case one was intentionally lazy, but now that we _do_ have # FMODE_STREAM we could and should just use it. With the change to use # FMODE_STREAM, there are no remaining uses for FMODE_ATOMIC_POS, and all # the code to set it is deleted. # # Any cases where we don't want the serialization because the driver (or # subsystem) doesn't use the file position should just be updated to do # "stream_open()". We've done that for all the obvious and common # situations, we may need a few more. Quoting Kirill Smelkov in the # original FMODE_STREAM thread (see link below for full email): # # "And I appreciate if people could help at least somehow with "getting # rid of mixed case entirely" (i.e. always lock f_pos_lock on # !FMODE_STREAM), because this transition starts to diverge from my # particular use-case too far. To me it makes sense to do that # transition as follows: # # - convert nonseekable_open -> stream_open via stream_open.cocci; # - audit other nonseekable_open calls and convert left users that # truly don't depend on position to stream_open; # - extend stream_open.cocci to analyze alloc_file_pseudo as well (this # will cover pipes and sockets), or maybe convert pipes and sockets # to FMODE_STREAM manually; # - extend stream_open.cocci to analyze file_operations that use # no_llseek or noop_llseek, but do not use nonseekable_open or # alloc_file_pseudo. This might find files that have stream semantic # but are opened differently; # - extend stream_open.cocci to analyze file_operations whose # .read/.write do not use ppos at all (independently of how file was # opened); # - ... # - after that remove FMODE_ATOMIC_POS and always take f_pos_lock if # !FMODE_STREAM; # - gather bug reports for deadlocked read/write and convert missed # cases to FMODE_STREAM, probably extending stream_open.cocci along # the road to catch similar cases # # i.e. always take f_pos_lock unless a file is explicitly marked as # being stream, and try to find and cover all files that are streams" # # We have not done the "extend stream_open.cocci to analyze # alloc_file_pseudo" as well, but the previous commit did manually handle # the case of pipes and sockets. # # The other case where we can avoid locking f_pos is the "this file # descriptor only has a single user and it is us, and thus there is no # need to lock it". # # The second test was correct, although a bit subtle and worth just # re-iterating here. There are two kinds of other sources of references # to the same file descriptor: file descriptors that have been explicitly # shared across fork() or with dup(), and file tables having elevated # reference counts due to threading (or explicit file sharing with # clone()). # # The first case would have incremented the file count explicitly, and in # the second case the previous __fdget() would have incremented it for us # and set the FDPUT_FPUT flag. # # But in both cases the file count would be greater than one, so the # "file_count(file) > 1" test catches both situations. Also note that if # file_count is 1, that also means that no other thread can have access to # the file table, so there also cannot be races with concurrent calls to # dup()/fork()/clone() that would increment the file count any other way. # # Link: https://lore.kernel.org/linux-fsdevel/20190413184404.GA13490@deco.navytux.spb.ru # Cc: Kirill Smelkov # Cc: Eic Dumazet # Cc: Al Viro # Cc: Alan Stern # Cc: Marco Elver # Cc: Andrea Parri # Cc: Paul McKenney # Signed-off-by: Linus Torvalds # < /opt/cross/kisskb/gcc-4.6.3-nolibc/s390x-linux/bin/s390x-linux-gcc --version # < /opt/cross/kisskb/gcc-4.6.3-nolibc/s390x-linux/bin/s390x-linux-ld --version # < git log --format=%s --max-count=1 0be0ee71816b2b6725e2b4f32ad6726c9d729777 # < make -s -j 32 ARCH=s390 O=/kisskb/build/linus_s390-allyesconfig_s390x CROSS_COMPILE=/opt/cross/kisskb/gcc-4.6.3-nolibc/s390x-linux/bin/s390x-linux- allyesconfig # Added to kconfig CONFIG_BUILD_DOCSRC=n # Added to kconfig CONFIG_MODULE_SIG=n # yes \n | make -s -j 32 ARCH=s390 O=/kisskb/build/linus_s390-allyesconfig_s390x CROSS_COMPILE=/opt/cross/kisskb/gcc-4.6.3-nolibc/s390x-linux/bin/s390x-linux- oldconfig yes: standard output: Broken pipe # make -s -j 32 ARCH=s390 O=/kisskb/build/linus_s390-allyesconfig_s390x CROSS_COMPILE=/opt/cross/kisskb/gcc-4.6.3-nolibc/s390x-linux/bin/s390x-linux- /kisskb/src/drivers/android/binderfs.c: In function 'binderfs_fill_super': /kisskb/src/drivers/android/binderfs.c:657:9: warning: missing braces around initializer [-Wmissing-braces] /kisskb/src/drivers/android/binderfs.c:657:9: warning: (near initialization for 'device_info.name') [-Wmissing-braces] /kisskb/src/kernel/events/ring_buffer.c: In function 'perf_output_begin_forward': /kisskb/src/kernel/events/ring_buffer.c:269:1: warning: 'perf_output_begin_forward' uses dynamic stack allocation [enabled by default] /kisskb/src/kernel/events/ring_buffer.c: In function 'perf_output_begin_backward': /kisskb/src/kernel/events/ring_buffer.c:275:1: warning: 'perf_output_begin_backward' uses dynamic stack allocation [enabled by default] /kisskb/src/kernel/events/ring_buffer.c: In function 'perf_output_begin': /kisskb/src/kernel/events/ring_buffer.c:283:1: warning: 'perf_output_begin' uses dynamic stack allocation [enabled by default] /kisskb/src/kernel/events/core.c: In function 'perf_log_throttle': /kisskb/src/kernel/events/core.c:7872:1: warning: 'perf_log_throttle' uses dynamic stack allocation [enabled by default] /kisskb/src/kernel/events/core.c: In function 'perf_swevent_hrtimer': /kisskb/src/kernel/events/core.c:9584:1: warning: 'perf_swevent_hrtimer' uses dynamic stack allocation [enabled by default] /kisskb/src/kernel/events/core.c: In function 'perf_log_itrace_start': /kisskb/src/kernel/events/core.c:8114:1: warning: 'perf_log_itrace_start' uses dynamic stack allocation [enabled by default] /kisskb/src/kernel/events/core.c: In function 'perf_event_read_event': /kisskb/src/kernel/events/core.c:6780:1: warning: 'perf_event_read_event' uses dynamic stack allocation [enabled by default] /kisskb/src/kernel/events/core.c: In function 'perf_event_task_output': /kisskb/src/kernel/events/core.c:7060:1: warning: 'perf_event_task_output' uses dynamic stack allocation [enabled by default] /kisskb/src/kernel/events/core.c: In function 'perf_event_bpf_output': /kisskb/src/kernel/events/core.c:8006:1: warning: 'perf_event_bpf_output' uses dynamic stack allocation [enabled by default] /kisskb/src/kernel/events/core.c: In function 'perf_event_ksymbol_output': /kisskb/src/kernel/events/core.c:7917:1: warning: 'perf_event_ksymbol_output' uses dynamic stack allocation [enabled by default] /kisskb/src/kernel/events/core.c: In function 'perf_event_mmap_output': /kisskb/src/kernel/events/core.c:7418:1: warning: 'perf_event_mmap_output' uses dynamic stack allocation [enabled by default] /kisskb/src/kernel/events/core.c: In function 'perf_event_namespaces_output': /kisskb/src/kernel/events/core.c:7253:1: warning: 'perf_event_namespaces_output' uses dynamic stack allocation [enabled by default] /kisskb/src/kernel/events/core.c: In function 'perf_event_comm_output': /kisskb/src/kernel/events/core.c:7154:1: warning: 'perf_event_comm_output' uses dynamic stack allocation [enabled by default] /kisskb/src/kernel/events/core.c: In function 'perf_event_switch_output': /kisskb/src/kernel/events/core.c:7801:1: warning: 'perf_event_switch_output' uses dynamic stack allocation [enabled by default] /kisskb/src/kernel/events/core.c: In function 'perf_event_aux_event': /kisskb/src/kernel/events/core.c:7709:1: warning: 'perf_event_aux_event' uses dynamic stack allocation [enabled by default] /kisskb/src/kernel/events/core.c: In function 'perf_log_lost_samples': /kisskb/src/kernel/events/core.c:7742:1: warning: 'perf_log_lost_samples' uses dynamic stack allocation [enabled by default] /kisskb/src/kernel/events/core.c: In function 'perf_tp_event': /kisskb/src/kernel/events/core.c:8753:1: warning: 'perf_tp_event' uses dynamic stack allocation [enabled by default] /kisskb/src/kernel/events/core.c: In function '___perf_sw_event': /kisskb/src/kernel/events/core.c:8439:1: warning: '___perf_sw_event' uses dynamic stack allocation [enabled by default] /kisskb/src/ipc/mqueue.c:848:1: internal compiler error: unspellable token PRAGMA Please submit a full bug report, with preprocessed source if appropriate. See for instructions. make[2]: *** [/kisskb/src/scripts/Makefile.build:265: ipc/mqueue.o] Error 1 make[1]: *** [/kisskb/src/Makefile:1652: ipc] Error 2 make[1]: *** Waiting for unfinished jobs.... /kisskb/src/fs/afs/dynroot.c: In function 'afs_lookup_atcell': /kisskb/src/fs/afs/dynroot.c:117:6: warning: 'len' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/ata/ahci_qoriq.c: In function 'ahci_qoriq_hardreset': /kisskb/src/include/asm-generic/io.h:225:15: warning: 'px_is' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/ata/ahci_qoriq.c:88:14: note: 'px_is' was declared here /kisskb/src/include/asm-generic/io.h:225:15: warning: 'px_cmd' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/ata/ahci_qoriq.c:88:6: note: 'px_cmd' was declared here /kisskb/src/mm/hugetlb.c: In function 'alloc_pool_huge_page': /kisskb/src/mm/hugetlb.c:1496:5: warning: 'page' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/arch/s390/kernel/perf_cpum_sf.c: In function 'perf_push_sample': /kisskb/src/arch/s390/kernel/perf_cpum_sf.c:1126:1: warning: 'perf_push_sample' uses dynamic stack allocation [enabled by default] /kisskb/src/arch/s390/kernel/perf_cpum_cf_diag.c: In function 'cf_diag_push_sample': /kisskb/src/arch/s390/kernel/perf_cpum_cf_diag.c:519:1: warning: 'cf_diag_push_sample' uses dynamic stack allocation [enabled by default] /kisskb/src/mm/slub.c: In function 'deactivate_slab.isra.52': /kisskb/src/mm/slub.c:2174:1: warning: 'deactivate_slab.isra.52' uses dynamic stack allocation [enabled by default] /kisskb/src/mm/slub.c: In function 'unfreeze_partials.isra.53': /kisskb/src/mm/slub.c:2242:1: warning: 'unfreeze_partials.isra.53' uses dynamic stack allocation [enabled by default] /kisskb/src/mm/slub.c: In function 'get_partial_node.isra.54': /kisskb/src/mm/slub.c:1879:1: warning: 'get_partial_node.isra.54' uses dynamic stack allocation [enabled by default] /kisskb/src/mm/slub.c: In function '___slab_alloc': /kisskb/src/mm/slub.c:2626:1: warning: '___slab_alloc' uses dynamic stack allocation [enabled by default] /kisskb/src/mm/slub.c: In function '__slab_free': /kisskb/src/mm/slub.c:2939:1: warning: '__slab_free' uses dynamic stack allocation [enabled by default] /kisskb/src/kernel/printk/printk.c: In function 'devkmsg_sysctl_set_loglvl': /kisskb/src/kernel/printk/printk.c:204:16: warning: 'old' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/base/regmap/regmap.c: In function 'regmap_raw_read': /kisskb/src/drivers/base/regmap/regmap.c:2591:6: warning: 'ret' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/base/regmap/regmap.c: In function '_regmap_raw_write': /kisskb/src/drivers/base/regmap/regmap.c:1852:6: warning: 'ret' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/fs/btrfs/ref-verify.c: In function 'process_extent_item.isra.3': /kisskb/src/fs/btrfs/ref-verify.c:492:2: warning: 'ret' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/kernel/sched/core.c: In function 'try_to_wake_up': /kisskb/src/kernel/sched/core.c:2648:12: warning: 'cpu' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/fs/f2fs/file.c: In function 'f2fs_precache_extents': /kisskb/src/fs/f2fs/file.c:3095:6: warning: 'err' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/kernel/smp.c: In function 'smp_call_function_single': /kisskb/src/kernel/smp.c:316:1: warning: 'smp_call_function_single' uses dynamic stack allocation [enabled by default] /kisskb/src/fs/f2fs/node.c: In function '__set_nat_cache_dirty': /kisskb/src/include/linux/list.h:93:12: warning: 'head' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/fs/f2fs/node.c:236:24: note: 'head' was declared here /kisskb/src/drivers/crypto/chelsio/chtls/chtls_cm.c: In function 'wait_for_states.constprop.28': /kisskb/src/drivers/crypto/chelsio/chtls/chtls_cm.c:403:1: warning: 'wait_for_states.constprop.28' uses dynamic stack allocation [enabled by default] /kisskb/src/kernel/rseq.c: In function 'rseq_ip_fixup': /kisskb/src/kernel/rseq.c:249:1: warning: 'rseq_ip_fixup' uses dynamic stack allocation [enabled by default] /kisskb/src/kernel/rseq.c: In function 'rseq_syscall': /kisskb/src/kernel/rseq.c:300:1: warning: 'rseq_syscall' uses dynamic stack allocation [enabled by default] /kisskb/src/drivers/input/joystick/analog.c:160:2: warning: #warning Precise timer not defined for this architecture. [-Wcpp] /kisskb/src/fs/nfs/super.c: In function 'nfs_show_stats': /kisskb/src/fs/nfs/super.c:911:1: warning: 'nfs_show_stats' uses dynamic stack allocation [enabled by default] /kisskb/src/fs/nfsd/nfs4xdr.c: In function 'nfsd4_encode_components_esc': /kisskb/src/fs/nfsd/nfs4xdr.c:2076:9: warning: 'str' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/fs/nfsd/nfs4xdr.c:2081:42: warning: 'end' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/i2c/busses/i2c-sh_mobile.c: In function 'sh_mobile_i2c_isr_rx': /kisskb/src/drivers/i2c/busses/i2c-sh_mobile.c:399:26: warning: 'data' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/fs/proc/inode.c: In function 'proc_reg_open': /kisskb/src/include/linux/list.h:65:12: warning: 'pdeo' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/fs/proc/inode.c:338:21: note: 'pdeo' was declared here /kisskb/src/drivers/infiniband/sw/siw/siw_qp_rx.c: In function 'siw_rqe_get': /kisskb/src/include/linux/spinlock.h:393:2: warning: 'flags' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/infiniband/sw/siw/siw_qp_rx.c:335:16: note: 'flags' was declared here /kisskb/src/fs/ocfs2/alloc.c: In function 'ocfs2_trim_mainbm': /kisskb/src/fs/ocfs2/alloc.c:7608:17: warning: 'first_bit' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/iommu/io-pgtable-arm-v7s.c: In function '__arm_v7s_map.constprop.8': /kisskb/src/drivers/iommu/io-pgtable-arm-v7s.c:482:7: warning: 'cptep' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/fs/quota/quota.c:877:1: internal compiler error: unspellable token PRAGMA Please submit a full bug report, with preprocessed source if appropriate. See for instructions. make[3]: *** [/kisskb/src/scripts/Makefile.build:266: fs/quota/quota.o] Error 1 make[3]: *** Waiting for unfinished jobs.... make[2]: *** [/kisskb/src/scripts/Makefile.build:509: fs/quota] Error 2 make[2]: *** Waiting for unfinished jobs.... make[1]: *** [/kisskb/src/Makefile:1652: fs] Error 2 /kisskb/src/drivers/iio/imu/bmi160/bmi160_core.c: In function 'bmi160_config_pin.constprop.9': /kisskb/src/drivers/iio/imu/bmi160/bmi160_core.c:618:3: warning: 'pin_name' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/iio/imu/bmi160/bmi160_core.c:606:29: warning: 'int_map_mask' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/iio/imu/bmi160/bmi160_core.c:599:29: warning: 'int_latch_mask' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/iio/imu/bmi160/bmi160_core.c:577:47: warning: 'int_out_ctrl_shift' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/gpu/drm/nouveau/nvkm/subdev/bus/hwsq.c: In function 'nvkm_hwsq_wait_vblank': /kisskb/src/drivers/gpu/drm/nouveau/nvkm/subdev/bus/hwsq.c:162:16: warning: 'head_sync' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/gpu/drm/amd/amdgpu/../powerplay/renoir_ppt.c: In function 'renoir_print_clk_levels': /kisskb/src/drivers/gpu/drm/amd/amdgpu/../powerplay/renoir_ppt.c:186:2: warning: missing braces around initializer [-Wmissing-braces] /kisskb/src/drivers/gpu/drm/amd/amdgpu/../powerplay/renoir_ppt.c:186:2: warning: (near initialization for 'metrics.ClockFrequency') [-Wmissing-braces] /kisskb/src/drivers/md/dm-writecache.c: In function 'writecache_writeback': /kisskb/src/drivers/md/dm-writecache.c:1613:18: warning: 'g' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/soc/qcom/rpmh.c: In function 'rpmh_write_batch': /kisskb/src/drivers/soc/qcom/rpmh.c:355:6: warning: 'ret' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/target/iscsi/cxgbit/cxgbit_target.c: In function 'cxgbit_tx_datain_iso.isra.35': /kisskb/src/drivers/target/iscsi/cxgbit/cxgbit_target.c:498:1: warning: 'cxgbit_tx_datain_iso.isra.35' uses dynamic stack allocation [enabled by default] /kisskb/src/drivers/target/iscsi/iscsi_target.c: In function 'iscsit_send_datain': /kisskb/src/drivers/target/iscsi/iscsi_target.c:2873:1: warning: 'iscsit_send_datain' uses dynamic stack allocation [enabled by default] /kisskb/src/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/memx.c: In function 'nvkm_memx_wait_vblank': /kisskb/src/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/memx.c:154:40: warning: 'head_sync' 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:104:1: warning: 'inst' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/gpu/drm/nouveau/nvkm/subdev/top/gk104.c:104:1: warning: 'type' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/net/tun.c: In function 'tun_get_user': /kisskb/src/drivers/net/tun.c:1836:30: warning: 'copylen' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/net/tun.c:1749:46: warning: 'linear' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/net/veth.c: In function 'veth_get_stats64': /kisskb/src/drivers/net/veth.c:361:1: warning: 'veth_get_stats64' uses dynamic stack allocation [enabled by default] /kisskb/src/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c: In function 'mvpp2_setup_bm_pool': /kisskb/src/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c:577:41: warning: overflow in implicit constant conversion [-Woverflow] /kisskb/src/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c: In function 'rvu_mbox_handler_npc_mcam_shift_entry': /kisskb/src/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c:1815:15: warning: 'rc' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/usb/usbip/stub_rx.c: In function 'stub_recv_cmd_submit': /kisskb/src/drivers/usb/usbip/stub_rx.c:573:5: warning: 'ret' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/net/ethernet/neterion/vxge/vxge-config.c: In function 'vxge_hw_device_hw_info_get': /kisskb/src/drivers/net/ethernet/neterion/vxge/vxge-config.c:1089:1: warning: 'vxge_hw_device_hw_info_get' uses dynamic stack allocation [enabled by default] make: *** [Makefile:179: sub-make] Error 2 Command 'make -s -j 32 ARCH=s390 O=/kisskb/build/linus_s390-allyesconfig_s390x CROSS_COMPILE=/opt/cross/kisskb/gcc-4.6.3-nolibc/s390x-linux/bin/s390x-linux- ' returned non-zero exit status 2 # rm -rf /kisskb/build/linus_s390-allyesconfig_s390x # Build took: 0:08:11.712241