[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75Vf3emnw-=it-Smb_NG+xYjWhB+U0+i1hcNPWA=BByN6nw@mail.gmail.com>
Date: Wed, 7 Feb 2024 17:31:54 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Kees Cook <keescook@...omium.org>
Cc: Andy Shevchenko <andy@...nel.org>, Rasmus Villemoes <rasmus.villemoes@...vas.dk>,
Marco Elver <elver@...gle.com>, Eric Biggers <ebiggers@...nel.org>,
Mark Rutland <mark.rutland@....com>, "Gustavo A. R. Silva" <gustavoars@...nel.org>,
linux-hardening@...r.kernel.org, Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 3/3] overflow: Introduce wrapping_inc() and wrapping_dec()
On Wed, Feb 7, 2024 at 5:24 PM Kees Cook <keescook@...omium.org> wrote:
>
> This allows replacements of the idioms "var += offset" and "var -= offset"
> with the wrapping_inc() and wrapping_dec() helpers respectively. They
> will avoid wrap-around sanitizer instrumentation.
>
> Add to the selftests to validate behavior and lack of side-effects.
I would expect inc/dec to add/subtract 1. So, to me the terminology is
confusing. The list of the C/C++ operators on Wikipedia describes
above as
+= Assignment by sum
-= Assignment by difference
Hence the proposal is to have
wrapping_sum()
wrapping_diff()
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists