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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250722225340.1b0b29fe@pumpkin>
Date: Tue, 22 Jul 2025 22:53:40 +0100
From: David Laight <david.laight.linux@...il.com>
To: "H. Peter Anvin" <hpa@...or.com>
Cc: Oleg Nesterov <oleg@...hat.com>, Ingo Molnar <mingo@...hat.com>, Peter
 Zijlstra <peterz@...radead.org>, Thomas Gleixner <tglx@...utronix.de>,
 Borislav Petkov <bp@...en8.de>, Dave Hansen <dave.hansen@...ux.intel.com>,
 "Li,Rongqing" <lirongqing@...du.com>, Steven Rostedt <rostedt@...dmis.org>,
 linux-kernel@...r.kernel.org, x86@...nel.org
Subject: Re: [PATCH] x86/math64: handle #DE in mul_u64_u64_div_u64()

On Tue, 22 Jul 2025 09:53:21 -0700
"H. Peter Anvin" <hpa@...or.com> wrote:

...
> 
> Note that -1 for division by zero (not necessarily for overflow) follows from
> most natural division algorithms, and so architectures which don't trap
> on division overflow tend to behave that way.

Do you think that just returning ~0 is enough (maybe with a WARN_ONCE) ?
Code can check for it and the number of false positives would be minimal.

I have wondered about having muldiv(a, b, c, d, errval) that returns 'errval'
if '(a * b + c)/ d' overflows or if 'd' is zero.
Otherwise you are trying to return too many values from a function
(esp. on 32bit).
'asm goto' or 'flags' will only work for x86_64, starts being a real mess
for the generic code.
(Time for a language feature that lets the caller see modifications to
a parameter that is passed by value...)

	David

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ