All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Collingbourne <pcc@google.com>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: Andrey Konovalov <andreyknvl@gmail.com>,
	Alexander Potapenko <glider@google.com>,
	 Vincenzo Frascino <vincenzo.frascino@arm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	 Evgenii Stepanov <eugenis@google.com>,
	Linux Memory Management List <linux-mm@kvack.org>,
	 Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v2 1/3] kasan: use separate (un)poison implementation for integrated init
Date: Wed, 12 May 2021 13:08:23 -0700	[thread overview]
Message-ID: <CAMn1gO7LJ0-rgwxg+jVy8EsZeTwG96sc9-kNNP8+rsJS3ibGOg@mail.gmail.com> (raw)
In-Reply-To: <20210512121035.GD14638@arm.com>

On Wed, May 12, 2021 at 5:10 AM Catalin Marinas <catalin.marinas@arm.com> wrote:
>
> On Tue, May 11, 2021 at 04:54:24PM -0700, Peter Collingbourne wrote:
> > diff --git a/include/linux/kasan.h b/include/linux/kasan.h
> > index b1678a61e6a7..e35fa301d3db 100644
> > --- a/include/linux/kasan.h
> > +++ b/include/linux/kasan.h
> [...]
> > @@ -113,8 +113,30 @@ static inline bool kasan_has_integrated_init(void)
> >       return false;
> >  }
> >
> > +static __always_inline void kasan_alloc_pages(struct page *page,
> > +                                           unsigned int order, gfp_t flags)
> > +{
> > +     /* Only available for integrated init. */
> > +     BUG();
> > +}
> > +
> > +static __always_inline void kasan_free_pages(struct page *page,
> > +                                          unsigned int order)
> > +{
> > +     /* Only available for integrated init. */
> > +     BUG();
> > +}
>
> Would these two work as BUILD_BUG()?

It looks like it. This creates a dependency on the compiler being
powerful enough to optimize away "if (0) undefined_function();" after
inlining, which I'm not really a big fan of, but it looks like we're
already doing similar things elsewhere in the kernel, so we might as
well do it here as well.

Peter


WARNING: multiple messages have this Message-ID (diff)
From: Peter Collingbourne <pcc@google.com>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: Andrey Konovalov <andreyknvl@gmail.com>,
	Alexander Potapenko <glider@google.com>,
	 Vincenzo Frascino <vincenzo.frascino@arm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	 Evgenii Stepanov <eugenis@google.com>,
	Linux Memory Management List <linux-mm@kvack.org>,
	 Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v2 1/3] kasan: use separate (un)poison implementation for integrated init
Date: Wed, 12 May 2021 13:08:23 -0700	[thread overview]
Message-ID: <CAMn1gO7LJ0-rgwxg+jVy8EsZeTwG96sc9-kNNP8+rsJS3ibGOg@mail.gmail.com> (raw)
In-Reply-To: <20210512121035.GD14638@arm.com>

On Wed, May 12, 2021 at 5:10 AM Catalin Marinas <catalin.marinas@arm.com> wrote:
>
> On Tue, May 11, 2021 at 04:54:24PM -0700, Peter Collingbourne wrote:
> > diff --git a/include/linux/kasan.h b/include/linux/kasan.h
> > index b1678a61e6a7..e35fa301d3db 100644
> > --- a/include/linux/kasan.h
> > +++ b/include/linux/kasan.h
> [...]
> > @@ -113,8 +113,30 @@ static inline bool kasan_has_integrated_init(void)
> >       return false;
> >  }
> >
> > +static __always_inline void kasan_alloc_pages(struct page *page,
> > +                                           unsigned int order, gfp_t flags)
> > +{
> > +     /* Only available for integrated init. */
> > +     BUG();
> > +}
> > +
> > +static __always_inline void kasan_free_pages(struct page *page,
> > +                                          unsigned int order)
> > +{
> > +     /* Only available for integrated init. */
> > +     BUG();
> > +}
>
> Would these two work as BUILD_BUG()?

It looks like it. This creates a dependency on the compiler being
powerful enough to optimize away "if (0) undefined_function();" after
inlining, which I'm not really a big fan of, but it looks like we're
already doing similar things elsewhere in the kernel, so we might as
well do it here as well.

Peter

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-05-12 20:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-11 23:54 [PATCH v2 0/3] arm64: improve efficiency of setting tags for user pages Peter Collingbourne
2021-05-11 23:54 ` Peter Collingbourne
2021-05-11 23:54 ` [PATCH v2 1/3] kasan: use separate (un)poison implementation for integrated init Peter Collingbourne
2021-05-11 23:54   ` Peter Collingbourne
2021-05-12 12:10   ` Catalin Marinas
2021-05-12 12:10     ` Catalin Marinas
2021-05-12 20:08     ` Peter Collingbourne [this message]
2021-05-12 20:08       ` Peter Collingbourne
2021-05-11 23:54 ` [PATCH v2 2/3] arm64: mte: handle tags zeroing at page allocation time Peter Collingbourne
2021-05-11 23:54   ` Peter Collingbourne
2021-05-12 12:12   ` Catalin Marinas
2021-05-12 12:12     ` Catalin Marinas
2021-05-11 23:54 ` [PATCH v2 3/3] kasan: allow freed user page poisoning to be disabled with HW tags Peter Collingbourne
2021-05-11 23:54   ` Peter Collingbourne

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=CAMn1gO7LJ0-rgwxg+jVy8EsZeTwG96sc9-kNNP8+rsJS3ibGOg@mail.gmail.com \
    --to=pcc@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=andreyknvl@gmail.com \
    --cc=catalin.marinas@arm.com \
    --cc=eugenis@google.com \
    --cc=glider@google.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mm@kvack.org \
    --cc=vincenzo.frascino@arm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.