* [PATCH] arm64: kasan: add interceptors for strcmp/strncmp functions
@ 2018-08-17 8:37 ` Kyeongdon Kim
0 siblings, 0 replies; 7+ messages in thread
From: Kyeongdon Kim @ 2018-08-17 8:37 UTC (permalink / raw)
To: aryabinin, catalin.marinas, will.deacon, glider, dvyukov
Cc: Jason, robh, ard.biesheuvel, linux-arm-kernel, linux-kernel,
kasan-dev, linux-mm, kyeongdon.kim
This patch declares strcmp/strncmp as weak symbols.
(2 of them are the most used string operations)
Original functions declared as weak symbols and
strong ones in mm/kasan/kasan.c could replace them.
Assembly optimized strcmp/strncmp functions cannot detect KASan bug.
But, now we can detect them.
==================================================================
BUG: KASAN: use-after-free in platform_match+0x1c/0x5c at addr ffffffc0ad313500
Read of size 1 by task swapper/0/1
CPU: 3 PID: 1 Comm: swapper/0 Tainted: G B 4.9.77+ #1
Hardware name: Generic (DT) based system
Call trace:
dump_backtrace+0x0/0x2e0
show_stack+0x14/0x1c
dump_stack+0x88/0xb0
kasan_object_err+0x24/0x7c
kasan_report+0x2f0/0x484
check_memory_region+0x20/0x14c
strcmp+0x1c/0x5c
platform_match+0x40/0xe4
__driver_attach+0x40/0x130
bus_for_each_dev+0xc4/0xe0
driver_attach+0x30/0x3c
bus_add_driver+0x2dc/0x328
driver_register+0x118/0x160
__platform_driver_register+0x7c/0x88
alarmtimer_init+0x154/0x1e4
do_one_initcall+0x184/0x1a4
kernel_init_freeable+0x2ec/0x2f0
kernel_init+0x18/0x10c
ret_from_fork+0x10/0x50
Signed-off-by: Kyeongdon Kim <kyeongdon.kim@lge.com>
---
arch/arm64/include/asm/string.h | 4 ++++
arch/arm64/kernel/arm64ksyms.c | 2 ++
arch/arm64/kernel/image.h | 2 ++
arch/arm64/lib/strcmp.S | 3 +++
arch/arm64/lib/strncmp.S | 3 +++
mm/kasan/kasan.c | 15 +++++++++++++++
6 files changed, 29 insertions(+)
diff --git a/arch/arm64/include/asm/string.h b/arch/arm64/include/asm/string.h
index dd95d33..d546605 100644
--- a/arch/arm64/include/asm/string.h
+++ b/arch/arm64/include/asm/string.h
@@ -24,9 +24,11 @@ extern char *strchr(const char *, int c);
#define __HAVE_ARCH_STRCMP
extern int strcmp(const char *, const char *);
+extern int __strcmp(const char *, const char *);
#define __HAVE_ARCH_STRNCMP
extern int strncmp(const char *, const char *, __kernel_size_t);
+extern int __strncmp(const char *, const char *, __kernel_size_t);
#define __HAVE_ARCH_STRLEN
extern __kernel_size_t strlen(const char *);
@@ -67,6 +69,8 @@ void memcpy_flushcache(void *dst, const void *src, size_t cnt);
#define memcpy(dst, src, len) __memcpy(dst, src, len)
#define memmove(dst, src, len) __memmove(dst, src, len)
#define memset(s, c, n) __memset(s, c, n)
+#define strcmp(cs, ct) __strcmp(cs, ct)
+#define strncmp(cs, ct, n) __strncmp(cs, ct, n)
#ifndef __NO_FORTIFY
#define __NO_FORTIFY /* FORTIFY_SOURCE uses __builtin_memcpy, etc. */
diff --git a/arch/arm64/kernel/arm64ksyms.c b/arch/arm64/kernel/arm64ksyms.c
index d894a20..10b1164 100644
--- a/arch/arm64/kernel/arm64ksyms.c
+++ b/arch/arm64/kernel/arm64ksyms.c
@@ -50,6 +50,8 @@ EXPORT_SYMBOL(strcmp);
EXPORT_SYMBOL(strncmp);
EXPORT_SYMBOL(strlen);
EXPORT_SYMBOL(strnlen);
+EXPORT_SYMBOL(__strcmp);
+EXPORT_SYMBOL(__strncmp);
EXPORT_SYMBOL(memset);
EXPORT_SYMBOL(memcpy);
EXPORT_SYMBOL(memmove);
diff --git a/arch/arm64/kernel/image.h b/arch/arm64/kernel/image.h
index a820ed0..5ef7a57 100644
--- a/arch/arm64/kernel/image.h
+++ b/arch/arm64/kernel/image.h
@@ -110,6 +110,8 @@ __efistub___flush_dcache_area = KALLSYMS_HIDE(__pi___flush_dcache_area);
__efistub___memcpy = KALLSYMS_HIDE(__pi_memcpy);
__efistub___memmove = KALLSYMS_HIDE(__pi_memmove);
__efistub___memset = KALLSYMS_HIDE(__pi_memset);
+__efistub___strcmp = KALLSYMS_HIDE(__pi_strcmp);
+__efistub___strncmp = KALLSYMS_HIDE(__pi_strncmp);
#endif
__efistub__text = KALLSYMS_HIDE(_text);
diff --git a/arch/arm64/lib/strcmp.S b/arch/arm64/lib/strcmp.S
index 471fe61..0dffef7 100644
--- a/arch/arm64/lib/strcmp.S
+++ b/arch/arm64/lib/strcmp.S
@@ -60,6 +60,8 @@ tmp3 .req x9
zeroones .req x10
pos .req x11
+.weak strcmp
+ENTRY(__strcmp)
ENTRY(strcmp)
eor tmp1, src1, src2
mov zeroones, #REP8_01
@@ -232,3 +234,4 @@ CPU_BE( orr syndrome, diff, has_nul )
sub result, data1, data2, lsr #56
ret
ENDPIPROC(strcmp)
+ENDPROC(__strcmp)
diff --git a/arch/arm64/lib/strncmp.S b/arch/arm64/lib/strncmp.S
index e267044..b2648c7 100644
--- a/arch/arm64/lib/strncmp.S
+++ b/arch/arm64/lib/strncmp.S
@@ -64,6 +64,8 @@ limit_wd .req x13
mask .req x14
endloop .req x15
+.weak strncmp
+ENTRY(__strncmp)
ENTRY(strncmp)
cbz limit, .Lret0
eor tmp1, src1, src2
@@ -308,3 +310,4 @@ CPU_BE( orr syndrome, diff, has_nul )
mov result, #0
ret
ENDPIPROC(strncmp)
+ENDPROC(__strncmp)
diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan.c
index c3bd520..eae43e6 100644
--- a/mm/kasan/kasan.c
+++ b/mm/kasan/kasan.c
@@ -304,7 +304,22 @@ void *memcpy(void *dest, const void *src, size_t len)
return __memcpy(dest, src, len);
}
+#undef strcmp
+int strcmp(const char *cs, const char *ct)
+{
+ check_memory_region((unsigned long)cs, 1, false, _RET_IP_);
+ check_memory_region((unsigned long)ct, 1, false, _RET_IP_);
+ return __strcmp(cs, ct);
+}
+#undef strncmp
+int strncmp(const char *cs, const char *ct, size_t len)
+{
+ check_memory_region((unsigned long)cs, len, false, _RET_IP_);
+ check_memory_region((unsigned long)ct, len, false, _RET_IP_);
+
+ return __strncmp(cs, ct, len);
+}
void kasan_alloc_pages(struct page *page, unsigned int order)
{
if (likely(!PageHighMem(page)))
--
2.6.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH] arm64: kasan: add interceptors for strcmp/strncmp functions
@ 2018-08-17 8:37 ` Kyeongdon Kim
0 siblings, 0 replies; 7+ messages in thread
From: Kyeongdon Kim @ 2018-08-17 8:37 UTC (permalink / raw)
To: linux-arm-kernel
This patch declares strcmp/strncmp as weak symbols.
(2 of them are the most used string operations)
Original functions declared as weak symbols and
strong ones in mm/kasan/kasan.c could replace them.
Assembly optimized strcmp/strncmp functions cannot detect KASan bug.
But, now we can detect them.
==================================================================
BUG: KASAN: use-after-free in platform_match+0x1c/0x5c at addr ffffffc0ad313500
Read of size 1 by task swapper/0/1
CPU: 3 PID: 1 Comm: swapper/0 Tainted: G B 4.9.77+ #1
Hardware name: Generic (DT) based system
Call trace:
dump_backtrace+0x0/0x2e0
show_stack+0x14/0x1c
dump_stack+0x88/0xb0
kasan_object_err+0x24/0x7c
kasan_report+0x2f0/0x484
check_memory_region+0x20/0x14c
strcmp+0x1c/0x5c
platform_match+0x40/0xe4
__driver_attach+0x40/0x130
bus_for_each_dev+0xc4/0xe0
driver_attach+0x30/0x3c
bus_add_driver+0x2dc/0x328
driver_register+0x118/0x160
__platform_driver_register+0x7c/0x88
alarmtimer_init+0x154/0x1e4
do_one_initcall+0x184/0x1a4
kernel_init_freeable+0x2ec/0x2f0
kernel_init+0x18/0x10c
ret_from_fork+0x10/0x50
Signed-off-by: Kyeongdon Kim <kyeongdon.kim@lge.com>
---
arch/arm64/include/asm/string.h | 4 ++++
arch/arm64/kernel/arm64ksyms.c | 2 ++
arch/arm64/kernel/image.h | 2 ++
arch/arm64/lib/strcmp.S | 3 +++
arch/arm64/lib/strncmp.S | 3 +++
mm/kasan/kasan.c | 15 +++++++++++++++
6 files changed, 29 insertions(+)
diff --git a/arch/arm64/include/asm/string.h b/arch/arm64/include/asm/string.h
index dd95d33..d546605 100644
--- a/arch/arm64/include/asm/string.h
+++ b/arch/arm64/include/asm/string.h
@@ -24,9 +24,11 @@ extern char *strchr(const char *, int c);
#define __HAVE_ARCH_STRCMP
extern int strcmp(const char *, const char *);
+extern int __strcmp(const char *, const char *);
#define __HAVE_ARCH_STRNCMP
extern int strncmp(const char *, const char *, __kernel_size_t);
+extern int __strncmp(const char *, const char *, __kernel_size_t);
#define __HAVE_ARCH_STRLEN
extern __kernel_size_t strlen(const char *);
@@ -67,6 +69,8 @@ void memcpy_flushcache(void *dst, const void *src, size_t cnt);
#define memcpy(dst, src, len) __memcpy(dst, src, len)
#define memmove(dst, src, len) __memmove(dst, src, len)
#define memset(s, c, n) __memset(s, c, n)
+#define strcmp(cs, ct) __strcmp(cs, ct)
+#define strncmp(cs, ct, n) __strncmp(cs, ct, n)
#ifndef __NO_FORTIFY
#define __NO_FORTIFY /* FORTIFY_SOURCE uses __builtin_memcpy, etc. */
diff --git a/arch/arm64/kernel/arm64ksyms.c b/arch/arm64/kernel/arm64ksyms.c
index d894a20..10b1164 100644
--- a/arch/arm64/kernel/arm64ksyms.c
+++ b/arch/arm64/kernel/arm64ksyms.c
@@ -50,6 +50,8 @@ EXPORT_SYMBOL(strcmp);
EXPORT_SYMBOL(strncmp);
EXPORT_SYMBOL(strlen);
EXPORT_SYMBOL(strnlen);
+EXPORT_SYMBOL(__strcmp);
+EXPORT_SYMBOL(__strncmp);
EXPORT_SYMBOL(memset);
EXPORT_SYMBOL(memcpy);
EXPORT_SYMBOL(memmove);
diff --git a/arch/arm64/kernel/image.h b/arch/arm64/kernel/image.h
index a820ed0..5ef7a57 100644
--- a/arch/arm64/kernel/image.h
+++ b/arch/arm64/kernel/image.h
@@ -110,6 +110,8 @@ __efistub___flush_dcache_area = KALLSYMS_HIDE(__pi___flush_dcache_area);
__efistub___memcpy = KALLSYMS_HIDE(__pi_memcpy);
__efistub___memmove = KALLSYMS_HIDE(__pi_memmove);
__efistub___memset = KALLSYMS_HIDE(__pi_memset);
+__efistub___strcmp = KALLSYMS_HIDE(__pi_strcmp);
+__efistub___strncmp = KALLSYMS_HIDE(__pi_strncmp);
#endif
__efistub__text = KALLSYMS_HIDE(_text);
diff --git a/arch/arm64/lib/strcmp.S b/arch/arm64/lib/strcmp.S
index 471fe61..0dffef7 100644
--- a/arch/arm64/lib/strcmp.S
+++ b/arch/arm64/lib/strcmp.S
@@ -60,6 +60,8 @@ tmp3 .req x9
zeroones .req x10
pos .req x11
+.weak strcmp
+ENTRY(__strcmp)
ENTRY(strcmp)
eor tmp1, src1, src2
mov zeroones, #REP8_01
@@ -232,3 +234,4 @@ CPU_BE( orr syndrome, diff, has_nul )
sub result, data1, data2, lsr #56
ret
ENDPIPROC(strcmp)
+ENDPROC(__strcmp)
diff --git a/arch/arm64/lib/strncmp.S b/arch/arm64/lib/strncmp.S
index e267044..b2648c7 100644
--- a/arch/arm64/lib/strncmp.S
+++ b/arch/arm64/lib/strncmp.S
@@ -64,6 +64,8 @@ limit_wd .req x13
mask .req x14
endloop .req x15
+.weak strncmp
+ENTRY(__strncmp)
ENTRY(strncmp)
cbz limit, .Lret0
eor tmp1, src1, src2
@@ -308,3 +310,4 @@ CPU_BE( orr syndrome, diff, has_nul )
mov result, #0
ret
ENDPIPROC(strncmp)
+ENDPROC(__strncmp)
diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan.c
index c3bd520..eae43e6 100644
--- a/mm/kasan/kasan.c
+++ b/mm/kasan/kasan.c
@@ -304,7 +304,22 @@ void *memcpy(void *dest, const void *src, size_t len)
return __memcpy(dest, src, len);
}
+#undef strcmp
+int strcmp(const char *cs, const char *ct)
+{
+ check_memory_region((unsigned long)cs, 1, false, _RET_IP_);
+ check_memory_region((unsigned long)ct, 1, false, _RET_IP_);
+ return __strcmp(cs, ct);
+}
+#undef strncmp
+int strncmp(const char *cs, const char *ct, size_t len)
+{
+ check_memory_region((unsigned long)cs, len, false, _RET_IP_);
+ check_memory_region((unsigned long)ct, len, false, _RET_IP_);
+
+ return __strncmp(cs, ct, len);
+}
void kasan_alloc_pages(struct page *page, unsigned int order)
{
if (likely(!PageHighMem(page)))
--
2.6.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] arm64: kasan: add interceptors for strcmp/strncmp functions
2018-08-17 8:37 ` Kyeongdon Kim
(?)
@ 2018-08-17 9:34 ` kbuild test robot
-1 siblings, 0 replies; 7+ messages in thread
From: kbuild test robot @ 2018-08-17 9:34 UTC (permalink / raw)
To: Kyeongdon Kim
Cc: kbuild-all, aryabinin, catalin.marinas, will.deacon, glider,
dvyukov, Jason, robh, ard.biesheuvel, linux-arm-kernel,
linux-kernel, kasan-dev, linux-mm, kyeongdon.kim
[-- Attachment #1: Type: text/plain, Size: 2535 bytes --]
Hi Kyeongdon,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on arm64/for-next/core]
[also build test ERROR on v4.18 next-20180817]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Kyeongdon-Kim/arm64-kasan-add-interceptors-for-strcmp-strncmp-functions/20180817-165304
base: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core
config: x86_64-randconfig-x012-201832 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All errors (new ones prefixed by >>):
mm/kasan/kasan.c: In function 'strcmp':
>> mm/kasan/kasan.c:313:9: error: implicit declaration of function '__strcmp'; did you mean 'strcmp'? [-Werror=implicit-function-declaration]
return __strcmp(cs, ct);
^~~~~~~~
strcmp
mm/kasan/kasan.c: In function 'strncmp':
>> mm/kasan/kasan.c:321:9: error: implicit declaration of function '__strncmp'; did you mean 'strncmp'? [-Werror=implicit-function-declaration]
return __strncmp(cs, ct, len);
^~~~~~~~~
strncmp
cc1: some warnings being treated as errors
vim +313 mm/kasan/kasan.c
298
299 #undef memcpy
300 void *memcpy(void *dest, const void *src, size_t len)
301 {
302 check_memory_region((unsigned long)src, len, false, _RET_IP_);
303 check_memory_region((unsigned long)dest, len, true, _RET_IP_);
304
305 return __memcpy(dest, src, len);
306 }
307 #undef strcmp
308 int strcmp(const char *cs, const char *ct)
309 {
310 check_memory_region((unsigned long)cs, 1, false, _RET_IP_);
311 check_memory_region((unsigned long)ct, 1, false, _RET_IP_);
312
> 313 return __strcmp(cs, ct);
314 }
315 #undef strncmp
316 int strncmp(const char *cs, const char *ct, size_t len)
317 {
318 check_memory_region((unsigned long)cs, len, false, _RET_IP_);
319 check_memory_region((unsigned long)ct, len, false, _RET_IP_);
320
> 321 return __strncmp(cs, ct, len);
322 }
323 void kasan_alloc_pages(struct page *page, unsigned int order)
324 {
325 if (likely(!PageHighMem(page)))
326 kasan_unpoison_shadow(page_address(page), PAGE_SIZE << order);
327 }
328
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 29183 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] arm64: kasan: add interceptors for strcmp/strncmp functions
@ 2018-08-17 9:34 ` kbuild test robot
0 siblings, 0 replies; 7+ messages in thread
From: kbuild test robot @ 2018-08-17 9:34 UTC (permalink / raw)
To: Kyeongdon Kim
Cc: kbuild-all, aryabinin, catalin.marinas, will.deacon, glider,
dvyukov, Jason, robh, ard.biesheuvel, linux-arm-kernel,
linux-kernel, kasan-dev, linux-mm
[-- Attachment #1: Type: text/plain, Size: 2535 bytes --]
Hi Kyeongdon,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on arm64/for-next/core]
[also build test ERROR on v4.18 next-20180817]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Kyeongdon-Kim/arm64-kasan-add-interceptors-for-strcmp-strncmp-functions/20180817-165304
base: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core
config: x86_64-randconfig-x012-201832 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All errors (new ones prefixed by >>):
mm/kasan/kasan.c: In function 'strcmp':
>> mm/kasan/kasan.c:313:9: error: implicit declaration of function '__strcmp'; did you mean 'strcmp'? [-Werror=implicit-function-declaration]
return __strcmp(cs, ct);
^~~~~~~~
strcmp
mm/kasan/kasan.c: In function 'strncmp':
>> mm/kasan/kasan.c:321:9: error: implicit declaration of function '__strncmp'; did you mean 'strncmp'? [-Werror=implicit-function-declaration]
return __strncmp(cs, ct, len);
^~~~~~~~~
strncmp
cc1: some warnings being treated as errors
vim +313 mm/kasan/kasan.c
298
299 #undef memcpy
300 void *memcpy(void *dest, const void *src, size_t len)
301 {
302 check_memory_region((unsigned long)src, len, false, _RET_IP_);
303 check_memory_region((unsigned long)dest, len, true, _RET_IP_);
304
305 return __memcpy(dest, src, len);
306 }
307 #undef strcmp
308 int strcmp(const char *cs, const char *ct)
309 {
310 check_memory_region((unsigned long)cs, 1, false, _RET_IP_);
311 check_memory_region((unsigned long)ct, 1, false, _RET_IP_);
312
> 313 return __strcmp(cs, ct);
314 }
315 #undef strncmp
316 int strncmp(const char *cs, const char *ct, size_t len)
317 {
318 check_memory_region((unsigned long)cs, len, false, _RET_IP_);
319 check_memory_region((unsigned long)ct, len, false, _RET_IP_);
320
> 321 return __strncmp(cs, ct, len);
322 }
323 void kasan_alloc_pages(struct page *page, unsigned int order)
324 {
325 if (likely(!PageHighMem(page)))
326 kasan_unpoison_shadow(page_address(page), PAGE_SIZE << order);
327 }
328
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 29183 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] arm64: kasan: add interceptors for strcmp/strncmp functions
@ 2018-08-17 9:34 ` kbuild test robot
0 siblings, 0 replies; 7+ messages in thread
From: kbuild test robot @ 2018-08-17 9:34 UTC (permalink / raw)
To: linux-arm-kernel
Hi Kyeongdon,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on arm64/for-next/core]
[also build test ERROR on v4.18 next-20180817]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Kyeongdon-Kim/arm64-kasan-add-interceptors-for-strcmp-strncmp-functions/20180817-165304
base: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core
config: x86_64-randconfig-x012-201832 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All errors (new ones prefixed by >>):
mm/kasan/kasan.c: In function 'strcmp':
>> mm/kasan/kasan.c:313:9: error: implicit declaration of function '__strcmp'; did you mean 'strcmp'? [-Werror=implicit-function-declaration]
return __strcmp(cs, ct);
^~~~~~~~
strcmp
mm/kasan/kasan.c: In function 'strncmp':
>> mm/kasan/kasan.c:321:9: error: implicit declaration of function '__strncmp'; did you mean 'strncmp'? [-Werror=implicit-function-declaration]
return __strncmp(cs, ct, len);
^~~~~~~~~
strncmp
cc1: some warnings being treated as errors
vim +313 mm/kasan/kasan.c
298
299 #undef memcpy
300 void *memcpy(void *dest, const void *src, size_t len)
301 {
302 check_memory_region((unsigned long)src, len, false, _RET_IP_);
303 check_memory_region((unsigned long)dest, len, true, _RET_IP_);
304
305 return __memcpy(dest, src, len);
306 }
307 #undef strcmp
308 int strcmp(const char *cs, const char *ct)
309 {
310 check_memory_region((unsigned long)cs, 1, false, _RET_IP_);
311 check_memory_region((unsigned long)ct, 1, false, _RET_IP_);
312
> 313 return __strcmp(cs, ct);
314 }
315 #undef strncmp
316 int strncmp(const char *cs, const char *ct, size_t len)
317 {
318 check_memory_region((unsigned long)cs, len, false, _RET_IP_);
319 check_memory_region((unsigned long)ct, len, false, _RET_IP_);
320
> 321 return __strncmp(cs, ct, len);
322 }
323 void kasan_alloc_pages(struct page *page, unsigned int order)
324 {
325 if (likely(!PageHighMem(page)))
326 kasan_unpoison_shadow(page_address(page), PAGE_SIZE << order);
327 }
328
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 29183 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180817/a1e2e75a/attachment-0001.gz>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] arm64: kasan: add interceptors for strcmp/strncmp functions
2018-08-17 8:37 ` Kyeongdon Kim
@ 2018-08-17 10:40 ` kbuild test robot
-1 siblings, 0 replies; 7+ messages in thread
From: kbuild test robot @ 2018-08-17 10:40 UTC (permalink / raw)
To: Kyeongdon Kim
Cc: kbuild-all, aryabinin, catalin.marinas, will.deacon, glider,
dvyukov, Jason, robh, ard.biesheuvel, linux-arm-kernel,
linux-kernel, kasan-dev, linux-mm
[-- Attachment #1: Type: text/plain, Size: 3884 bytes --]
Hi Kyeongdon,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on arm64/for-next/core]
[also build test ERROR on v4.18 next-20180817]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Kyeongdon-Kim/arm64-kasan-add-interceptors-for-strcmp-strncmp-functions/20180817-165304
base: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core
config: xtensa-allmodconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 8.1.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=8.1.0 make.cross ARCH=xtensa
All errors (new ones prefixed by >>):
>> mm/kasan/kasan.c:308:5: error: redefinition of 'strcmp'
int strcmp(const char *cs, const char *ct)
^~~~~~
In file included from include/linux/string.h:20,
from include/linux/bitmap.h:9,
from include/linux/cpumask.h:12,
from include/linux/interrupt.h:8,
from mm/kasan/kasan.c:20:
arch/xtensa/include/asm/string.h:63:19: note: previous definition of 'strcmp' was here
static inline int strcmp(const char *__cs, const char *__ct)
^~~~~~
mm/kasan/kasan.c: In function 'strcmp':
mm/kasan/kasan.c:313:9: error: implicit declaration of function '__strcmp'; did you mean 'strcmp'? [-Werror=implicit-function-declaration]
return __strcmp(cs, ct);
^~~~~~~~
strcmp
mm/kasan/kasan.c: At top level:
>> mm/kasan/kasan.c:316:5: error: redefinition of 'strncmp'
int strncmp(const char *cs, const char *ct, size_t len)
^~~~~~~
In file included from include/linux/string.h:20,
from include/linux/bitmap.h:9,
from include/linux/cpumask.h:12,
from include/linux/interrupt.h:8,
from mm/kasan/kasan.c:20:
arch/xtensa/include/asm/string.h:85:19: note: previous definition of 'strncmp' was here
static inline int strncmp(const char *__cs, const char *__ct, size_t __n)
^~~~~~~
mm/kasan/kasan.c: In function 'strncmp':
mm/kasan/kasan.c:321:9: error: implicit declaration of function '__strncmp'; did you mean 'strncmp'? [-Werror=implicit-function-declaration]
return __strncmp(cs, ct, len);
^~~~~~~~~
strncmp
cc1: some warnings being treated as errors
vim +/strcmp +308 mm/kasan/kasan.c
298
299 #undef memcpy
300 void *memcpy(void *dest, const void *src, size_t len)
301 {
302 check_memory_region((unsigned long)src, len, false, _RET_IP_);
303 check_memory_region((unsigned long)dest, len, true, _RET_IP_);
304
305 return __memcpy(dest, src, len);
306 }
307 #undef strcmp
> 308 int strcmp(const char *cs, const char *ct)
309 {
310 check_memory_region((unsigned long)cs, 1, false, _RET_IP_);
311 check_memory_region((unsigned long)ct, 1, false, _RET_IP_);
312
> 313 return __strcmp(cs, ct);
314 }
315 #undef strncmp
> 316 int strncmp(const char *cs, const char *ct, size_t len)
317 {
318 check_memory_region((unsigned long)cs, len, false, _RET_IP_);
319 check_memory_region((unsigned long)ct, len, false, _RET_IP_);
320
321 return __strncmp(cs, ct, len);
322 }
323 void kasan_alloc_pages(struct page *page, unsigned int order)
324 {
325 if (likely(!PageHighMem(page)))
326 kasan_unpoison_shadow(page_address(page), PAGE_SIZE << order);
327 }
328
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 54028 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] arm64: kasan: add interceptors for strcmp/strncmp functions
@ 2018-08-17 10:40 ` kbuild test robot
0 siblings, 0 replies; 7+ messages in thread
From: kbuild test robot @ 2018-08-17 10:40 UTC (permalink / raw)
To: linux-arm-kernel
Hi Kyeongdon,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on arm64/for-next/core]
[also build test ERROR on v4.18 next-20180817]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Kyeongdon-Kim/arm64-kasan-add-interceptors-for-strcmp-strncmp-functions/20180817-165304
base: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core
config: xtensa-allmodconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 8.1.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=8.1.0 make.cross ARCH=xtensa
All errors (new ones prefixed by >>):
>> mm/kasan/kasan.c:308:5: error: redefinition of 'strcmp'
int strcmp(const char *cs, const char *ct)
^~~~~~
In file included from include/linux/string.h:20,
from include/linux/bitmap.h:9,
from include/linux/cpumask.h:12,
from include/linux/interrupt.h:8,
from mm/kasan/kasan.c:20:
arch/xtensa/include/asm/string.h:63:19: note: previous definition of 'strcmp' was here
static inline int strcmp(const char *__cs, const char *__ct)
^~~~~~
mm/kasan/kasan.c: In function 'strcmp':
mm/kasan/kasan.c:313:9: error: implicit declaration of function '__strcmp'; did you mean 'strcmp'? [-Werror=implicit-function-declaration]
return __strcmp(cs, ct);
^~~~~~~~
strcmp
mm/kasan/kasan.c: At top level:
>> mm/kasan/kasan.c:316:5: error: redefinition of 'strncmp'
int strncmp(const char *cs, const char *ct, size_t len)
^~~~~~~
In file included from include/linux/string.h:20,
from include/linux/bitmap.h:9,
from include/linux/cpumask.h:12,
from include/linux/interrupt.h:8,
from mm/kasan/kasan.c:20:
arch/xtensa/include/asm/string.h:85:19: note: previous definition of 'strncmp' was here
static inline int strncmp(const char *__cs, const char *__ct, size_t __n)
^~~~~~~
mm/kasan/kasan.c: In function 'strncmp':
mm/kasan/kasan.c:321:9: error: implicit declaration of function '__strncmp'; did you mean 'strncmp'? [-Werror=implicit-function-declaration]
return __strncmp(cs, ct, len);
^~~~~~~~~
strncmp
cc1: some warnings being treated as errors
vim +/strcmp +308 mm/kasan/kasan.c
298
299 #undef memcpy
300 void *memcpy(void *dest, const void *src, size_t len)
301 {
302 check_memory_region((unsigned long)src, len, false, _RET_IP_);
303 check_memory_region((unsigned long)dest, len, true, _RET_IP_);
304
305 return __memcpy(dest, src, len);
306 }
307 #undef strcmp
> 308 int strcmp(const char *cs, const char *ct)
309 {
310 check_memory_region((unsigned long)cs, 1, false, _RET_IP_);
311 check_memory_region((unsigned long)ct, 1, false, _RET_IP_);
312
> 313 return __strcmp(cs, ct);
314 }
315 #undef strncmp
> 316 int strncmp(const char *cs, const char *ct, size_t len)
317 {
318 check_memory_region((unsigned long)cs, len, false, _RET_IP_);
319 check_memory_region((unsigned long)ct, len, false, _RET_IP_);
320
321 return __strncmp(cs, ct, len);
322 }
323 void kasan_alloc_pages(struct page *page, unsigned int order)
324 {
325 if (likely(!PageHighMem(page)))
326 kasan_unpoison_shadow(page_address(page), PAGE_SIZE << order);
327 }
328
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 54028 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180817/3fa345ff/attachment-0001.gz>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-08-17 10:41 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-17 8:37 [PATCH] arm64: kasan: add interceptors for strcmp/strncmp functions Kyeongdon Kim
2018-08-17 8:37 ` Kyeongdon Kim
2018-08-17 9:34 ` kbuild test robot
2018-08-17 9:34 ` kbuild test robot
2018-08-17 9:34 ` kbuild test robot
2018-08-17 10:40 ` kbuild test robot
2018-08-17 10:40 ` kbuild test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.