Module Name:    src
Committed By:   skrll
Date:           Tue Apr  7 08:07:58 UTC 2020

Modified Files:
        src/common/lib/libc/string: strcat.c strchr.c strrchr.c
        src/sys/lib/libkern: libkern.h

Log Message:
Fix KASAN build on aarch64


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/common/lib/libc/string/strcat.c
cvs rdiff -u -r1.6 -r1.7 src/common/lib/libc/string/strchr.c \
    src/common/lib/libc/string/strrchr.c
cvs rdiff -u -r1.138 -r1.139 src/sys/lib/libkern/libkern.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/common/lib/libc/string/strcat.c
diff -u src/common/lib/libc/string/strcat.c:1.3 src/common/lib/libc/string/strcat.c:1.4
--- src/common/lib/libc/string/strcat.c:1.3	Sun Feb  4 20:22:17 2018
+++ src/common/lib/libc/string/strcat.c	Tue Apr  7 08:07:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: strcat.c,v 1.3 2018/02/04 20:22:17 mrg Exp $	*/
+/*	$NetBSD: strcat.c,v 1.4 2020/04/07 08:07:58 skrll Exp $	*/
 
 /*
  * Copyright (c) 1988, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)strcat.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: strcat.c,v 1.3 2018/02/04 20:22:17 mrg Exp $");
+__RCSID("$NetBSD: strcat.c,v 1.4 2020/04/07 08:07:58 skrll Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -45,7 +45,7 @@ __RCSID("$NetBSD: strcat.c,v 1.3 2018/02
 #include <lib/libkern/libkern.h>
 #endif
 
-#ifdef _FORTIFY_SOURCE
+#if defined(_FORTIFY_SOURCE) || defined(KASAN)
 #undef strcat
 #endif
 

Index: src/common/lib/libc/string/strchr.c
diff -u src/common/lib/libc/string/strchr.c:1.6 src/common/lib/libc/string/strchr.c:1.7
--- src/common/lib/libc/string/strchr.c:1.6	Sun Feb  4 20:22:17 2018
+++ src/common/lib/libc/string/strchr.c	Tue Apr  7 08:07:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: strchr.c,v 1.6 2018/02/04 20:22:17 mrg Exp $	*/
+/*	$NetBSD: strchr.c,v 1.7 2020/04/07 08:07:58 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)index.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: strchr.c,v 1.6 2018/02/04 20:22:17 mrg Exp $");
+__RCSID("$NetBSD: strchr.c,v 1.7 2020/04/07 08:07:58 skrll Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -46,6 +46,10 @@ __RCSID("$NetBSD: strchr.c,v 1.6 2018/02
 #include <lib/libkern/libkern.h>
 #endif
 
+#if defined(KASAN)
+#undef strchr
+#endif
+
 __strong_alias(index, strchr)
 char *
 strchr(const char *p, int ch)
Index: src/common/lib/libc/string/strrchr.c
diff -u src/common/lib/libc/string/strrchr.c:1.6 src/common/lib/libc/string/strrchr.c:1.7
--- src/common/lib/libc/string/strrchr.c:1.6	Sun Feb  4 20:22:17 2018
+++ src/common/lib/libc/string/strrchr.c	Tue Apr  7 08:07:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: strrchr.c,v 1.6 2018/02/04 20:22:17 mrg Exp $	*/
+/*	$NetBSD: strrchr.c,v 1.7 2020/04/07 08:07:58 skrll Exp $	*/
 
 /*
  * Copyright (c) 1988, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)rindex.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: strrchr.c,v 1.6 2018/02/04 20:22:17 mrg Exp $");
+__RCSID("$NetBSD: strrchr.c,v 1.7 2020/04/07 08:07:58 skrll Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -45,6 +45,10 @@ __RCSID("$NetBSD: strrchr.c,v 1.6 2018/0
 #include <lib/libkern/libkern.h>
 #endif
 
+#if defined(KASAN)
+#undef strrchr
+#endif
+
 __strong_alias(rindex, strrchr)
 char *
 strrchr(const char *p, int ch)

Index: src/sys/lib/libkern/libkern.h
diff -u src/sys/lib/libkern/libkern.h:1.138 src/sys/lib/libkern/libkern.h:1.139
--- src/sys/lib/libkern/libkern.h:1.138	Fri Apr  3 18:44:50 2020
+++ src/sys/lib/libkern/libkern.h	Tue Apr  7 08:07:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: libkern.h,v 1.138 2020/04/03 18:44:50 maxv Exp $	*/
+/*	$NetBSD: libkern.h,v 1.139 2020/04/07 08:07:58 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -429,6 +429,9 @@ size_t	 kmsan_strlen(const char *);
 #define	alloca(s)		__builtin_alloca(s)
 #endif
 
+char	*strcat(char *, const char *);
+char	*strchr(const char *, int);
+char	*strrchr(const char *, int);
 /* These exist in GCC 3.x, but we don't bother. */
 #if defined(_KERNEL) && defined(KASAN)
 char	*kasan_strcat(char *, const char *);

Reply via email to