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: <20240509184806.GS2118490@ZenIV>
Date: Thu, 9 May 2024 19:48:06 +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 11:39:04AM -0700, Linus Torvalds wrote:

> .. it might also actually be a good idea *IF* we were to have some
> kind of "implicit cast drops bits" warning, in that the compiler for
> that case wouldn't remove the upper bits calculation, but would
> trigger a warning if they are non-zero.
> 
> So there are actually potential advantages to just always apparently
> doing the full 64-bit arithmetic.
> 
> Without debug warnings, it's a no-op that the compiler will just skip.
> And with some hypothetical debug flag, it would be a "you are now
> losing the high bits of the time value when assigning the result to a
> limited 32-bit time_t" warning.

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);
would be very hard to catch on RTFS, especially when you'd been
staring at that code for a long time.  Explicitly spelled out
it would be obvious which goes into bits 0..31 and which in 32..64.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ