lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 2 May 2024 16:14:23 +0200
From: Marco Elver <elver@...gle.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: paulmck@...nel.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 23:06, Linus Torvalds
<torvalds@...ux-foundation.org> wrote:
> On Wed, 1 May 2024 at 13:15, Marco Elver <elver@...gle.com> wrote:
> >
> > This is relatively trivial:
> >
> > #ifdef __SANITIZE_THREAD__
> > #define __data_racy volatile
> > #endif
>
> I really wouldn't want to make a code generation difference, but I
> guess when the sanitizer is on, the compiler generating crap code
> isn't a huge deal.
>
> > In some cases it might cause the compiler to complain if converting a
> > volatile pointer to a non-volatile pointer
>
> No. Note that it's not the *pointer* that is volatile, it's the
> structure member.
>
> So it would be something like
>
>         const struct file_operations    * __data_racy f_op;
>
> and only the load of f_op would be volatile - not the pointer itself.
>
> Of course, if somebody then does "&file->f_op" to get a pointer to a
> pointer, *that* would now be a volatile pointer, but I don't see
> people doing that.

This is the case I thought of. I still think everything is working as
intended then, since passing a pointer to a __data_racy variable
should be done with pointers to __data_racy (just like other type
qualifiers - the rules are by virtue of implementation equivalent to
volatile). Not a problem, just an observation.

> So I guess this might be a way forward. Anybody want to verify?

I sent a patch to add the type qualifier - in a simple test I added it
does what we want:
https://lore.kernel.org/all/20240502141242.2765090-1-elver@google.com/T/#u

I'll leave it to Tetsuo to amend the original patch if __data_racy makes sense.

Thanks,
-- Marco

> Now, the "hung_up_tty_fops" *do* need to be expanded to have hung up
> ops for every op that is non-NULL in the normal tty ops. That was a
> real bug. We'd also want to add a big comment to the tty fops to make
> sure anybody who adds a new tty f_op member to make sure to populate
> the hung up version too.
>
>                 Linus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ