From: Andrey Konovalov <andreyknvl@gmail.com>
To: Sabyrzhan Tasbolatov <snovitoll@gmail.com>
Cc: akpm@linux-foundation.org, bp@alien8.de, brauner@kernel.org,
dave.hansen@linux.intel.com, dhowells@redhat.com,
dvyukov@google.com, glider@google.com, hpa@zytor.com,
kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, mingo@redhat.com, ryabinin.a.a@gmail.com,
tglx@linutronix.de, vincenzo.frascino@arm.com, x86@kernel.org
Subject: Re: [PATCH v4] mm: x86: instrument __get/__put_kernel_nofault
Date: Sun, 22 Sep 2024 14:04:29 +0200 [thread overview]
Message-ID: <CA+fCnZfaZGowWPE8kMeTY60n7BCFT2q4+Z2EJ92YB_+7+OUo7Q@mail.gmail.com> (raw)
In-Reply-To: <CACzwLxjZ33r2aCKromHP++2sLjWAQ9evF5kZQCx2poty=+N_3Q@mail.gmail.com>
On Sun, Sep 22, 2024 at 11:26 AM Sabyrzhan Tasbolatov
<snovitoll@gmail.com> wrote:
>
> On Sun, Sep 22, 2024 at 1:49 AM Andrey Konovalov <andreyknvl@gmail.com> wrote:
> >
> > I tried running the tests with this patch applied, but unfortunately
> > the added test fails on arm64, most likely due to missing annotations
> > in arm64 asm code.
>
> Thanks for testing it on arm64. I've checked other arch and found out
> that only s390, x86 are using <linux/instrumented.h> header with
> KASAN and friends in annotations. <linux/kasan-checks.h> is in arm64 and x86.
>
> While the current [PATCH v4] has x86 only instrumentations for
> __get/put_kernel_nofault, I think, we can take as an example copy_from_user
> solution here:
>
> https://elixir.bootlin.com/linux/v6.11-rc7/source/include/linux/uaccess.h#L162-L164
>
> , which should be a generic instrumentation of __get/put_kernel_nofault
> for all arch. I can try to make a separate PATCH with this solution.
_inline_copy_from_user appears to only be called for non-kernel
variants of copy_from_user, so you would need something different.
> > We need to either mark the added test as x86-only via
> > KASAN_TEST_NEEDS_CONFIG_ON or add annotations for arm64.
> >
> > With annotations for arm64, the test might still fail for other
> > architectures, but I think that's fine: hopefully relevant people will
> > add annotations in time. But I consider both x86 and arm64 important,
> > so we should keep the tests working there.
> >
> > If you decide to add annotations for arm64, please also test both
> > KASAN_SW_TAGS and KASAN_HW_TAGS modes.
>
> Please suggest if the solution above to make a generic instrumentation of
> __get/put_kernel_nofault is suitable.
I think the approach you have taken with adding instrument_read/write
into arch code is fine, we just need to do this for all arches.
An alternative would be common wrapper macros that calls
__get/put_kernel_nofault + instrument_read/write.
> Otherwise, for this patch as you've suggested, we can add
> KASAN_TEST_NEEDS_CONFIG_ON(test, CONFIG_X86);
> to make sure that kunit test is for x86 only and I can add arm64 kasan-checks
> with SW, HW tags in separate "mm, arm64" PATCH.
Sounds good too.
next prev parent reply other threads:[~2024-09-22 12:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-17 20:18 [PATCH] " Sabyrzhan Tasbolatov
2024-09-17 22:51 ` Andrey Konovalov
2024-09-18 10:56 ` [PATCH v2] " Sabyrzhan Tasbolatov
2024-09-18 15:15 ` Andrey Konovalov
2024-09-19 10:57 ` [PATCH v3] " Sabyrzhan Tasbolatov
2024-09-20 22:26 ` Andrey Konovalov
2024-09-21 7:10 ` [PATCH v4] " Sabyrzhan Tasbolatov
2024-09-21 20:49 ` Andrey Konovalov
2024-09-22 9:26 ` Sabyrzhan Tasbolatov
2024-09-22 12:04 ` Andrey Konovalov [this message]
2024-09-22 14:57 ` [PATCH v5] " Sabyrzhan Tasbolatov
2024-09-23 6:09 ` Sabyrzhan Tasbolatov
2024-09-27 15:18 ` Sabyrzhan Tasbolatov
2024-09-22 12:06 ` [PATCH v4] " Andrey Konovalov
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=CA+fCnZfaZGowWPE8kMeTY60n7BCFT2q4+Z2EJ92YB_+7+OUo7Q@mail.gmail.com \
--to=andreyknvl@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=bp@alien8.de \
--cc=brauner@kernel.org \
--cc=dave.hansen@linux.intel.com \
--cc=dhowells@redhat.com \
--cc=dvyukov@google.com \
--cc=glider@google.com \
--cc=hpa@zytor.com \
--cc=kasan-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mingo@redhat.com \
--cc=ryabinin.a.a@gmail.com \
--cc=snovitoll@gmail.com \
--cc=tglx@linutronix.de \
--cc=vincenzo.frascino@arm.com \
--cc=x86@kernel.org \
/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