[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANpmjNOY=Qpm3hBu-eN4Xk8n-2VXQRvcQ3_PfwPwNw9MmC8ctw@mail.gmail.com>
Date: Wed, 1 May 2024 22:14:51 +0200
From: Marco Elver <elver@...gle.com>
To: paulmck@...nel.org
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>, Dmitry Vyukov <dvyukov@...gle.com>,
syzbot <syzbot+b7c3ba8cdc2f6cf83c21@...kaller.appspotmail.com>,
linux-kernel@...r.kernel.org, syzkaller-bugs@...glegroups.com,
Nathan Chancellor <nathan@...nel.org>, Arnd Bergmann <arnd@...nel.org>, Al Viro <viro@...iv.linux.org.uk>,
Jiri Slaby <jirislaby@...nel.org>
Subject: Re: [PATCH v3] tty: tty_io: remove hung_up_tty_fops
On Wed, 1 May 2024 at 21:02, Paul E. McKenney <paulmck@...nel.org> wrote:
>
> On Wed, May 01, 2024 at 11:56:26AM -0700, Linus Torvalds wrote:
> > On Wed, 1 May 2024 at 11:46, Paul E. McKenney <paulmck@...nel.org> wrote:
> > >
> > > In short, I for one do greatly value KCSAN's help. Along with that of
> > > a great many other tools, none of which are perfect, but all of which
> > > are helpful.
> >
> > It's not that I don't value what KCSAN does, but I really think this
> > is a KCSAN issue.
> >
> > I absolutely *detest* these crazy "randomly add data race annotations".
> >
> > Could we instead annotate particular structure fields? I don't want to
> > mark things actually "volatile", because that then causes the compiler
> > to generate absolutely horrendous code. But some KCSAN equivalent of
> > "this field has data races, and we don't care" kind of annotation
> > would be lovely..
>
> That would give the poor sleep-deprived innocent bystander some way
> to figure out which fields were shared, so that does sound like a good
> improvement!
>
> I would naively expect that KCSAN's ability to handle volatile fields
> would make this doable, but there is much that I do not know about
> KCSAN internals. So I must defer to Marco on this one.
This is relatively trivial:
#ifdef __SANITIZE_THREAD__
#define __data_racy volatile
#endif
KCSAN will just ignore racy access to them (it will pretend they are "marked").
In some cases it might cause the compiler to complain if converting a
volatile pointer to a non-volatile pointer, but I suspect that the
corresponding pointer should then similarly be marked as __data_racy.
The fact that without casting the attribute is "viral" is probably WAI
even in this case.
Do we want this kind of attribute?
Thanks,
-- Marco
Powered by blists - more mailing lists