From: Petr Mladek <pmladek@suse.com>
To: "Thomas Weißschuh" <thomas.weissschuh@linutronix.de>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Steven Rostedt <rostedt@goodmis.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
Boqun Feng <boqun@kernel.org>, Waiman Long <longman@redhat.com>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Clark Williams <clrkwllms@kernel.org>,
Kees Cook <kees@kernel.org>,
linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev
Subject: Re: [PATCH v3 5/5] lib/vsprintf: Always check interrupt context restrictions
Date: Wed, 27 May 2026 17:45:27 +0200 [thread overview]
Message-ID: <ahcRl6kStEGreUT7@pathway.suse.cz> (raw)
In-Reply-To: <20260520-restricted-pointers-final-v3-5-76bca6a6ab3f@linutronix.de>
On Wed 2026-05-20 10:40:04, Thomas Weißschuh wrote:
> When kptr_restrict is set to '1' restricted pointers can not be used
> in IRQ context. As kptr_restrict can change at any time at runtime,
> this means that restricted pointers can not be used from IRQ context
> in general.
>
> Add some assertions to detect misuse early, independently of the
> runtime configuration of the test system.
>
> --- a/lib/vsprintf.c
> +++ b/lib/vsprintf.c
> @@ -871,6 +871,8 @@ char *restricted_pointer(char *buf, char *end, const void *ptr,
>
> guard(lock_map_acquire)(&vsprintf_restricted_pointer_map);
>
> + lockdep_assert(in_task());
It might make sense to do this assert before checking the fake
spinlock. The task context is more restrictive than then
the spin lock context so we might want to check it first.
It might prevent confusing reports about inconsitent IRQ
usage. This function should not be called in IRQ context
at all.
Otherwise, it looks good to me.
Best Regards,
Petr
> +
> switch (kptr_restrict) {
> case 0:
> /* Handle as %p, hash and do _not_ leak addresses. */
prev parent reply other threads:[~2026-05-27 15:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-20 8:39 [PATCH v3 0/5] lib/vsprintf: Validate spinlock context during restricted pointer formatting Thomas Weißschuh
2026-05-20 8:40 ` [PATCH v3 1/5] locking/lockdep: Add a helper to validate the locking context without a lock Thomas Weißschuh
2026-05-20 8:40 ` [PATCH v3 2/5] locking/lockdep: Add a guard for lock_map_acquire() Thomas Weißschuh
2026-05-20 8:40 ` [PATCH v3 3/5] lib/vsprintf: Validate spinlock context during restricted pointer formatting Thomas Weißschuh
2026-05-27 15:38 ` Petr Mladek
2026-05-20 8:40 ` [PATCH v3 4/5] lib/vsprintf: Use in_task() for restricted pointer context check Thomas Weißschuh
2026-05-20 8:40 ` [PATCH v3 5/5] lib/vsprintf: Always check interrupt context restrictions Thomas Weißschuh
2026-05-27 15:45 ` Petr Mladek [this message]
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=ahcRl6kStEGreUT7@pathway.suse.cz \
--to=pmladek@suse.com \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bigeasy@linutronix.de \
--cc=boqun@kernel.org \
--cc=clrkwllms@kernel.org \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-devel@lists.linux.dev \
--cc=linux@rasmusvillemoes.dk \
--cc=longman@redhat.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=senozhatsky@chromium.org \
--cc=thomas.weissschuh@linutronix.de \
--cc=will@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 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.