mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: "Thomas Weißschuh" <thomas.weissschuh@linutronix.de>
Cc: Petr Mladek <pmladek@suse.com>, Kees Cook <keescook@chromium.org>,
	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>,
	linux-kernel@vger.kernel.org,
	John Ogness <john.ogness@linutronix.de>
Subject: Re: [PATCH] lib/vsprintf: Validate sleepable context during restrictred pointer formatting
Date: Thu, 19 Mar 2026 09:17:15 +0100	[thread overview]
Message-ID: <20260319081715.omCQUybq@linutronix.de> (raw)
In-Reply-To: <20260318160034-e7a37291-2536-4864-ae87-357ee134109f@linutronix.de>

On 2026-03-18 16:10:24 [+0100], Thomas Weißschuh wrote:
> That was my plan. My current idea uses a raw 'struct lockdep_map'
> without a dummy spinlock, as the spinlock would never be used anyways.
> But if the dummy spinlock would be better for some reason, let's use that.

just lockdep is fine. It is just annotation & verification at runtime,
no actual locking is needed/ intended.

> > > > than %pK. According to commit 312b4e226951f ("vsprintf: check real
> > > > user/group id for %pK") it is temporary as of 2013. There should be a
> > > > check at open time instead.
> > > 
> > > Doing the check at open time requires some place to store the result
> > > of it. The users of %pK I looked at all reused their core datastructures
> > > as state in seq_file, so finding space for the result from open time
> > > would require some non-trivial changes to them.
> > 
> > You could go for the easy solution and return early with -EACCES or so.
> > That was the intention according to my understanding.
> 
> My understanding is different. The file should be readable for everybody.
> But the actual contents depend on the user reading it. The clean solution
> would be to check the user during open() and decide once if the pointers
> should be printed raw/hashed/zeroed out.
> 
> The fact that even 13 years later there are no helpers whatsoever for
> users to do the checks at open() time and later do the formatting,
> probably didn't help the adoption of that scheme.

I don't recall needing ever pointer for other reasons than debugging.

> Thomas

Sebastian

  reply	other threads:[~2026-03-19  8:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-17 11:41 Thomas Weißschuh
2026-03-17 14:07 ` Andy Shevchenko
2026-03-17 14:26   ` Thomas Weißschuh
2026-03-17 17:24     ` Steven Rostedt
2026-03-18  8:48 ` Thomas Weißschuh
2026-03-18 11:01   ` Petr Mladek
2026-03-18 11:03   ` Petr Mladek
2026-03-18 13:59     ` Sebastian Andrzej Siewior
2026-03-18 14:45       ` Thomas Weißschuh
2026-03-18 14:57         ` Sebastian Andrzej Siewior
2026-03-18 15:10           ` Thomas Weißschuh
2026-03-19  8:17             ` Sebastian Andrzej Siewior [this message]
2026-03-20  1:53 ` kernel test robot

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=20260319081715.omCQUybq@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=akpm@linux-foundation.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=john.ogness@linutronix.de \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=senozhatsky@chromium.org \
    --cc=thomas.weissschuh@linutronix.de \
    /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

all inboxes | Powered by JetHome®