Re: [PATCH] vsprintf: Add test for restricted kernel pointers
From: Andy Shevchenko
Date: Mon Jan 19 2026 - 02:34:55 EST
On Fri, Jan 16, 2026 at 06:06:59PM +0100, Petr Mladek wrote:
> On Wed 2026-01-14 08:27:34, Thomas Weißschuh wrote:
...
> > Fill out the tests for restricted kernel pointers, using the %pK format.
> > This test can only be executed when built into the kernel, as modules
> > do not have access to the kptr_restrict knob.
>
> I think that we could export "kptr_restrict" like we did
> with no_hash_pointers. AFAIK, it has been exported just because
> of the test module as well.
>
> > Please note that changes to the kptr_restrict sysctl from the kernel
> > commandline are only applied *after* the boot-time KUnit tests run.
>
> This is another motivation to export the symbol. Otherwise, it is
> really hard to test the non-default variants.
>
> BTW: I have recently heard about EXPORT_SYMBOL_NS(). It would allow
> to export the symbol only for some specific modules.
>
> I am not sure how exactly it works. I wonder if there already
> exists a namespace for KUnit tests.
>
> It would be nice to use it, even for "no_hash_pointers"...
This is a variant for really strict use:
EXPORT_SYNBOL_FOR_MODULES().
--
With Best Regards,
Andy Shevchenko