[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c0c0d440-8a2b-c1b1-83b6-278f4bdaf233@oracle.com>
Date: Tue, 18 Oct 2022 19:58:25 +0000
From: Jane Chu <jane.chu@...cle.com>
To: Randy Dunlap <rdunlap@...radead.org>,
Petr Mladek <pmladek@...e.com>
CC: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
"rostedt@...dmis.org" <rostedt@...dmis.org>,
"senozhatsky@...omium.org" <senozhatsky@...omium.org>,
"linux@...musvillemoes.dk" <linux@...musvillemoes.dk>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
Haakon Bugge <haakon.bugge@...cle.com>,
John Haxby <john.haxby@...cle.com>,
Jane Chu <jane.chu@...cle.com>
Subject: Re: [PATCH] vsprintf: protect kernel from panic due to non-canonical
pointer dereference
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@...ck.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
Powered by blists - more mailing lists