Re: [BUG] Use of probe_kernel_address() in task_rcu_dereference() without checking return value
From: Oleg Nesterov
Date: Fri Aug 30 2019 - 12:10:03 EST
On 08/30, Linus Torvalds wrote:
>
> Side note: that code had better not be performance-critical, because
> "probe_kernel_address()" is actually really really slow.
Yes, please see
[PATCH 2/3] introduce probe_slab_address()
https://lore.kernel.org/lkml/20141027195425.GC11736@xxxxxxxxxx/
I sent 5 years ago ;) Do you think
/*
* Same as probe_kernel_address(), but @addr must be the valid pointer
* to a slab object, potentially freed/reused/unmapped.
*/
#ifdef CONFIG_DEBUG_PAGEALLOC
#define probe_slab_address(addr, retval) \
probe_kernel_address(addr, retval)
#else
#define probe_slab_address(addr, retval) \
({ \
(retval) = *(typeof(retval) *)(addr); \
0; \
})
#endif
can work?
Oleg.