From: Andrew Morton <akpm@linux-foundation.org>
To: Sabyrzhan Tasbolatov <snovitoll@gmail.com>
Cc: andreyknvl@gmail.com, arnd@arndb.de, david@redhat.com,
dvyukov@google.com, elver@google.com, glider@google.com,
hch@infradead.org, kasan-dev@googlegroups.com,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
ryabinin.a.a@gmail.com, vincenzo.frascino@arm.com
Subject: Re: [PATCH v2] mm: unexport globally copy_to_kernel_nofault
Date: Sun, 22 Jun 2025 11:20:14 -0700 [thread overview]
Message-ID: <20250622112014.76bdd8929ecdb1c1fb3015b5@linux-foundation.org> (raw)
In-Reply-To: <20250622141142.79332-1-snovitoll@gmail.com>
On Sun, 22 Jun 2025 19:11:42 +0500 Sabyrzhan Tasbolatov <snovitoll@gmail.com> wrote:
> `copy_to_kernel_nofault()` is an internal helper which should not be
> visible to loadable modules – exporting it would give exploit code a
> cheap oracle to probe kernel addresses. Instead, keep the helper
> un-exported and compile the kunit case that exercises it only when
> `mm/kasan/kasan_test.o` is linked into vmlinux.
The recent 707f853d7fa3 ("module: Provide
EXPORT_SYMBOL_GPL_FOR_MODULES() helper") quietly added a thing which
might be useful here. As far as I understand it, this will permit us
to export copy_to_kernel_nofault to kasan_test_c.o and to nothing else.
"might". It depends on how "exploit code" might get hold of the
symbol. Perhaps you/we can discuss this further. Is the problem that
copy_to_kernel_nofault() is non-static? Or it the problem that
"exploit code" is itself a kernel module?
In other words, a fuller investigation of how this export presently benefits
exploiters would help us understand how much
EXPORT_SYMBOL_GPL_FOR_MODULES() will improve the situation.
next prev parent reply other threads:[~2025-06-22 18:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-22 5:19 [PATCH] " Sabyrzhan Tasbolatov
2025-06-22 13:00 ` Andrey Konovalov
2025-06-22 14:11 ` [PATCH v2] " Sabyrzhan Tasbolatov
2025-06-22 17:44 ` Arnd Bergmann
2025-06-22 18:20 ` Andrew Morton [this message]
2025-06-22 19:09 ` Sabyrzhan Tasbolatov
2025-06-22 23:45 ` Andrey Konovalov
2025-06-23 8:09 ` David Hildenbrand
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=20250622112014.76bdd8929ecdb1c1fb3015b5@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=andreyknvl@gmail.com \
--cc=arnd@arndb.de \
--cc=david@redhat.com \
--cc=dvyukov@google.com \
--cc=elver@google.com \
--cc=glider@google.com \
--cc=hch@infradead.org \
--cc=kasan-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ryabinin.a.a@gmail.com \
--cc=snovitoll@gmail.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox