Re: [PATCH RESEND] kernel/relay.c: fix read_pos error when multiple readers

From: Andrew Morton
Date: Thu Jan 23 2020 - 20:23:24 EST


On Wed, 22 Jan 2020 19:06:15 +0800 Pengcheng Yang <yangpc@xxxxxxxxxx> wrote:

> When reading, read_pos should start with bytes_consumed,
> not file->f_pos. Because when there is more than one reader,
> the read_pos corresponding to file->f_pos may have been consumed,
> which will cause the data that has been consumed to be read
> and the bytes_consumed update error.

That sounds fairly serious. Are you able to describe a userspace setup
which will trigger this? Do you have any test code which is able to
demonstrate the bug?

We really should have a relay testcase in tools/testing, but relay came
along before we became diligent about this.