Skip to contentSkip to conversation

+ kasan-update-reported-bug-types-for-not-user-nor-kernel-memory-accesses.patch tentatively added to -mm tree

PATCH [email protected] 1 participant 1 message Sep 14, 2015

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch titled
Subject: kasan: update reported bug types for not user nor kernel memory accesses
has been added to the -mm tree. Its filename is
kasan-update-reported-bug-types-for-not-user-nor-kernel-memory-accesses.patch

This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/kasan-update-reported-bug-types-for-not-user-nor-kernel-memory-accesses.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/kasan-update-reported-bug-types-for-not-user-nor-kernel-memory-accesses.patch

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated there every 3-4 working days

------------------------------------------------------
From: Andrey Konovalov <[email protected]>
Subject: kasan: update reported bug types for not user nor kernel memory accesses

Each access with address lower than kasan_shadow_to_mem(KASAN_SHADOW_START) is reported as user-memory-access. This is not always true, the accessed address might not be in user space. Fix this by reporting such accesses as null-ptr-derefs or wild-memory-accesses.

There's another reason for this change. For userspace ASan we have a bunch of systems that analyze error types for the purpose of classification and deduplication. Sooner of later we will write them to KASAN as well. Then clearly and explicitly stated error types will bring value.

Cc Andrey Ryabinin <[email protected]>
Cc Dmitry Vyukov <[email protected]>
Cc Alexander Potapenko <[email protected]>
Cc Konstantin Serebryany <[email protected]>

---

 mm/kasan/kasan.c  |    8 -------
 mm/kasan/kasan.h  |    3 --
 mm/kasan/report.c |   50 ++++++++++++++++++++------------------------
 3 files changed, 24 insertions(+), 37 deletions(-)
mm/kasan/kasan.c renamed from mm/kasan/kasan.c~kasan-update-reported-bug-types-for-not-user-nor-kernel-memory-accesses +1 -7
diff -puN mm/kasan/kasan.c~kasan-update-reported-bug-types-for-not-user-nor-kernel-memory-accesses mm/kasan/kasan.c
@@ -252,18 +252,12 @@ static __always_inline bool memory_is_po
 static __always_inline void check_memory_region(unsigned long addr,
 						size_t size, bool write)
 {
-	struct kasan_access_info info;
-
 	if (unlikely(size == 0))
 		return;
 
 	if (unlikely((void *)addr <
 		kasan_shadow_to_mem((void *)KASAN_SHADOW_START))) {
-		info.access_addr = (void *)addr;
-		info.access_size = size;
-		info.is_write = write;
-		info.ip = _RET_IP_;
-		kasan_report_user_access(&info);
+		kasan_report(addr, size, write, _RET_IP_);
 		return;
 	}
 
mm/kasan/kasan.h renamed from mm/kasan/kasan.h~kasan-update-reported-bug-types-for-not-user-nor-kernel-memory-accesses +0 -3
diff -puN mm/kasan/kasan.h~kasan-update-reported-bug-types-for-not-user-nor-kernel-memory-accesses mm/kasan/kasan.h
@@ -54,9 +54,6 @@ struct kasan_global {
 #endif
 };
 
-void kasan_report_error(struct kasan_access_info *info);
-void kasan_report_user_access(struct kasan_access_info *info);
-
 static inline const void *kasan_shadow_to_mem(const void *shadow_addr)
 {
 	return (void *)(((unsigned long)shadow_addr - KASAN_SHADOW_OFFSET)
mm/kasan/report.c renamed from mm/kasan/report.c~kasan-update-reported-bug-types-for-not-user-nor-kernel-memory-accesses +23 -27

70 lines not on this page · raw message

_

Patches currently in -mm which might be from [email protected] are

kasan-update-reported-bug-types-for-not-user-nor-kernel-memory-accesses.patch kasan-update-reported-bug-types-for-kernel-memory-accesses.patch kasan-accurately-determine-the-type-of-the-bad-access.patch kasan-update-log-messages.patch kasan-various-fixes-in-documentation.patch kasan-move-kasan_sanitize-in-arch-x86-boot-makefile.patch kasan-update-reference-to-kasan-prototype-repo.patch