Thread (30 messages) flat view 30 messages, 3 authors, 2021-01-14

Re: [PATCH v2 11/14] kasan: fix bug detection via ksize for HW_TAGS mode

From: Andrey Konovalov <hidden>
Date: 2021-01-14 18:00:07
Also in: linux-arm-kernel, lkml

On Wed, Jan 13, 2021 at 5:54 PM Marco Elver [off-list ref] wrote:
quoted
+bool __kasan_check_byte(const void *addr, unsigned long ip);
+static __always_inline bool kasan_check_byte(const void *addr, unsigned long ip)
+{
+       if (kasan_enabled())
+               return __kasan_check_byte(addr, ip);
+       return true;
+}
Why was this not added to kasan-checks.h? I'd assume including all of
kasan.h is also undesirable for tag-based modes if we just want to do
a kasan_check_byte().

Was requiring 'ip' intentional? Unlike the other
kasan_check-functions, this takes an explicit 'ip'. In the case of
ksize() usage, this is an advantage, so I'd probably keep it, but the
rationale to introducing 'ip' vs. before wasn't mentioned.
Yes, to avoid having a ksize() frame in the report. However, I'll move
_RET_IP_ inside of kasan_check_byte() as it's inline.
quoted
+bool __kasan_check_byte(const void *address, unsigned long ip)
+{
+       if (!kasan_byte_accessible(address)) {
+               kasan_report((unsigned long)address, 1, false, ip);
+               return false;
+       }
+       return true;
+}
Like the other __kasan_check*, should this have been EXPORT_SYMBOL()?
Or was it intentional to not export as it's currently only used by
non-modules?
We can add EXPORT_SYMBOL as soon as there's a need for it.

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