lkml.org 
[lkml]   [2017]   [Nov]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 13/18] mm/vchecker: support inline KASAN build
Date
From: Joonsoo Kim <iamjoonsoo.kim@lge.com>

There is no reason not to support inline KASAN build. Support it.

Note that vchecker_check() function is now placed on kasan report function
to support inline build because gcc generates the inline check code and
then directly jump to kasan report function when poisoned value is found.
Name is somewhat misleading but there is no problem in the view of
implementation.

Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
---
lib/Kconfig.kasan | 1 -
mm/kasan/report.c | 8 ++++++++
2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/lib/Kconfig.kasan b/lib/Kconfig.kasan
index 51c0a05..d3552f3 100644
--- a/lib/Kconfig.kasan
+++ b/lib/Kconfig.kasan
@@ -63,6 +63,5 @@ config VCHECKER
happens at the area.

depends on KASAN && DEBUG_FS
- select KASAN_OUTLINE

endif
diff --git a/mm/kasan/report.c b/mm/kasan/report.c
index 6c83631..3d002aa 100644
--- a/mm/kasan/report.c
+++ b/mm/kasan/report.c
@@ -413,6 +413,8 @@ void kasan_report(unsigned long addr, size_t size,
#define DEFINE_ASAN_REPORT_LOAD(size) \
void __asan_report_load##size##_noabort(unsigned long addr) \
{ \
+ if (vchecker_check(addr, size, false, _RET_IP_)) \
+ return; \
kasan_report(addr, size, false, _RET_IP_); \
} \
EXPORT_SYMBOL(__asan_report_load##size##_noabort)
@@ -420,6 +422,8 @@ EXPORT_SYMBOL(__asan_report_load##size##_noabort)
#define DEFINE_ASAN_REPORT_STORE(size) \
void __asan_report_store##size##_noabort(unsigned long addr) \
{ \
+ if (vchecker_check(addr, size, true, _RET_IP_)) \
+ return; \
kasan_report(addr, size, true, _RET_IP_); \
} \
EXPORT_SYMBOL(__asan_report_store##size##_noabort)
@@ -437,12 +441,16 @@ DEFINE_ASAN_REPORT_STORE(16);

void __asan_report_load_n_noabort(unsigned long addr, size_t size)
{
+ if (vchecker_check(addr, size, false, _RET_IP_))
+ return;
kasan_report(addr, size, false, _RET_IP_);
}
EXPORT_SYMBOL(__asan_report_load_n_noabort);

void __asan_report_store_n_noabort(unsigned long addr, size_t size)
{
+ if (vchecker_check(addr, size, true, _RET_IP_))
+ return;
kasan_report(addr, size, true, _RET_IP_);
}
EXPORT_SYMBOL(__asan_report_store_n_noabort);
--
2.7.4
\
 
 \ /
  Last update: 2017-11-28 08:51    [W:0.147 / U:8.760 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site