Skip to content

Commit e48b685

Browse files
hcahcaVasily Gorbik
authored andcommitted
s390/kasan: remove override of mem*() functions
The kasan mem*() functions are not used anymore since s390 has switched to GENERIC_ENTRY and commit 69d4c0d ("entry, kasan, x86: Disallow overriding mem*() functions"). Therefore remove the now dead code, similar to x86. While at it also use the SYM* macros in mem.S. Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
1 parent 2d1b21e commit e48b685

2 files changed

Lines changed: 18 additions & 21 deletions

File tree

arch/s390/include/asm/string.h

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,6 @@ char *strstr(const char *s1, const char *s2);
5555

5656
#if defined(CONFIG_KASAN) && !defined(__SANITIZE_ADDRESS__)
5757

58-
extern void *__memcpy(void *dest, const void *src, size_t n);
59-
extern void *__memset(void *s, int c, size_t n);
60-
extern void *__memmove(void *dest, const void *src, size_t n);
61-
62-
/*
63-
* For files that are not instrumented (e.g. mm/slub.c) we
64-
* should use not instrumented version of mem* functions.
65-
*/
66-
67-
#define memcpy(dst, src, len) __memcpy(dst, src, len)
68-
#define memmove(dst, src, len) __memmove(dst, src, len)
69-
#define memset(s, c, n) __memset(s, c, n)
7058
#define strlen(s) __strlen(s)
7159

7260
#define __no_sanitize_prefix_strfunc(x) __##x
@@ -79,6 +67,9 @@ extern void *__memmove(void *dest, const void *src, size_t n);
7967
#define __no_sanitize_prefix_strfunc(x) x
8068
#endif /* defined(CONFIG_KASAN) && !defined(__SANITIZE_ADDRESS__) */
8169

70+
void *__memcpy(void *dest, const void *src, size_t n);
71+
void *__memset(void *s, int c, size_t n);
72+
void *__memmove(void *dest, const void *src, size_t n);
8273
void *__memset16(uint16_t *s, uint16_t v, size_t count);
8374
void *__memset32(uint32_t *s, uint32_t v, size_t count);
8475
void *__memset64(uint64_t *s, uint64_t v, size_t count);

arch/s390/lib/mem.S

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
/*
1515
* void *memmove(void *dest, const void *src, size_t n)
1616
*/
17-
WEAK(memmove)
18-
ENTRY(__memmove)
17+
SYM_FUNC_START(__memmove)
1918
ltgr %r4,%r4
2019
lgr %r1,%r2
2120
jz .Lmemmove_exit
@@ -48,7 +47,10 @@ ENTRY(__memmove)
4847
BR_EX %r14
4948
.Lmemmove_mvc:
5049
mvc 0(1,%r1),0(%r3)
51-
ENDPROC(__memmove)
50+
SYM_FUNC_END(__memmove)
51+
EXPORT_SYMBOL(__memmove)
52+
53+
SYM_FUNC_ALIAS(memmove, __memmove)
5254
EXPORT_SYMBOL(memmove)
5355

5456
/*
@@ -66,8 +68,7 @@ EXPORT_SYMBOL(memmove)
6668
* return __builtin_memset(s, c, n);
6769
* }
6870
*/
69-
WEAK(memset)
70-
ENTRY(__memset)
71+
SYM_FUNC_START(__memset)
7172
ltgr %r4,%r4
7273
jz .Lmemset_exit
7374
ltgr %r3,%r3
@@ -111,16 +112,18 @@ ENTRY(__memset)
111112
xc 0(1,%r1),0(%r1)
112113
.Lmemset_mvc:
113114
mvc 1(1,%r1),0(%r1)
114-
ENDPROC(__memset)
115+
SYM_FUNC_END(__memset)
116+
EXPORT_SYMBOL(__memset)
117+
118+
SYM_FUNC_ALIAS(memset, __memset)
115119
EXPORT_SYMBOL(memset)
116120

117121
/*
118122
* memcpy implementation
119123
*
120124
* void *memcpy(void *dest, const void *src, size_t n)
121125
*/
122-
WEAK(memcpy)
123-
ENTRY(__memcpy)
126+
SYM_FUNC_START(__memcpy)
124127
ltgr %r4,%r4
125128
jz .Lmemcpy_exit
126129
aghi %r4,-1
@@ -141,7 +144,10 @@ ENTRY(__memcpy)
141144
j .Lmemcpy_remainder
142145
.Lmemcpy_mvc:
143146
mvc 0(1,%r1),0(%r3)
144-
ENDPROC(__memcpy)
147+
SYM_FUNC_END(__memcpy)
148+
EXPORT_SYMBOL(__memcpy)
149+
150+
SYM_FUNC_ALIAS(memcpy, __memcpy)
145151
EXPORT_SYMBOL(memcpy)
146152

147153
/*

0 commit comments

Comments
 (0)