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]
Message-ID: <20240509192854.GT2118490@ZenIV>
Date: Thu, 9 May 2024 20:28:54 +0100
From: Al Viro <viro@...iv.linux.org.uk>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Theodore Ts'o <tytso@....edu>, Kees Cook <keescook@...omium.org>,
	Justin Stitt <justinstitt@...gle.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Mark Rutland <mark.rutland@....com>,
	linux-hardening@...r.kernel.org, linux-kernel@...r.kernel.org,
	llvm@...ts.linux.dev
Subject: Re: [RFC] Mitigating unexpected arithmetic overflow

On Thu, May 09, 2024 at 12:15:40PM -0700, Linus Torvalds wrote:
> On Thu, 9 May 2024 at 11:48, Al Viro <viro@...iv.linux.org.uk> wrote:
> >
> > FWIW, the thing that somewhat worries me about having a helper along
> > the lines of combine_to_u64(low, high) is that
> >         foo->splat = combine_to_u64(something, something_else);
> > would be inviting hard-to-catch brainos -
> >         foo->splat = combine_to_u64(something_else, something);
> 
> Yeah, we'd have to be very clear about naming and ordering. So it
> would probably have to be something like
> 
>         result = combine_to_u64_hi_lo(high, low);
> 
> to be easy to use.
> 
> The good news is that if you *do* get it wrong despite clear naming,
> the resulting value will be so obviously wrong that it's generally a
> "Duh!" thing if you do any testing what-so-ever.
> 
> Of course, I say that as somebody who always points out that I haven't
> tested my own patches at all, and they are "something like this,
> perhaps?".
> 
> But having "hi_lo" kind of naming would hopefully make it really
> obvious even when just looking at the source code.

Or something like
	result = to_high32(high) | to_low32(low);
perhaps? ;-)

Re amusing things found by grepping:
		unsafe_get_user(lo, &__c->sig[1], label);               \
		unsafe_get_user(hi, &__c->sig[0], label);               \
		__s->sig[0] = hi | (((long)lo) << 32);                  \
(compat.h, be64 unsafe_get_compat_sigset())

It is correct, actually, but here 'hi' is 'signals in range 0..31' and
'lo' - 'signals in range 32..63'.  Introduced in fb05121fd6a2
"signal: Add unsafe_get_compat_sigset()", looks like nobody had read
it carefully enough for a WTF moment - at least no replies along the
lines of 'might be a good idea to use less confusing names' anywhere
on lore...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ