+ kasan-added-functions-for-unpoisoning-stack-variables-fix-fix.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: kasan: add declarations for internal functions
has been added to the -mm tree.  Its filename is
     kasan-added-functions-for-unpoisoning-stack-variables-fix-fix.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/kasan-added-functions-for-unpoisoning-stack-variables-fix-fix.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/kasan-added-functions-for-unpoisoning-stack-variables-fix-fix.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: Arnd Bergmann <arnd@xxxxxxxx>
Subject: kasan: add declarations for internal functions

A patch got merged that made newly added functions static, leading
to a warning about unused functions as well as a link error when
they are actually used:

mm/kasan/kasan.c:780:7: error: '__asan_set_shadow_f8' defined but not used [-Werror=unused-function]
mm/kasan/kasan.c:791:8: note: in expansion of macro 'DEFINE_ASAN_SET_SHADOW'
mm/kasan/kasan.c:780:7: error: '__asan_set_shadow_f5' defined but not used [-Werror=unused-function]

It turns out the underlying problem is that a lot of the internal
interfaces of the kasan implementation are only ever called from
code generated by the compiler. These don't need any declarations
to work fine, but cause warnings both with sparse and with 'make W=1':

mm/kasan/kasan.c:695:1: warning: symbol '__asan_load1' was not declared. Should it be static?
mm/kasan/kasan.c:695:1: warning: symbol '__asan_store1' was not declared. Should it be static?
mm/kasan/kasan.c:696:1: warning: symbol '__asan_load2' was not declared. Should it be static?
mm/kasan/kasan.c:696:1: warning: symbol '__asan_store2' was not declared. Should it be static?
mm/kasan/kasan.c:697:1: warning: symbol '__asan_load4' was not declared. Should it be static?

This removes the bogus 'static' annotation and adds declarations
for all affected interfaces.

Link: http://lkml.kernel.org/r/20180105094112.2690475-1-arnd@xxxxxxxx
Fixes: mmotm ("kasan: __asan_set_shadow_00 can be static")
Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
Cc: Alexander Potapenko <glider@xxxxxxxxxx>
Cc: Greg Hackmann <ghackmann@xxxxxxxxxx>
Cc: Paul Lawrence <paullawrence@xxxxxxxxxx>
CcAndrey Ryabinin <aryabinin@xxxxxxxxxxxxx>
Cc: Dmitry Vyukov <dvyukov@xxxxxxxxxx>
Cc: Masahiro Yamada <yamada.masahiro@xxxxxxxxxxxxx>
Cc: Matthias Kaehlcke <mka@xxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 mm/kasan/kasan.c |   12 ++++++------
 mm/kasan/kasan.h |   44 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+), 6 deletions(-)

diff -puN mm/kasan/kasan.c~kasan-added-functions-for-unpoisoning-stack-variables-fix-fix mm/kasan/kasan.c
--- a/mm/kasan/kasan.c~kasan-added-functions-for-unpoisoning-stack-variables-fix-fix
+++ a/mm/kasan/kasan.c
@@ -778,12 +778,12 @@ EXPORT_SYMBOL(__asan_allocas_unpoison);
 	}								\
 	EXPORT_SYMBOL(__asan_set_shadow_##byte)
 
-static DEFINE_ASAN_SET_SHADOW(00);
-static DEFINE_ASAN_SET_SHADOW(f1);
-static DEFINE_ASAN_SET_SHADOW(f2);
-static DEFINE_ASAN_SET_SHADOW(f3);
-static DEFINE_ASAN_SET_SHADOW(f5);
-static DEFINE_ASAN_SET_SHADOW(f8);
+DEFINE_ASAN_SET_SHADOW(00);
+DEFINE_ASAN_SET_SHADOW(f1);
+DEFINE_ASAN_SET_SHADOW(f2);
+DEFINE_ASAN_SET_SHADOW(f3);
+DEFINE_ASAN_SET_SHADOW(f5);
+DEFINE_ASAN_SET_SHADOW(f8);
 
 #ifdef CONFIG_MEMORY_HOTPLUG
 static int __meminit kasan_mem_notifier(struct notifier_block *nb,
diff -puN mm/kasan/kasan.h~kasan-added-functions-for-unpoisoning-stack-variables-fix-fix mm/kasan/kasan.h
--- a/mm/kasan/kasan.h~kasan-added-functions-for-unpoisoning-stack-variables-fix-fix
+++ a/mm/kasan/kasan.h
@@ -121,4 +121,48 @@ static inline void quarantine_reduce(voi
 static inline void quarantine_remove_cache(struct kmem_cache *cache) { }
 #endif
 
+/*
+ * Exported functions for interfaces called from assembly or from generated
+ * code. Declarations here to avoid warning about missing declarations.
+ */
+asmlinkage void kasan_unpoison_task_stack_below(const void *watermark);
+void __asan_register_globals(struct kasan_global *globals, size_t size);
+void __asan_unregister_globals(struct kasan_global *globals, size_t size);
+void __asan_loadN(unsigned long addr, size_t size);
+void __asan_storeN(unsigned long addr, size_t size);
+void __asan_handle_no_return(void);
+void __asan_poison_stack_memory(const void *addr, size_t size);
+void __asan_unpoison_stack_memory(const void *addr, size_t size);
+void __asan_alloca_poison(unsigned long addr, size_t size);
+void __asan_allocas_unpoison(const void *stack_top, const void *stack_bottom);
+
+void __asan_load1(unsigned long addr);
+void __asan_store1(unsigned long addr);
+void __asan_load2(unsigned long addr);
+void __asan_store2(unsigned long addr);
+void __asan_load4(unsigned long addr);
+void __asan_store4(unsigned long addr);
+void __asan_load8(unsigned long addr);
+void __asan_store8(unsigned long addr);
+void __asan_load16(unsigned long addr);
+void __asan_store16(unsigned long addr);
+
+void __asan_load1_noabort(unsigned long addr);
+void __asan_store1_noabort(unsigned long addr);
+void __asan_load2_noabort(unsigned long addr);
+void __asan_store2_noabort(unsigned long addr);
+void __asan_load4_noabort(unsigned long addr);
+void __asan_store4_noabort(unsigned long addr);
+void __asan_load8_noabort(unsigned long addr);
+void __asan_store8_noabort(unsigned long addr);
+void __asan_load16_noabort(unsigned long addr);
+void __asan_store16_noabort(unsigned long addr);
+
+void __asan_set_shadow_00(const void *addr, size_t size);
+void __asan_set_shadow_f1(const void *addr, size_t size);
+void __asan_set_shadow_f2(const void *addr, size_t size);
+void __asan_set_shadow_f3(const void *addr, size_t size);
+void __asan_set_shadow_f5(const void *addr, size_t size);
+void __asan_set_shadow_f8(const void *addr, size_t size);
+
 #endif
_

Patches currently in -mm which might be from arnd@xxxxxxxx are

mm-thp-use-down_read_trylock-in-khugepaged-to-avoid-long-block-fix-2.patch
kasan-added-functions-for-unpoisoning-stack-variables-fix-fix.patch
bugh-work-around-gcc-pr82365-in-bug.patch
kasan-rework-kconfig-settings.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux