Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F150441280
D52389.id161598.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D52389.id161598.diff
View Options
diff --git a/sys/libkern/strcmp.c b/sys/libkern/strcmp.c
--- a/sys/libkern/strcmp.c
+++ b/sys/libkern/strcmp.c
@@ -41,8 +41,12 @@
int
(strcmp)(const char *s1, const char *s2)
{
+#if defined(KASAN) || defined(KCSAN)
+ return (SAN_INTERCEPTOR(strcmp)(s1, s2));
+#else
while (*s1 == *s2++)
if (*s1++ == '\0')
return (0);
return (*(const unsigned char *)s1 - *(const unsigned char *)(s2 - 1));
+#endif
}
diff --git a/sys/libkern/strcpy.c b/sys/libkern/strcpy.c
--- a/sys/libkern/strcpy.c
+++ b/sys/libkern/strcpy.c
@@ -35,8 +35,12 @@
char *
(strcpy)(char * __restrict to, const char * __restrict from)
{
+#if defined(KASAN) || defined(KCSAN)
+ return (SAN_INTERCEPTOR(strcpy)(to, from));
+#else
char *save = to;
for (; (*to = *from) != 0; ++from, ++to);
return(save);
+#endif
}
diff --git a/sys/libkern/strlen.c b/sys/libkern/strlen.c
--- a/sys/libkern/strlen.c
+++ b/sys/libkern/strlen.c
@@ -29,6 +29,13 @@
#include <sys/libkern.h>
#include <sys/limits.h>
+#if defined(KASAN) || defined(KCSAN)
+size_t
+(strlen)(const char *str)
+{
+ return (SAN_INTERCEPTOR(strlen)(str));
+}
+#else /* !KASAN && !KCSAN */
/*
* Portable strlen() for 32-bit and 64-bit systems.
*
@@ -119,3 +126,4 @@
/* NOTREACHED */
return (0);
}
+#endif /* KASAN || KCSAN */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Apr 2, 6:03 AM (1 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30710166
Default Alt Text
D52389.id161598.diff (1 KB)
Attached To
Mode
D52389: libkern: implement string functions as wrappers on ASAN/CSAN kernels
Attached
Detach File
Event Timeline
Log In to Comment