updates for GCC 6.4:
- remove many _DIAGASSERT() checks against not NULL for functions with arguments with nonnull attributes. (probably more to come, the set between x86 and sparc us disjoint.) - port libsanitizer's GetPcSpBp() to sparc, sparc64 and amd64.
This commit is contained in:
parent
239256a2b3
commit
51502cf62d
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bcopy.c,v 1.11 2014/04/16 20:39:55 joerg Exp $ */
|
||||
/* $NetBSD: bcopy.c,v 1.12 2018/02/04 20:22:17 mrg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
|
@ -37,7 +37,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)bcopy.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: bcopy.c,v 1.11 2014/04/16 20:39:55 joerg Exp $");
|
||||
__RCSID("$NetBSD: bcopy.c,v 1.12 2018/02/04 20:22:17 mrg Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
|
@ -89,7 +89,7 @@ bcopy(const void *src0, void *dst0, size_t length)
|
|||
unsigned long u;
|
||||
|
||||
#if !defined(_KERNEL)
|
||||
_DIAGASSERT((dst0 && src0) || length == 0);
|
||||
_DIAGASSERT(length == 0);
|
||||
#endif
|
||||
|
||||
if (length == 0 || dst == src) /* nothing to do */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: memchr.c,v 1.3 2008/01/08 21:57:06 martin Exp $ */
|
||||
/* $NetBSD: memchr.c,v 1.4 2018/02/04 20:22:17 mrg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
|
@ -37,7 +37,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)memchr.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: memchr.c,v 1.3 2008/01/08 21:57:06 martin Exp $");
|
||||
__RCSID("$NetBSD: memchr.c,v 1.4 2018/02/04 20:22:17 mrg Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
|
@ -51,7 +51,6 @@ __RCSID("$NetBSD: memchr.c,v 1.3 2008/01/08 21:57:06 martin Exp $");
|
|||
void *
|
||||
memchr(const void *s, int c, size_t n)
|
||||
{
|
||||
_DIAGASSERT(s != NULL);
|
||||
|
||||
if (n != 0) {
|
||||
const unsigned char *p = s;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: memcmp.c,v 1.4 2013/12/02 21:21:33 joerg Exp $ */
|
||||
/* $NetBSD: memcmp.c,v 1.5 2018/02/04 20:22:17 mrg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
|
@ -37,7 +37,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)memcmp.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: memcmp.c,v 1.4 2013/12/02 21:21:33 joerg Exp $");
|
||||
__RCSID("$NetBSD: memcmp.c,v 1.5 2018/02/04 20:22:17 mrg Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
|
@ -55,8 +55,6 @@ __RCSID("$NetBSD: memcmp.c,v 1.4 2013/12/02 21:21:33 joerg Exp $");
|
|||
int
|
||||
memcmp(const void *s1, const void *s2, size_t n)
|
||||
{
|
||||
_DIAGASSERT(s1 != 0);
|
||||
_DIAGASSERT(s2 != 0);
|
||||
|
||||
if (n != 0) {
|
||||
const unsigned char *p1 = s1, *p2 = s2;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: strcat.c,v 1.2 2007/06/04 18:19:27 christos Exp $ */
|
||||
/* $NetBSD: strcat.c,v 1.3 2018/02/04 20:22:17 mrg 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.2 2007/06/04 18:19:27 christos Exp $");
|
||||
__RCSID("$NetBSD: strcat.c,v 1.3 2018/02/04 20:22:17 mrg Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
|
@ -55,7 +55,6 @@ strcat(char *s, const char *append)
|
|||
char *t = s;
|
||||
|
||||
_DIAGASSERT(t != NULL);
|
||||
_DIAGASSERT(append != NULL);
|
||||
|
||||
for (; *t; ++t)
|
||||
;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: strchr.c,v 1.5 2011/08/31 15:48:32 plunky Exp $ */
|
||||
/* $NetBSD: strchr.c,v 1.6 2018/02/04 20:22:17 mrg 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.5 2011/08/31 15:48:32 plunky Exp $");
|
||||
__RCSID("$NetBSD: strchr.c,v 1.6 2018/02/04 20:22:17 mrg Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
|
@ -51,7 +51,6 @@ char *
|
|||
strchr(const char *p, int ch)
|
||||
{
|
||||
const char cmp = ch;
|
||||
_DIAGASSERT(p != NULL);
|
||||
|
||||
for (;; ++p) {
|
||||
if (*p == cmp) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: strcmp.c,v 1.3 2013/07/01 20:51:59 joerg Exp $ */
|
||||
/* $NetBSD: strcmp.c,v 1.4 2018/02/04 20:22:17 mrg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
|
@ -37,7 +37,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)strcmp.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: strcmp.c,v 1.3 2013/07/01 20:51:59 joerg Exp $");
|
||||
__RCSID("$NetBSD: strcmp.c,v 1.4 2018/02/04 20:22:17 mrg Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
|
@ -57,9 +57,6 @@ int
|
|||
strcmp(const char *s1, const char *s2)
|
||||
{
|
||||
|
||||
_DIAGASSERT(s1 != NULL);
|
||||
_DIAGASSERT(s2 != NULL);
|
||||
|
||||
while (*s1 == *s2++)
|
||||
if (*s1++ == 0)
|
||||
return (0);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: strcpy.c,v 1.3 2011/11/08 16:52:11 joerg Exp $ */
|
||||
/* $NetBSD: strcpy.c,v 1.4 2018/02/04 20:22:17 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1993
|
||||
|
@ -34,7 +34,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)strcpy.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: strcpy.c,v 1.3 2011/11/08 16:52:11 joerg Exp $");
|
||||
__RCSID("$NetBSD: strcpy.c,v 1.4 2018/02/04 20:22:17 mrg Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
|
@ -52,9 +52,6 @@ strcpy(char *to, const char *from)
|
|||
{
|
||||
char *save = to;
|
||||
|
||||
_DIAGASSERT(to != NULL);
|
||||
_DIAGASSERT(from != NULL);
|
||||
|
||||
for (; (*to = *from) != '\0'; ++from, ++to);
|
||||
return(save);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: strncmp.c,v 1.2 2007/06/04 18:19:27 christos Exp $ */
|
||||
/* $NetBSD: strncmp.c,v 1.3 2018/02/04 20:22:17 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
|
@ -34,7 +34,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)strncmp.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: strncmp.c,v 1.2 2007/06/04 18:19:27 christos Exp $");
|
||||
__RCSID("$NetBSD: strncmp.c,v 1.3 2018/02/04 20:22:17 mrg Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
|
@ -49,9 +49,6 @@ int
|
|||
strncmp(const char *s1, const char *s2, size_t n)
|
||||
{
|
||||
|
||||
_DIAGASSERT(s1 != NULL);
|
||||
_DIAGASSERT(s2 != NULL);
|
||||
|
||||
if (n == 0)
|
||||
return (0);
|
||||
do {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: strrchr.c,v 1.5 2009/07/17 19:37:57 dsl Exp $ */
|
||||
/* $NetBSD: strrchr.c,v 1.6 2018/02/04 20:22:17 mrg 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.5 2009/07/17 19:37:57 dsl Exp $");
|
||||
__RCSID("$NetBSD: strrchr.c,v 1.6 2018/02/04 20:22:17 mrg Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
|
@ -52,8 +52,6 @@ strrchr(const char *p, int ch)
|
|||
char *save;
|
||||
const char c = ch;
|
||||
|
||||
_DIAGASSERT(p != NULL);
|
||||
|
||||
for (save = NULL;; ++p) {
|
||||
if (*p == c) {
|
||||
/* LINTED const cast-away */
|
||||
|
|
|
@ -1161,6 +1161,11 @@ void GetPcSpBp(void *context, uptr *pc, uptr *sp, uptr *bp) {
|
|||
*pc = ucontext->uc_mcontext.mc_rip;
|
||||
*bp = ucontext->uc_mcontext.mc_rbp;
|
||||
*sp = ucontext->uc_mcontext.mc_rsp;
|
||||
# elif SANITIZER_NETBSD
|
||||
ucontext_t *ucontext = (ucontext_t*)context;
|
||||
*pc = ucontext->uc_mcontext.__gregs[_REG_RIP];
|
||||
*bp = ucontext->uc_mcontext.__gregs[_REG_RBP];
|
||||
*sp = ucontext->uc_mcontext.__gregs[_REG_RSP];
|
||||
# else
|
||||
ucontext_t *ucontext = (ucontext_t*)context;
|
||||
*pc = ucontext->uc_mcontext.gregs[REG_RIP];
|
||||
|
@ -1194,7 +1199,16 @@ void GetPcSpBp(void *context, uptr *pc, uptr *sp, uptr *bp) {
|
|||
#elif defined(__sparc__)
|
||||
ucontext_t *ucontext = (ucontext_t*)context;
|
||||
uptr *stk_ptr;
|
||||
# if SANITIZER_NETBSD
|
||||
*pc = _UC_MACHINE_PC(ucontext);
|
||||
*sp = _UC_MACHINE_SP(ucontext);
|
||||
# if defined (__arch64__)
|
||||
stk_ptr = (uptr *) (*sp + 2047);
|
||||
# else
|
||||
stk_ptr = (uptr *) *sp;
|
||||
# endif
|
||||
*bp = stk_ptr[15];
|
||||
# elif defined (__arch64__)
|
||||
*pc = ucontext->uc_mcontext.mc_gregs[MC_PC];
|
||||
*sp = ucontext->uc_mcontext.mc_gregs[MC_O6];
|
||||
stk_ptr = (uptr *) (*sp + 2047);
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
#if (defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || \
|
||||
defined(__APPLE__)) && \
|
||||
(defined(__x86_64__) || defined(__i386__) || defined(__arm__) || \
|
||||
defined(__aarch64__) || defined(__mips__) || defined(__powerpc64__))
|
||||
defined(__aarch64__) || defined(__mips__) || defined(__powerpc64__) || \
|
||||
defined(__sparc__))
|
||||
# define CAN_SANITIZE_UB 1
|
||||
#elif defined(_WIN32)
|
||||
# define CAN_SANITIZE_UB 1
|
||||
|
|
Loading…
Reference in New Issue