Skip to contentSkip to conversation

Fix kasan compilation warnings

PATCH In review Leon Romanovsky 3 participants 6 messages May 12, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Fix kasan compilation warnings

From: Leon Romanovsky <[email protected]>

Hi,

The following two fixes are adding missing function prototypes declarations to internal kasan header in order to eliminate compilation warnings.

Thanks

Leon Romanovsky (2):
kasan: fix compilation warnings due to missing function prototypes
kasan: add missing prototypes to fix compilation warnings

 mm/kasan/common.c |  3 ---
 mm/kasan/kasan.h  | 15 +++++++++++++++
 2 files changed, 15 insertions(+), 3 deletions(-)

--
2.26.2

#1 lore raw

PATCH 1/2 kasan: fix compilation warnings due to missing function prototypes

From: Leon Romanovsky <[email protected]>

__asan_report_* function generates the following warnings while compiling kernel, add them to the internal header to be aligned with other __asan_* function prototypes.

mm/kasan/generic_report.c:130:6: warning: no previous prototype for '__asan_report_load1_noabort' [-Wmissing-prototypes]

  130 | void __asan_report_load##size##_noabort(unsigned long addr) \
      |      ^~~~~~~~~~~~~~~~~~
mm/kasan/generic_report.c:143:1: note: in expansion of macro 'DEFINE_ASAN_REPORT_LOAD'
  143 | DEFINE_ASAN_REPORT_LOAD(1);
      | ^~~~~~~~~~~~~~~~~~~~~~~

<...>

mm/kasan/generic_report.c:137:6: warning: no previous prototype for '__asan_report_store1_noabort' [-Wmissing-prototypes]

  137 | void __asan_report_store##size##_noabort(unsigned long addr) \
      |      ^~~~~~~~~~~~~~~~~~~
mm/kasan/generic_report.c:148:1: note: in expansion of macro 'DEFINE_ASAN_REPORT_STORE'
  148 | DEFINE_ASAN_REPORT_STORE(1);
      | ^~~~~~~~~~~~~~~~~~~~~~~~
Fixes 0b24becc810d ("kasan: add kernel address sanitizer infrastructure")
---
 mm/kasan/kasan.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)
mm/kasan/kasan.h +12 -0
index e8f37199d885..d428e588c700 100644
@@ -230,15 +230,27 @@ void __asan_load16(unsigned long addr);
 void __asan_store16(unsigned long addr);
 
 void __asan_load1_noabort(unsigned long addr);
+void __asan_report_load1_noabort(unsigned long addr);
 void __asan_store1_noabort(unsigned long addr);
+void __asan_report_store1_noabort(unsigned long addr);
 void __asan_load2_noabort(unsigned long addr);
+void __asan_report_load2_noabort(unsigned long addr);
 void __asan_store2_noabort(unsigned long addr);
+void __asan_report_store2_noabort(unsigned long addr);
 void __asan_load4_noabort(unsigned long addr);
+void __asan_report_load4_noabort(unsigned long addr);
 void __asan_store4_noabort(unsigned long addr);
+void __asan_report_store4_noabort(unsigned long addr);
 void __asan_load8_noabort(unsigned long addr);
+void __asan_report_load8_noabort(unsigned long addr);
 void __asan_store8_noabort(unsigned long addr);
+void __asan_report_store8_noabort(unsigned long addr);
 void __asan_load16_noabort(unsigned long addr);
+void __asan_report_load16_noabort(unsigned long addr);
 void __asan_store16_noabort(unsigned long addr);
+void __asan_report_store16_noabort(unsigned long addr);
+void __asan_report_load_n_noabort(unsigned long addr, size_t size);
+void __asan_report_store_n_noabort(unsigned long addr, size_t size);
 
 void __asan_set_shadow_00(const void *addr, size_t size);
 void __asan_set_shadow_f1(const void *addr, size_t size);

--
2.26.2

#2 lore raw

PATCH 2/2 kasan: add missing prototypes to fix compilation warnings

In reply to Leon Romanovsky

From: Leon Romanovsky <[email protected]>

Use internal kasan header to declare missing prototypes to fix the following compilation warnings.

mm/kasan/report.c:457:6: warning: no previous prototype for 'report_enabled' [-Wmissing-prototypes]
457 | bool report_enabled(void)

      |      ^~~~~~~~~~~~~~
mm/kasan/report.c:482:6: warning: no previous prototype for '__kasan_report' [-Wmissing-prototypes]
  482 | void __kasan_report(unsigned long addr, size_t size, bool is_write, unsigned long ip)
      |      ^~~~~~~~~~~~~~
Fixes 57b78a62e7f2 ("x86/uaccess, kasan: Fix KASAN vs SMAP")
---
 mm/kasan/common.c | 3 ---
 mm/kasan/kasan.h  | 3 +++
 2 files changed, 3 insertions(+), 3 deletions(-)
mm/kasan/common.c +0 -3
index 2906358e42f0..cbb119224330 100644
@@ -613,9 +613,6 @@ void kasan_free_shadow(const struct vm_struct *vm)
 }
 #endif
 
-extern void __kasan_report(unsigned long addr, size_t size, bool is_write, unsigned long ip);
-extern bool report_enabled(void);
-
 bool kasan_report(unsigned long addr, size_t size, bool is_write, unsigned long ip)
 {
 	unsigned long flags = user_access_save();
mm/kasan/kasan.h +3 -0
index d428e588c700..02d54a1d0b2d 100644
@@ -153,6 +153,9 @@ bool check_memory_region(unsigned long addr, size_t size, bool write,
 void *find_first_bad_addr(void *addr, size_t size);
 const char *get_bug_type(struct kasan_access_info *info);
 
+bool report_enabled(void);
+void __kasan_report(unsigned long addr, size_t size, bool is_write,
+		    unsigned long ip);
 bool kasan_report(unsigned long addr, size_t size,
 		bool is_write, unsigned long ip);
 void kasan_report_invalid_free(void *object, unsigned long ip);

--
2.26.2

#3 lore raw
In reply to Leon Romanovsky
Quoted 9 lines · Leon Romanovsky

From: Leon Romanovsky <[email protected]>

Hi,

The following two fixes are adding missing function prototypes declarations to internal kasan header in order to eliminate compilation warnings.

Thanks

Sorry for forgetting to clean subject, the patches are not "rdma-next" but MM related.

Thanks

Quoted 13 lines

Leon Romanovsky (2):
kasan: fix compilation warnings due to missing function prototypes
kasan: add missing prototypes to fix compilation warnings

 mm/kasan/common.c |  3 ---
 mm/kasan/kasan.h  | 15 +++++++++++++++
 2 files changed, 15 insertions(+), 3 deletions(-)

--
2.26.2

#4 lore raw
In reply to Leon Romanovsky
Quoted 9 lines · Leon Romanovsky

From: Leon Romanovsky <[email protected]>

Hi,

The following two fixes are adding missing function prototypes declarations to internal kasan header in order to eliminate compilation warnings.

Quoted 5 lines

Thanks

Leon Romanovsky (2):
kasan: fix compilation warnings due to missing function prototypes
kasan: add missing prototypes to fix compilation warnings

Hi Leon,

I've mailed a series with slightly different/fuller fixes for these issues.

Thanks for the report!

Quoted 12 lines
 mm/kasan/common.c |  3 ---
 mm/kasan/kasan.h  | 15 +++++++++++++++
 2 files changed, 15 insertions(+), 3 deletions(-)

--
2.26.2

--
You received this message because you are subscribed to the Google Groups "kasan-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/kasan-dev/20200512063728.17785-1-leon%40kernel.org.

#5 lore raw
Quoted 16 lines · Andrey Konovalov
Quoted 9 lines · Leon Romanovsky

From: Leon Romanovsky <[email protected]>

Hi,

The following two fixes are adding missing function prototypes declarations to internal kasan header in order to eliminate compilation warnings.

Quoted 5 lines

Thanks

Leon Romanovsky (2):
kasan: fix compilation warnings due to missing function prototypes
kasan: add missing prototypes to fix compilation warnings

Quoted 5 lines

Hi Leon,

I've mailed a series with slightly different/fuller fixes for these issues.

Thanks for the report!

No problem, thanks for taking care.