traceroute: Add indirection of symbol to remove clash with sanitizers

Add indirection and symbol renaming under MKSANITIZER for the linked in
version of getifaddrs.
This commit is contained in:
kamil 2019-08-18 04:12:07 +00:00
parent 997c4cdc97
commit 0c4f7708cb
5 changed files with 22 additions and 9 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.19 2011/09/11 01:06:26 christos Exp $
# $NetBSD: Makefile,v 1.20 2019/08/18 04:12:07 kamil Exp $
USE_FORT?= yes # network client
@ -24,6 +24,10 @@ SRCS+= version.c as.c
RUMPSRCS= getifaddrs.c
CPPFLAGS+= -DRUMP_ACTION
SANITIZER_RENAME_CLASSES+= rump
SANITIZER_RENAME_FILES.rump+= ${PROG}_rumpops.c ${RUMPSRCS}
SANITIZER_RENAME_SYMBOL.rump+= getifaddrs
AWKS= median.awk mean.awk
.include <bsd.prog.mk>

View File

@ -1,4 +1,4 @@
/* $NetBSD: ifaddrlist.c,v 1.10 2011/09/11 01:06:26 christos Exp $ */
/* $NetBSD: ifaddrlist.c,v 1.11 2019/08/18 04:12:07 kamil Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
@ -40,7 +40,7 @@ static const char rcsid[] =
"@(#) Header: ifaddrlist.c,v 1.2 97/04/22 13:31:05 leres Exp (LBL)";
"@(#) Id: ifaddrlist.c,v 1.9 2000/11/23 20:01:55 leres Exp (LBL)";
#else
__RCSID("$NetBSD: ifaddrlist.c,v 1.10 2011/09/11 01:06:26 christos Exp $");
__RCSID("$NetBSD: ifaddrlist.c,v 1.11 2019/08/18 04:12:07 kamil Exp $");
#endif
#endif
@ -75,6 +75,7 @@ struct rtentry;
#endif
#include "ifaddrlist.h"
#include "prog_ops.h"
/* Not all systems have IFF_LOOPBACK */
#ifdef IFF_LOOPBACK
@ -94,7 +95,7 @@ ifaddrlist(struct ifaddrlist **ipaddrp, char *errbuf, size_t buflen)
struct ifaddrlist *al = NULL, *nal;
size_t i = 0, maxal = 10;
if (getifaddrs(&ifap) != 0)
if (prog_getifaddrs(&ifap) != 0)
goto out;
if ((al = malloc(maxal * sizeof(*al))) == NULL)

View File

@ -1,4 +1,4 @@
/* $NetBSD: prog_ops.h,v 1.1 2010/12/15 00:09:41 pooka Exp $ */
/* $NetBSD: prog_ops.h,v 1.2 2019/08/18 04:12:07 kamil Exp $ */
/*
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@ -32,6 +32,7 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <poll.h>
#include <ifaddrs.h>
struct prog_ops {
int (*op_init)(void);
@ -54,6 +55,10 @@ struct prog_ops {
int (*op_sysctl)(const int *, u_int, void *, size_t *,
const void *, size_t);
/* Indirection needed for sanitizers. */
int (*op_getifaddrs)(struct ifaddrs **);
};
extern const struct prog_ops prog_ops;
@ -68,5 +73,6 @@ extern const struct prog_ops prog_ops;
#define prog_connect prog_ops.op_connect
#define prog_getsockname prog_ops.op_getsockname
#define prog_sysctl prog_ops.op_sysctl
#define prog_getifaddrs prog_ops.op_getifaddrs
#endif /* _PROG_OPS_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: traceroute_hostops.c,v 1.1 2010/12/15 00:09:41 pooka Exp $ */
/* $NetBSD: traceroute_hostops.c,v 1.2 2019/08/18 04:12:07 kamil Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: traceroute_hostops.c,v 1.1 2010/12/15 00:09:41 pooka Exp $");
__RCSID("$NetBSD: traceroute_hostops.c,v 1.2 2019/08/18 04:12:07 kamil Exp $");
#endif /* !lint */
#include <sys/types.h>
@ -52,4 +52,5 @@ const struct prog_ops prog_ops = {
.op_connect = connect,
.op_getsockname = getsockname,
.op_sysctl = sysctl,
.op_getifaddrs = getifaddrs,
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: traceroute_rumpops.c,v 1.1 2010/12/15 00:09:42 pooka Exp $ */
/* $NetBSD: traceroute_rumpops.c,v 1.2 2019/08/18 04:12:07 kamil Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: traceroute_rumpops.c,v 1.1 2010/12/15 00:09:42 pooka Exp $");
__RCSID("$NetBSD: traceroute_rumpops.c,v 1.2 2019/08/18 04:12:07 kamil Exp $");
#endif /* !lint */
#include <sys/types.h>
@ -56,4 +56,5 @@ const struct prog_ops prog_ops = {
.op_connect = rump_sys_connect,
.op_getsockname=rump_sys_getsockname,
.op_sysctl = rump_sys___sysctl,
.op_getifaddrs = getifaddrs,
};