mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jane Chu <jane.chu@oracle.com>
To: Randy Dunlap <rdunlap@infradead.org>, Petr Mladek <pmladek@suse.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	"rostedt@goodmis.org" <rostedt@goodmis.org>,
	"senozhatsky@chromium.org" <senozhatsky@chromium.org>,
	"linux@rasmusvillemoes.dk" <linux@rasmusvillemoes.dk>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	Haakon Bugge <haakon.bugge@oracle.com>,
	John Haxby <john.haxby@oracle.com>,
	Jane Chu <jane.chu@oracle.com>
Subject: Re: [PATCH] vsprintf: protect kernel from panic due to non-canonical pointer dereference
Date: Tue, 18 Oct 2022 19:58:25 +0000	[thread overview]
Message-ID: <c0c0d440-8a2b-c1b1-83b6-278f4bdaf233@oracle.com> (raw)
In-Reply-To: <46b4bf12-f501-0447-8c3c-8dd0cb91ba92@infradead.org>

On 10/18/2022 12:28 PM, Randy Dunlap wrote:
> Hi--
> 
[..]
>>>> That said, I realized that not all
>>>> architecture implement meaningful kern_addr_valid(), so this line
>>>>       if ((unsigned long)ptr < PAGE_SIZE || IS_ERR_VALUE(ptr))
>>>> is still need.  I'll send v2.
>>>
>>> Please, add linux-mm@kvack.org into CC.
>>
>> Will do.
>>
>>> I wonder if kern_addr_valid()
>>> is safe to use anywhere, especially during early boot. I wonder if
>>> it would make sense to implement it on all architectures.
>>
>> On x86 architecture, kern_addr_valid() looks safe to me though, on
>> several other architectures, it's defined (1).
> 
> You might want to compare this patch, which seems to have some support:
> 
> https://lore.kernel.org/lkml/20221018074014.185687-1-wangkefeng.wang@huawei.com/
> 

Thank you for alerting me, appreciated!

The patch comment says "copy_from_kernel_nofault() which could check 
whether the address is a valid kernel address, so no need 
kern_addr_valid()", I'm afraid copy_from_kernel_nofault() is more of a 
heavy hammer, and less appropriate for this patch.  I'll take a closer 
look before responding to the submitter.

thanks!
-jane

  reply	other threads:[~2022-10-18 19:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-17 19:16 Jane Chu
2022-10-17 19:25 ` Andy Shevchenko
2022-10-17 19:31   ` Jane Chu
2022-10-18 12:45     ` Petr Mladek
2022-10-18 18:56       ` Jane Chu
2022-10-18 19:28         ` Randy Dunlap
2022-10-18 19:58           ` Jane Chu [this message]
2022-10-18 20:07         ` Andy Shevchenko
2022-10-18 20:30           ` Jane Chu
2022-10-18 20:49             ` Andy Shevchenko
2022-10-19 10:43               ` Haakon Bugge
2022-10-19 11:25                 ` Andy Shevchenko
2022-10-19 18:36               ` Jane Chu
2022-10-19 19:26                 ` Andy Shevchenko
2022-10-19 20:16                   ` Jane Chu
2022-10-20  7:44               ` Petr Mladek
2022-10-20  9:18                 ` Petr Mladek
2022-10-20 13:57                 ` Andy Shevchenko

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=c0c0d440-8a2b-c1b1-83b6-278f4bdaf233@oracle.com \
    --to=jane.chu@oracle.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=haakon.bugge@oracle.com \
    --cc=john.haxby@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=pmladek@suse.com \
    --cc=rdunlap@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=senozhatsky@chromium.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 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®