In Aug 2018 NeilBrown submitted to mainline commit 1f4aace60b0e ("fs/seq_file.c: simplify seq_file iteration code and interface") with following comment >"Some ->next functions do not increment *pos when they return NULL... >Note that such ->next functions are buggy and should be fixed. >A simple demonstration is >dd if=/proc/swaps bs=1000 skip=1 >Choose any block size larger than the size of /proc/swaps. This will >always show the whole last line of /proc/swaps" Described problem is still actual. If you make lseek into middle of last output line following read will output end of last line and whole last line once again. >$ dd if=/proc/swaps bs=1 # usual output >Filename Type Size Used >Priority >/dev/dm-0 partition 4194812 97536 -2 >104+0 records in >104+0 records out >104 bytes copied > >$ dd if=/proc/swaps bs=40 skip=1 # last line was generated twice >dd: /proc/swaps: cannot skip to specified offset >v/dm-0 partition 4194812 97536 -2 >/dev/dm-0 partition 4194812 97536 -2 >3+1 records in >3+1 records out >131 bytes copied There are lot of other affected files, I've found 30+ including /proc/net/ip_tables_matches and /proc/sysvipc/* I prepared patches and submitted this bug to simplify their processing.
submitted to netdev@vger.kernel.org seq_tab_next() should increase position index l2t_seq_next should increase position index vcc_seq_next should increase position index neigh_stat_seq_next() should increase position index rt_cpu_seq_next should increase position index ipv6_route_seq_next should increase position index
sent to netfilter-devel@vger.kernel.org ct_cpu_seq_next should increase position index synproxy_cpu_seq_next should increase position index recent_seq_next should increase position index xt_mttg_seq_next should increase position index
sent to ocfs2-devel@oss.oracle.com lockres_seq_next should increase position index ocfs2_dlm_seq_next should increase position index nst_seq_next should increase position index sc_seq_next should increase position index
sent to linux-integrity@vger.kernel.org tpm1_bios_measurements_next should increase position index tpm2_bios_measurements_next() should increase position index
sent to linux-ext4@vger.kernel.org jbd2_seq_info_next should increase position index
sent to qat-linux@intel.com adf_ring_next should increase position index
linux-s390@vger.kernel.org cio_ignore_proc_seq_next should increase position index
sent to linux-scsi@vger.kernel.org snic_trc_seq_next should increase position index
sent to cluster-devel@redhat.com table_seq_next should increase position index
sent to devel@lists.orangefs.org help_next should increase position index
sent to bpf@vger.kernel.org map_seq_next should increase position index
sent to linux-security-module@vger.kernel.org proc_keys_next should increase position index
sent to selinux@vger.kernel.org sel_avc_get_stat_idx should increase position index
sent to linux-mm@kvack.org swap_next should increase position index
sent directly to lkml@ pstore_ftrace_seq_next should increase position index gcov_seq_next should increase position index t_next should increase position index fpid_next should increase position index eval_map_next should increase position index trigger_next should increase position index sysvipc_find_ipc should increase position index
sent to lkml@ -- it helps to detect buggy .next function in missed cases and in out-of-tree modules [PATCH] seq_read: info message about buggy .next functions
last known affected function: cgroup_procs_next
sent to cgroups@ cgroup_pidlist_next should update position index cgroup_procs_next should increase position index
I see > buggy seq_file .next function c_next did not updated position index on an Alpha running v5.7.0. How can I determine what function is at fault?
(In reply to Matt Turner from comment #19) > I see > > > buggy seq_file .next function c_next did not updated position index > > on an Alpha running v5.7.0. How can I determine what function is at fault? It's about arch/alpha/kernel/setup.c::c_next()
Thanks. I've sent [PATCH] alpha: c_next should increase position index to linux-alpha@