Re: [PATCH bpf-next] bpf: fix pos computation for bpf_iter seq_ops->start()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 22, 2020 at 12:52 PM Yonghong Song <yhs@xxxxxx> wrote:
>
> Currently, the pos pointer in bpf iterator map/task/task_file
> seq_ops->start() is always incremented.
> This is incorrect. It should be increased only if
> *pos is 0 (for SEQ_START_TOKEN) since these start()
> function actually returns the first real object.
> If *pos is not 0, it merely found the object
> based on the state in seq->private, and not really
> advancing the *pos. This patch fixed this issue
> by only incrementing *pos if it is 0.
>
> Note that the old *pos calculation, although not
> correct, does not affect correctness of bpf_iter
> as bpf_iter seq_file->read() does not support llseek.
>
> This patch also renamed "mid" in bpf_map iterator
> seq_file private data to "map_id" for better clarity.
>
> Fixes: 6086d29def80 ("bpf: Add bpf_map iterator")
> Fixes: eaaacd23910f ("bpf: Add task and task/file iterator targets")
> Signed-off-by: Yonghong Song <yhs@xxxxxx>

Applied. Thanks



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux