Linux Hardening
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Kees Cook <keescook@chromium.org>
Cc: Rasmus Villemoes <rasmus.villemoes@prevas.dk>,
	Marco Elver <elver@google.com>,
	Eric Biggers <ebiggers@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>,
	linux-hardening@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 3/3] overflow: Introduce wrapping_inc() and wrapping_dec()
Date: Wed, 7 Feb 2024 18:34:07 +0200	[thread overview]
Message-ID: <ZcOw_5-1ghxJrqfg@smile.fi.intel.com> (raw)
In-Reply-To: <202402070806.445F7F7F03@keescook>

On Wed, Feb 07, 2024 at 08:08:14AM -0800, Kees Cook wrote:
> On Wed, Feb 07, 2024 at 05:31:54PM +0200, Andy Shevchenko wrote:
> > On Wed, Feb 7, 2024 at 5:24 PM Kees Cook <keescook@chromium.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()
> 
> I think maybe the missing phrase is "assign", which is what makes
> argument 1 "special" -- it's being changed. Perhaps:
> 
> wrapping_add_assign()
> wrapping_sub_assign()
> 
> ?

WFM!

-- 
With Best Regards,
Andy Shevchenko



      reply	other threads:[~2024-02-07 16:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-07 15:24 [PATCH v5 0/3] overflow: Introduce wrapping helpers Kees Cook
2024-02-07 15:24 ` [PATCH v5 1/3] overflow: Adjust check_*_overflow() kern-doc to reflect results Kees Cook
2024-02-07 15:24 ` [PATCH v5 2/3] overflow: Introduce wrapping_add(), wrapping_sub(), and wrapping_mul() Kees Cook
2024-02-07 18:06   ` Marco Elver
2024-02-07 15:24 ` [PATCH v5 3/3] overflow: Introduce wrapping_inc() and wrapping_dec() Kees Cook
2024-02-07 15:31   ` Andy Shevchenko
2024-02-07 16:08     ` Kees Cook
2024-02-07 16:34       ` Andy Shevchenko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZcOw_5-1ghxJrqfg@smile.fi.intel.com \
    --to=andy.shevchenko@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=ebiggers@kernel.org \
    --cc=elver@google.com \
    --cc=gustavoars@kernel.org \
    --cc=keescook@chromium.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=rasmus.villemoes@prevas.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox