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!