2020-05-12 06:39:21

by Leon Romanovsky

[permalink] [raw]
Subject: [PATCH rdma-next 0/2] 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


2020-05-12 06:39:26

by Leon Romanovsky

[permalink] [raw]
Subject: [PATCH rdma-next 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")
Signed-off-by: Leon Romanovsky <[email protected]>
---
mm/kasan/kasan.h | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h
index e8f37199d885..d428e588c700 100644
--- a/mm/kasan/kasan.h
+++ b/mm/kasan/kasan.h
@@ -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

2020-05-12 06:40:12

by Leon Romanovsky

[permalink] [raw]
Subject: [PATCH rdma-next 2/2] kasan: add missing prototypes to fix compilation warnings

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")
Signed-off-by: Leon Romanovsky <[email protected]>
---
mm/kasan/common.c | 3 ---
mm/kasan/kasan.h | 3 +++
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/mm/kasan/common.c b/mm/kasan/common.c
index 2906358e42f0..cbb119224330 100644
--- a/mm/kasan/common.c
+++ b/mm/kasan/common.c
@@ -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();
diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h
index d428e588c700..02d54a1d0b2d 100644
--- a/mm/kasan/kasan.h
+++ b/mm/kasan/kasan.h
@@ -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

2020-05-12 10:13:04

by Leon Romanovsky

[permalink] [raw]
Subject: Re: [PATCH rdma-next 0/2] Fix kasan compilation warnings

On Tue, May 12, 2020 at 09:37:26AM +0300, Leon Romanovsky wrote:
> 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

>
> 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
>
>

2020-05-12 15:37:43

by Andrey Konovalov

[permalink] [raw]
Subject: Re: [PATCH rdma-next 0/2] Fix kasan compilation warnings

On Tue, May 12, 2020 at 8:37 AM Leon Romanovsky <[email protected]> wrote:
>
> 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

Hi Leon,

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

Thanks for the report!

>
> 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.

2020-05-12 16:13:48

by Leon Romanovsky

[permalink] [raw]
Subject: Re: [PATCH rdma-next 0/2] Fix kasan compilation warnings

On Tue, May 12, 2020 at 05:34:10PM +0200, Andrey Konovalov wrote:
> On Tue, May 12, 2020 at 8:37 AM Leon Romanovsky <[email protected]> wrote:
> >
> > 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
>
> 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.