diff options
author | Vasily Averin <vvs@virtuozzo.com> | 2020-01-30 11:34:59 +0100 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2020-02-12 23:00:04 +0100 |
commit | 2d4ecb030dcc90fb725ecbfc82ce5d6c37906e0e (patch) | |
tree | 78d94260f636857be905bd106b85fb353ba7d23e /include | |
parent | cgroup-v1: cgroup_pidlist_next should update position index (diff) | |
download | linux-2d4ecb030dcc90fb725ecbfc82ce5d6c37906e0e.tar.xz linux-2d4ecb030dcc90fb725ecbfc82ce5d6c37906e0e.zip |
cgroup: cgroup_procs_next should increase position index
If seq_file .next fuction does not change position index,
read after some lseek can generate unexpected output:
1) dd bs=1 skip output of each 2nd elements
$ dd if=/sys/fs/cgroup/cgroup.procs bs=8 count=1
2
3
4
5
1+0 records in
1+0 records out
8 bytes copied, 0,000267297 s, 29,9 kB/s
[test@localhost ~]$ dd if=/sys/fs/cgroup/cgroup.procs bs=1 count=8
2
4 <<< NB! 3 was skipped
6 <<< ... and 5 too
8 <<< ... and 7
8+0 records in
8+0 records out
8 bytes copied, 5,2123e-05 s, 153 kB/s
This happen because __cgroup_procs_start() makes an extra
extra cgroup_procs_next() call
2) read after lseek beyond end of file generates whole last line.
3) read after lseek into middle of last line generates
expected rest of last line and unexpected whole line once again.
Additionally patch removes an extra position index changes in
__cgroup_procs_start()
Cc: stable@vger.kernel.org
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>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions