[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YCZr4WrcwfWxVVad@alley>
Date: Fri, 12 Feb 2021 12:52:01 +0100
From: Petr Mladek <pmladek@...e.com>
To: Timur Tabi <timur@...nel.org>
Cc: Steven Rostedt <rostedt@...dmis.org>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Vlastimil Babka <vbabka@...e.cz>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Matthew Wilcox <willy@...radead.org>,
akpm@...ux-foundation.org,
Linus Torvalds <torvalds@...ux-foundation.org>,
roman.fietze@...na.com, Kees Cook <keescook@...omium.org>,
John Ogness <john.ogness@...utronix.de>,
akinobu.mita@...il.com, glider@...gle.com,
Andrey Konovalov <andreyknvl@...gle.com>,
Marco Elver <elver@...gle.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Pavel Machek <pavel@....cz>, linux-kernel@...r.kernel.org,
linux-mm@...ck.org
Subject: Re: [PATCH 3/3] lib/vsprintf: make-printk-non-secret printks all
addresses as unhashed
Hi,
I have realized that I did not comment the two ideas.
On Wed 2021-02-10 11:27:45, Timur Tabi wrote:
>
>
> On 2/10/21 7:41 AM, Petr Mladek wrote:
> >
> > The option causes that vsprintf() will not hash pointers. Yes, it is
> > primary used by printk(). But it is used also in some other
> > interfaces, especially trace_printk(), seq_buf() API. The naked
> > pointers might appear more or less anywhere, including procfs,
> > sysfs, debugfs.
>
> Fair point. Shouldn't calls to seq_buf_printf() (and any printk usage that
> always exists in the context of a user-space process) use %pK anyway?
seq_buf is a handy API that might be used for different purpose.
For example, it seems to be used ftrace where people might want
to see real pointers when debugging.
> Hmmm.... maybe vsprintf() should automatically replace %p with %pK if it
> detects a user-space context?
I am not sure if there is an easy and reliable way how to detect the
user-space context. On some architectures, it might be possible to
guess it by the address of the buffer. But it will not work when
the message is temporary printed into a local buffer and copied
later.
Let's keep it simple. Heuristics often become very complex over time.
Best Regards,
Petr
Powered by blists - more mailing lists