linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 4.19 01/37] cgroup-v1: cgroup_pidlist_next should update position index
@ 2020-03-18 20:54 Sasha Levin
  2020-03-18 20:54 ` [PATCH AUTOSEL 4.19 02/37] cgroup: Iterate tasks that did not finish do_exit() Sasha Levin
                   ` (35 more replies)
  0 siblings, 36 replies; 37+ messages in thread
From: Sasha Levin @ 2020-03-18 20:54 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Vasily Averin, Tejun Heo, Sasha Levin, cgroups

From: Vasily Averin <vvs@virtuozzo.com>

[ Upstream commit db8dd9697238be70a6b4f9d0284cd89f59c0e070 ]

if seq_file .next fuction does not change position index,
read after some lseek can generate unexpected output.

 # mount | grep cgroup
 # dd if=/mnt/cgroup.procs bs=1  # normal output
...
1294
1295
1296
1304
1382
584+0 records in
584+0 records out
584 bytes copied

dd: /mnt/cgroup.procs: cannot skip to specified offset
83  <<< generates end of last line
1383  <<< ... and whole last line once again
0+1 records in
0+1 records out
8 bytes copied

dd: /mnt/cgroup.procs: cannot skip to specified offset
1386  <<< generates last line anyway
0+1 records in
0+1 records out
5 bytes copied

https://bugzilla.kernel.org/show_bug.cgi?id=206283
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 kernel/cgroup/cgroup-v1.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c
index 51063e7a93c28..c9628b9a41d23 100644
--- a/kernel/cgroup/cgroup-v1.c
+++ b/kernel/cgroup/cgroup-v1.c
@@ -501,6 +501,7 @@ static void *cgroup_pidlist_next(struct seq_file *s, void *v, loff_t *pos)
 	 */
 	p++;
 	if (p >= end) {
+		(*pos)++;
 		return NULL;
 	} else {
 		*pos = *p;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2020-03-18 21:04 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-18 20:54 [PATCH AUTOSEL 4.19 01/37] cgroup-v1: cgroup_pidlist_next should update position index Sasha Levin
2020-03-18 20:54 ` [PATCH AUTOSEL 4.19 02/37] cgroup: Iterate tasks that did not finish do_exit() Sasha Levin
2020-03-18 20:54 ` [PATCH AUTOSEL 4.19 03/37] batman-adv: Don't schedule OGM for disabled interface Sasha Levin
2020-03-18 20:54 ` [PATCH AUTOSEL 4.19 04/37] pinctrl: meson-gxl: fix GPIOX sdio pins Sasha Levin
2020-03-18 20:54 ` [PATCH AUTOSEL 4.19 05/37] nfs: add minor version to nfs_server_key for fscache Sasha Levin
2020-03-18 20:54 ` [PATCH AUTOSEL 4.19 06/37] pinctrl: core: Remove extra kref_get which blocks hogs being freed Sasha Levin
2020-03-18 20:54 ` [PATCH AUTOSEL 4.19 07/37] r8152: check disconnect status after long sleep Sasha Levin
2020-03-18 20:54 ` [PATCH AUTOSEL 4.19 08/37] bnxt_en: reinitialize IRQs when MTU is modified Sasha Levin
2020-03-18 20:54 ` [PATCH AUTOSEL 4.19 09/37] cpupower: avoid multiple definition with gcc -fno-common Sasha Levin
2020-03-18 20:54 ` [PATCH AUTOSEL 4.19 10/37] fib: add missing attribute validation for tun_id Sasha Levin
2020-03-18 20:54 ` [PATCH AUTOSEL 4.19 11/37] can: add missing attribute validation for termination Sasha Levin
2020-03-18 20:54 ` [PATCH AUTOSEL 4.19 12/37] macsec: add missing attribute validation for port Sasha Levin
2020-03-18 20:54 ` [PATCH AUTOSEL 4.19 13/37] team: add missing attribute validation for port ifindex Sasha Levin
2020-03-18 20:54 ` [PATCH AUTOSEL 4.19 14/37] team: add missing attribute validation for array index Sasha Levin
2020-03-18 20:54 ` [PATCH AUTOSEL 4.19 15/37] netfilter: cthelper: add missing attribute validation for cthelper Sasha Levin
2020-03-18 20:54 ` [PATCH AUTOSEL 4.19 16/37] netfilter: nft_payload: add missing attribute validation for payload csum flags Sasha Levin
2020-03-18 20:54 ` [PATCH AUTOSEL 4.19 17/37] netfilter: nft_tunnel: add missing attribute validation for tunnels Sasha Levin
2020-03-18 20:54 ` [PATCH AUTOSEL 4.19 18/37] drivers/of/of_mdio.c:fix of_mdiobus_register() Sasha Levin
2020-03-18 20:54 ` [PATCH AUTOSEL 4.19 19/37] cgroup1: don't call release_agent when it is "" Sasha Levin
2020-03-18 20:54 ` [PATCH AUTOSEL 4.19 20/37] dt-bindings: net: FMan erratum A050385 Sasha Levin
2020-03-18 20:54 ` [PATCH AUTOSEL 4.19 21/37] arm64: dts: ls1043a: " Sasha Levin
2020-03-18 20:54 ` [PATCH AUTOSEL 4.19 22/37] fsl/fman: detect " Sasha Levin
2020-03-18 20:54 ` [PATCH AUTOSEL 4.19 23/37] virtio-blk: fix hw_queue stopped on arbitrary error Sasha Levin
2020-03-18 20:54 ` [PATCH AUTOSEL 4.19 24/37] ipvlan: do not add hardware address of master to its unicast filter list Sasha Levin
2020-03-18 20:54 ` [PATCH AUTOSEL 4.19 25/37] net: stmmac: dwmac1000: Disable ACS if enhanced descs are not used Sasha Levin
2020-03-18 20:54 ` [PATCH AUTOSEL 4.19 26/37] ipvlan: don't deref eth hdr before checking it's set Sasha Levin
2020-03-18 20:54 ` [PATCH AUTOSEL 4.19 27/37] ipvlan: add cond_resched_rcu() while processing muticast backlog Sasha Levin
2020-03-18 20:55 ` [PATCH AUTOSEL 4.19 28/37] ipvlan: do not use cond_resched_rcu() in ipvlan_process_multicast() Sasha Levin
2020-03-18 20:55 ` [PATCH AUTOSEL 4.19 29/37] i2c: gpio: suppress error on probe defer Sasha Levin
2020-03-18 20:55 ` [PATCH AUTOSEL 4.19 30/37] s390/qeth: handle error when backing RX buffer Sasha Levin
2020-03-18 20:55 ` [PATCH AUTOSEL 4.19 31/37] scsi: ipr: Fix softlockup when rescanning devices in petitboot Sasha Levin
2020-03-18 20:55 ` [PATCH AUTOSEL 4.19 32/37] mac80211: Do not send mesh HWMP PREQ if HWMP is disabled Sasha Levin
2020-03-18 20:55 ` [PATCH AUTOSEL 4.19 33/37] dpaa_eth: Remove unnecessary boolean expression in dpaa_get_headroom Sasha Levin
2020-03-18 20:55 ` [PATCH AUTOSEL 4.19 34/37] sxgbe: Fix off by one in samsung driver strncpy size arg Sasha Levin
2020-03-18 20:55 ` [PATCH AUTOSEL 4.19 35/37] net: systemport: fix index check to avoid an array out of bounds access Sasha Levin
2020-03-18 20:55 ` [PATCH AUTOSEL 4.19 36/37] iommu/vt-d: quirk_ioat_snb_local_iommu: replace WARN_TAINT with pr_warn + add_taint Sasha Levin
2020-03-18 20:55 ` [PATCH AUTOSEL 4.19 37/37] iommu/vt-d: Fix the wrong printing in RHSA parsing Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).