Thread (39 messages) flat view 39 messages, 11 authors, 2019-05-15

Re: [PATCH] vsprintf: Do not break early boot with probing addresses

From: Sergey Senozhatsky <hidden>
Date: 2019-05-14 02:07:36
Also in: linux-arch, linux-s390, lkml

On (05/13/19 14:42), Petr Mladek wrote:
quoted
The "(null)" is good enough by itself and already an established
practice..
(efault) made more sense with the probe_kernel_read() that
checked wide range of addresses. Well, I still think that
it makes sense to distinguish a pure NULL. And it still
used also for IS_ERR_VALUE().
Wouldn't anything within first PAGE_SIZE bytes be reported as
a NULL deref?

       char *p = (char *)(PAGE_SIZE - 2);
       *p = 'a';

gives

 kernel: BUG: kernel NULL pointer dereference, address = 0000000000000ffe
 kernel: #PF: supervisor-privileged write access from kernel code
 kernel: #PF: error_code(0x0002) - not-present page


And I like Steven's "(fault)" idea.
How about this:

	if ptr < PAGE_SIZE		-> "(null)"
	if IS_ERR_VALUE(ptr)		-> "(fault)"

	-ss
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help