[v3,0/1] vsprintf: check non-canonical pointer by kern_addr_valid()

Message ID 20221019193431.2923462-1-jane.chu@oracle.com
Headers
Series vsprintf: check non-canonical pointer by kern_addr_valid() |

Message

Jane Chu Oct. 19, 2022, 7:34 p.m. UTC
  Changes since v2 [1]:
 - revised commit comment for clarification;
 - cc linux-mm for expert's review on the kern_addr_valid() usage as suggested by Petr;
 - cc Kefeng Wang in light of his recent patch [2]

[1]: https://lore.kernel.org/lkml/288a7aba-c647-b51f-bdb3-99a62449dbb3@oracle.com/T/ 
[2]: https://lore.kernel.org/lkml/20221018074014.185687-1-wangkefeng.wang@huawei.com/

Jane Chu (1):
  vsprintf: protect kernel from panic due to non-canonical pointer
    dereference

 lib/vsprintf.c | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

Kefeng Wang Oct. 20, 2022, 1:12 p.m. UTC | #1
On 2022/10/20 3:34, Jane Chu wrote:
> Changes since v2 [1]:
>   - revised commit comment for clarification;
>   - cc linux-mm for expert's review on the kern_addr_valid() usage as suggested by Petr;

but this won't fix issue on archs which don't have correct 
kern_addr_valid(), right?

could we call copy_from_kernel_nofault() when it could works well, and 
skip it on early boot?

other options, call some functions in include/asm-generic/sections.h  or 
include/linux/kallsyms.h?


>   - cc Kefeng Wang in light of his recent patch [2]
>
> [1]: https://lore.kernel.org/lkml/288a7aba-c647-b51f-bdb3-99a62449dbb3@oracle.com/T/
> [2]: https://lore.kernel.org/lkml/20221018074014.185687-1-wangkefeng.wang@huawei.com/
>
> Jane Chu (1):
>    vsprintf: protect kernel from panic due to non-canonical pointer
>      dereference
>
>   lib/vsprintf.c | 3 +++
>   1 file changed, 3 insertions(+)
>