On Mon, Nov 11, 2019 at 10:44 AM Eric Dumazet <edumazet@xxxxxxxxxx> wrote: > > An interesting case is the race in ksys_write() Not really. > if (ppos) { > pos = *ppos; // data-race That code uses "fdget_pos(). Which does mutual exclusion _if_ the file is something we care about pos for, and if it has more than one process using it. Basically the rule there is that we don't care about the data race in certain circumstances. We don't care about non-regular files, for example, because those are what POSIX gives guarantees for. (We have since moved towards FMODE_STREAM handling instead of the older FMODE_ATOMIC_POS which does this better, and it's possible we should get rid of the FMODE_ATOMIC_POS behavior in favor of FMODE_STREAM entirely) Again, that's pretty hard to tell something like KCSAN. Of course, it's then questionable whether our rules for not caring are necessarily the _right_ rules for not caring. For example, if you have threads, the "more than one process opening it" doesn't trigger. It's literally just atomicity across processes that we guarantee. That's certainly a bit questionable. But that's a higher-level decision. Linus