提交 55a2346c 编写于 作者: M Marco Elver 提交者: Paul E. McKenney

kcsan: Never set up watchpoints on NULL pointers

Avoid setting up watchpoints on NULL pointers, as otherwise we would
crash inside the KCSAN runtime (when checking for value changes) instead
of the instrumented code.

Because that may be confusing, skip any address less than PAGE_SIZE.
Reviewed-by: NDmitry Vyukov <dvyukov@google.com>
Signed-off-by: NMarco Elver <elver@google.com>
Signed-off-by: NPaul E. McKenney <paulmck@kernel.org>
上级 4761612f
...@@ -48,7 +48,11 @@ ...@@ -48,7 +48,11 @@
static inline bool check_encodable(unsigned long addr, size_t size) static inline bool check_encodable(unsigned long addr, size_t size)
{ {
return size <= MAX_ENCODABLE_SIZE; /*
* While we can encode addrs<PAGE_SIZE, avoid crashing with a NULL
* pointer deref inside KCSAN.
*/
return addr >= PAGE_SIZE && size <= MAX_ENCODABLE_SIZE;
} }
static inline long static inline long
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册