From: Marco Elver <elver@google.com>
To: Sven Schnelle <svens@linux.ibm.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
kasan-dev <kasan-dev@googlegroups.com>,
Alexander Potapenko <glider@google.com>
Subject: Re: [PATCH 1/2] kfence: add function to mask address bits
Date: Fri, 14 May 2021 13:23:33 +0200 [thread overview]
Message-ID: <CANpmjNPAS5kDsADb-DwvdFR9nRnX47-mFuEG2vmMPn5U3i3sGQ@mail.gmail.com> (raw)
In-Reply-To: <yt9dfsypinlk.fsf@linux.ibm.com>
On Fri, 14 May 2021 at 13:03, Sven Schnelle <svens@linux.ibm.com> wrote:
>
> Marco Elver <elver@google.com> writes:
>
> >> diff --git a/mm/kfence/core.c b/mm/kfence/core.c
> >> index e18fbbd5d9b4..bc15e3cb71d5 100644
> >> --- a/mm/kfence/core.c
> >> +++ b/mm/kfence/core.c
> >> @@ -50,6 +50,11 @@ static unsigned long kfence_sample_interval __read_mostly = CONFIG_KFENCE_SAMPLE
> >> #endif
> >> #define MODULE_PARAM_PREFIX "kfence."
> >>
> >> +unsigned long __weak kfence_arch_mask_addr(unsigned long addr)
> >> +{
> >> + return addr;
> >> +}
> >
> > I don't think this belongs here, because it's test-specific,
> > furthermore if possible we'd like to put all arch-specific code into
> > <asm/kfence.h> (whether or not your arch will have 'static inline'
> > functions only, like x86 and arm64, or not is up to you).
> >
> > Because I don't see this function being terribly complex, also let's
> > just make it a macro.
> >
> > Then in kfence_test.c, we can have:
> >
> > #ifndef kfence_test_mask_address
> > #define kfence_test_mask_address(addr) (addr)
> > #endif
> >
> > and then have it include <asm/kfence.h>. And in your <asm/kfence.h>
> > you can simply say:
> >
> > #define kfence_test_mask_address(addr) (.........)
> >
> > It also avoids having to export kfence_test_mask_address, because
> > kfence_test can be built as a module.
>
> Ok, i'll change my patch accordingly. Thanks!
Sounds good. Also please add a brief comment on top of the
"kfence_test_mask_address" part in kfence_test, like "/* May be
overridden by <asm/kfence.h>. */" -- we have something similar in
mm/kfence/report.c. Also, I think we want to call the macro
"arch_kfence_test_address" -- the "mask" part is very much
arch-dependent, and might not even be a mask on some other weird
hypothetical architecture.
Thanks,
-- Marco
next prev parent reply other threads:[~2021-05-14 11:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-14 9:21 [RFC] minor kfence patches Sven Schnelle
2021-05-14 9:21 ` [PATCH 1/2] kfence: add function to mask address bits Sven Schnelle
2021-05-14 10:54 ` Marco Elver
2021-05-14 11:03 ` Sven Schnelle
2021-05-14 11:23 ` Marco Elver [this message]
2021-05-14 9:21 ` [PATCH 2/2] kfence: only handle kernel mode faults Sven Schnelle
2021-05-14 10:52 ` Marco Elver
2021-05-14 10:55 ` Sven Schnelle
2021-05-14 10:59 ` Marco Elver
2021-05-14 10:56 ` [RFC] minor kfence patches Marco Elver
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=CANpmjNPAS5kDsADb-DwvdFR9nRnX47-mFuEG2vmMPn5U3i3sGQ@mail.gmail.com \
--to=elver@google.com \
--cc=glider@google.com \
--cc=kasan-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=svens@linux.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).