Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1224169

[PATCH v2 2/7] kasan: update reported bug types for kernel memory accesses

From Andrey Konovalov <andreyknvl@google.com>
Newsgroups linux.kernel
Subject [PATCH v2 2/7] kasan: update reported bug types for kernel memory accesses
Date 2015-09-14 15:50 +0200
Message-ID <q8CiT-7Pp-35@gated-at.bofh.it> (permalink)
References <q8CiS-7Pp-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Update the names of the bad access types to better reflect the type of
the access that happended and make these error types "literals" that can
be used for classification and deduplication in scripts.

Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
---
 mm/kasan/report.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/mm/kasan/report.c b/mm/kasan/report.c
index 964aaf4..cdf4c31 100644
--- a/mm/kasan/report.c
+++ b/mm/kasan/report.c
@@ -49,7 +49,7 @@ static const void *find_first_bad_addr(const void *addr, size_t size)
 
 static void print_error_description(struct kasan_access_info *info)
 {
-	const char *bug_type = "unknown crash";
+	const char *bug_type = "unknown-crash";
 	u8 shadow_val;
 
 	info->first_bad_addr = find_first_bad_addr(info->access_addr,
@@ -58,21 +58,25 @@ static void print_error_description(struct kasan_access_info *info)
 	shadow_val = *(u8 *)kasan_mem_to_shadow(info->first_bad_addr);
 
 	switch (shadow_val) {
-	case KASAN_FREE_PAGE:
-	case KASAN_KMALLOC_FREE:
-		bug_type = "use after free";
+	case 0 ... KASAN_SHADOW_SCALE_SIZE - 1:
+		bug_type = "out-of-bounds";
 		break;
 	case KASAN_PAGE_REDZONE:
 	case KASAN_KMALLOC_REDZONE:
+		bug_type = "slab-out-of-bounds";
+		break;
 	case KASAN_GLOBAL_REDZONE:
-	case 0 ... KASAN_SHADOW_SCALE_SIZE - 1:
-		bug_type = "out of bounds access";
+		bug_type = "global-out-of-bounds";
 		break;
 	case KASAN_STACK_LEFT:
 	case KASAN_STACK_MID:
 	case KASAN_STACK_RIGHT:
 	case KASAN_STACK_PARTIAL:
-		bug_type = "out of bounds on stack";
+		bug_type = "stack-out-of-bounds";
+		break;
+	case KASAN_FREE_PAGE:
+	case KASAN_KMALLOC_FREE:
+		bug_type = "use-after-free";
 		break;
 	}
 
-- 
2.6.0.rc0.131.gf624c3d

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/7] kasan: various fixes Andrey Konovalov <andreyknvl@google.com> - 2015-09-14 15:50 +0200
  [PATCH v2 3/7] kasan: accurately determine the type of the bad access Andrey Konovalov <andreyknvl@google.com> - 2015-09-14 15:50 +0200
  [PATCH v2 7/7] kasan: update reference to kasan prototype repo Andrey Konovalov <andreyknvl@google.com> - 2015-09-14 15:50 +0200
  [PATCH v2 2/7] kasan: update reported bug types for kernel memory accesses Andrey Konovalov <andreyknvl@google.com> - 2015-09-14 15:50 +0200
  [PATCH v2 5/7] kasan: various fixes in documentation Andrey Konovalov <andreyknvl@google.com> - 2015-09-14 15:50 +0200

csiph-web