Re: KCSAN: data-race in __alloc_file / __alloc_file

From: Kirill Smelkov
Date: Sun Nov 17 2019 - 14:13:10 EST


On Tue, Nov 12, 2019 at 09:36:41AM -0800, Linus Torvalds wrote:
> On Tue, Nov 12, 2019 at 9:23 AM Linus Torvalds
> <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
> >
> > Hmm. I thought we already then applied all the patches that marked
> > things that didn't use f_pos as FMODE_STREAM. Including pipes and
> > sockets etc.
> >
> > But if we didn't - and no, I didn't double-check now either - then
> > obviously that part of the patch can't be applied now.
>
> Ok, looking at it now.
>
> Yeah, commit c5bf68fe0c86 ("*: convert stream-like files from
> nonseekable_open -> stream_open") did the scripted thing, but it only
> did it for nonseekable_open, not for the more complicated cases.
>
> So yup, you're right - we'd need to at least do the pipe/socket case too.
>
> What happens if the actual conversion part (nonseekable_open ->
> stream_open) is removed from the cocci script, and it's used to only
> find "read/write doesn't use f_pos" cases?
>
> Or maybe trigger on '.llseek = no_llseek'?

( just a quick update that I'm still pending on this. I've tried to
quickly check the above this evening but offhand it does not give good
results until stream_open.cocci is extended to understand
read_iter/writer_iter and properly worked some more on it.
Or maybe I'm just too sleepy...

I'd like to take a time break for now.
I will try to return to this topic after finishing my main work first.
I apologize for the inconvenience. )