Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/tcpdump/dist Use UNALIGNED_OK to disable unalig...



details:   https://anonhg.NetBSD.org/src/rev/619e813680ba
branches:  trunk
changeset: 745188:619e813680ba
user:      kamil <kamil%NetBSD.org@localhost>
date:      Mon Feb 24 18:39:47 2020 +0000

description:
Use UNALIGNED_OK to disable unaligned pointer arithmetic checks in UBSan

Upstream fixed it differently by refactoring the code and the problem will
go away on upgrade to 5.0.

diffstat:

 external/bsd/tcpdump/dist/print-ah.c    |  3 ++-
 external/bsd/tcpdump/dist/print-bgp.c   |  3 ++-
 external/bsd/tcpdump/dist/print-esp.c   |  3 ++-
 external/bsd/tcpdump/dist/print-icmp.c  |  3 ++-
 external/bsd/tcpdump/dist/print-icmp6.c |  7 ++++++-
 external/bsd/tcpdump/dist/print-igmp.c  |  3 ++-
 external/bsd/tcpdump/dist/print-m3ua.c  |  4 ++--
 external/bsd/tcpdump/dist/print-msnlb.c |  3 ++-
 external/bsd/tcpdump/dist/print-nfs.c   |  8 +++++++-
 external/bsd/tcpdump/dist/print-ntp.c   |  4 ++--
 external/bsd/tcpdump/dist/print-ospf6.c |  7 ++++++-
 external/bsd/tcpdump/dist/print-pgm.c   |  3 ++-
 external/bsd/tcpdump/dist/print-rip.c   |  6 +++---
 external/bsd/tcpdump/dist/print-ripng.c |  3 ++-
 external/bsd/tcpdump/dist/print-sctp.c  |  3 ++-
 external/bsd/tcpdump/dist/print-tcp.c   |  3 ++-
 external/bsd/tcpdump/dist/print-timed.c |  3 ++-
 external/bsd/tcpdump/dist/print-tipc.c  |  5 +++--
 external/bsd/tcpdump/dist/print-udp.c   |  3 ++-
 external/bsd/tcpdump/dist/print-wb.c    |  3 ++-
 20 files changed, 55 insertions(+), 25 deletions(-)

diffs (truncated from 541 to 300 lines):

diff -r 4558944b6563 -r 619e813680ba external/bsd/tcpdump/dist/print-ah.c
--- a/external/bsd/tcpdump/dist/print-ah.c      Mon Feb 24 16:19:35 2020 +0000
+++ b/external/bsd/tcpdump/dist/print-ah.c      Mon Feb 24 18:39:47 2020 +0000
@@ -23,7 +23,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: print-ah.c,v 1.6 2017/02/05 04:05:05 spz Exp $");
+__RCSID("$NetBSD: print-ah.c,v 1.7 2020/02/24 18:39:47 kamil Exp $");
 #endif
 
 /* \summary: IPSEC Authentication Header printer */
@@ -39,6 +39,7 @@
 #include "netdissect.h"
 #include "extract.h"
 
+UNALIGNED_OK
 int
 ah_print(netdissect_options *ndo, register const u_char *bp)
 {
diff -r 4558944b6563 -r 619e813680ba external/bsd/tcpdump/dist/print-bgp.c
--- a/external/bsd/tcpdump/dist/print-bgp.c     Mon Feb 24 16:19:35 2020 +0000
+++ b/external/bsd/tcpdump/dist/print-bgp.c     Mon Feb 24 18:39:47 2020 +0000
@@ -32,7 +32,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: print-bgp.c,v 1.10 2019/10/01 16:06:16 christos Exp $");
+__RCSID("$NetBSD: print-bgp.c,v 1.11 2020/02/24 18:39:47 kamil Exp $");
 #endif
 
 /* \summary: Border Gateway Protocol (BGP) printer */
@@ -921,6 +921,7 @@
     { 0, NULL}
 };
 
+UNALIGNED_OK
 static int
 decode_multicast_vpn(netdissect_options *ndo,
                      const u_char *pptr, char *buf, u_int buflen)
diff -r 4558944b6563 -r 619e813680ba external/bsd/tcpdump/dist/print-esp.c
--- a/external/bsd/tcpdump/dist/print-esp.c     Mon Feb 24 16:19:35 2020 +0000
+++ b/external/bsd/tcpdump/dist/print-esp.c     Mon Feb 24 18:39:47 2020 +0000
@@ -23,7 +23,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: print-esp.c,v 1.10 2019/10/01 16:06:16 christos Exp $");
+__RCSID("$NetBSD: print-esp.c,v 1.11 2020/02/24 18:39:47 kamil Exp $");
 #endif
 
 /* \summary: IPSEC Encapsulating Security Payload (ESP) printer */
@@ -654,6 +654,7 @@
 
 #endif
 
+UNALIGNED_OK
 #ifdef HAVE_LIBCRYPTO
 USES_APPLE_DEPRECATED_API
 #endif
diff -r 4558944b6563 -r 619e813680ba external/bsd/tcpdump/dist/print-icmp.c
--- a/external/bsd/tcpdump/dist/print-icmp.c    Mon Feb 24 16:19:35 2020 +0000
+++ b/external/bsd/tcpdump/dist/print-icmp.c    Mon Feb 24 18:39:47 2020 +0000
@@ -21,7 +21,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: print-icmp.c,v 1.10 2019/10/01 16:06:16 christos Exp $");
+__RCSID("$NetBSD: print-icmp.c,v 1.11 2020/02/24 18:39:47 kamil Exp $");
 #endif
 
 /* \summary: Internet Control Message Protocol (ICMP) printer */
@@ -331,6 +331,7 @@
     return buf;
 }
 
+UNALIGNED_OK
 void
 icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *bp2,
            int fragmented)
diff -r 4558944b6563 -r 619e813680ba external/bsd/tcpdump/dist/print-icmp6.c
--- a/external/bsd/tcpdump/dist/print-icmp6.c   Mon Feb 24 16:19:35 2020 +0000
+++ b/external/bsd/tcpdump/dist/print-icmp6.c   Mon Feb 24 18:39:47 2020 +0000
@@ -21,7 +21,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: print-icmp6.c,v 1.12 2019/10/01 16:06:16 christos Exp $");
+__RCSID("$NetBSD: print-icmp6.c,v 1.13 2020/02/24 18:39:47 kamil Exp $");
 #endif
 
 /* \summary: IPv6 Internet Control Message Protocol (ICMPv6) printer */
@@ -818,6 +818,7 @@
        return;
 }
 
+UNALIGNED_OK
 static void
 rpl_print(netdissect_options *ndo,
           const struct icmp6_hdr *hdr,
@@ -876,6 +877,7 @@
 }
 
 
+UNALIGNED_OK
 void
 icmp6_print(netdissect_options *ndo,
             const u_char *bp, u_int length, const u_char *bp2, int fragmented)
@@ -1403,6 +1405,7 @@
 #undef ECHECK
 }
 
+UNALIGNED_OK
 static void
 mld6_print(netdissect_options *ndo, const u_char *bp)
 {
@@ -1419,6 +1422,7 @@
        ND_PRINT((ndo,"addr: %s", ip6addr_string(ndo, &mp->mld6_addr)));
 }
 
+UNALIGNED_OK
 static void
 mldv2_report_print(netdissect_options *ndo, const u_char *bp, u_int len)
 {
@@ -1477,6 +1481,7 @@
     return;
 }
 
+UNALIGNED_OK
 static void
 mldv2_query_print(netdissect_options *ndo, const u_char *bp, u_int len)
 {
diff -r 4558944b6563 -r 619e813680ba external/bsd/tcpdump/dist/print-igmp.c
--- a/external/bsd/tcpdump/dist/print-igmp.c    Mon Feb 24 16:19:35 2020 +0000
+++ b/external/bsd/tcpdump/dist/print-igmp.c    Mon Feb 24 18:39:47 2020 +0000
@@ -21,7 +21,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: print-igmp.c,v 1.7 2017/02/05 04:05:05 spz Exp $");
+__RCSID("$NetBSD: print-igmp.c,v 1.8 2020/02/24 18:39:47 kamil Exp $");
 #endif
 
 /* \summary: Internet Group Management Protocol (IGMP) printer */
@@ -107,6 +107,7 @@
        { 0,    NULL }
 };
 
+UNALIGNED_OK
 static void
 print_mtrace(netdissect_options *ndo,
              register const u_char *bp, register u_int len)
diff -r 4558944b6563 -r 619e813680ba external/bsd/tcpdump/dist/print-m3ua.c
--- a/external/bsd/tcpdump/dist/print-m3ua.c    Mon Feb 24 16:19:35 2020 +0000
+++ b/external/bsd/tcpdump/dist/print-m3ua.c    Mon Feb 24 18:39:47 2020 +0000
@@ -24,7 +24,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: print-m3ua.c,v 1.5 2017/09/08 14:01:13 christos Exp $");
+__RCSID("$NetBSD: print-m3ua.c,v 1.6 2020/02/24 18:39:47 kamil Exp $");
 #endif
 
 /* \summary: Message Transfer Part 3 (MTP3) User Adaptation Layer (M3UA) printer */
@@ -301,6 +301,7 @@
  *    \                                                               \
  *    /                                                               /
  */
+UNALIGNED_OK
 void
 m3ua_print(netdissect_options *ndo,
            const u_char *buf, const u_int size)
@@ -341,4 +342,3 @@
 trunc:
   ND_PRINT((ndo, "%s", tstr));
 }
-
diff -r 4558944b6563 -r 619e813680ba external/bsd/tcpdump/dist/print-msnlb.c
--- a/external/bsd/tcpdump/dist/print-msnlb.c   Mon Feb 24 16:19:35 2020 +0000
+++ b/external/bsd/tcpdump/dist/print-msnlb.c   Mon Feb 24 18:39:47 2020 +0000
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: print-msnlb.c,v 1.3 2017/02/05 04:05:05 spz Exp $");
+__RCSID("$NetBSD: print-msnlb.c,v 1.4 2020/02/24 18:39:47 kamil Exp $");
 #endif
 
 /* \summary: MS Network Load Balancing's (NLB) heartbeat printer */
@@ -52,6 +52,7 @@
        /* the protocol is undocumented so we ignore the rest */
 };
 
+UNALIGNED_OK
 void
 msnlb_print(netdissect_options *ndo, const u_char *bp)
 {
diff -r 4558944b6563 -r 619e813680ba external/bsd/tcpdump/dist/print-nfs.c
--- a/external/bsd/tcpdump/dist/print-nfs.c     Mon Feb 24 16:19:35 2020 +0000
+++ b/external/bsd/tcpdump/dist/print-nfs.c     Mon Feb 24 18:39:47 2020 +0000
@@ -21,7 +21,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: print-nfs.c,v 1.9 2019/10/01 16:06:16 christos Exp $");
+__RCSID("$NetBSD: print-nfs.c,v 1.10 2020/02/24 18:39:47 kamil Exp $");
 #endif
 
 /* \summary: Network File System (NFS) printer */
@@ -354,6 +354,7 @@
                ND_PRINT((ndo, "%s", tstr));
 }
 
+UNALIGNED_OK
 void
 nfsreply_print_noaddr(netdissect_options *ndo,
                       register const u_char *bp, u_int length,
@@ -419,6 +420,7 @@
  * Return a pointer to the first file handle in the packet.
  * If the packet was truncated, return 0.
  */
+UNALIGNED_OK
 static const uint32_t *
 parsereq(netdissect_options *ndo,
          register const struct sunrpc_msg *rp, register u_int length)
@@ -522,6 +524,7 @@
        return (parsefn(ndo, dp));
 }
 
+UNALIGNED_OK
 void
 nfsreq_print_noaddr(netdissect_options *ndo,
                     register const u_char *bp, u_int length,
@@ -867,6 +870,7 @@
 static int xid_map_next = 0;
 static int xid_map_hint = 0;
 
+UNALIGNED_OK
 static int
 xid_map_enter(netdissect_options *ndo,
               const struct sunrpc_msg *rp, const u_char *bp)
@@ -913,6 +917,7 @@
  * Returns 0 and puts NFSPROC_xxx in proc return and
  * version in vers return, or returns -1 on failure
  */
+UNALIGNED_OK
 static int
 xid_map_find(const struct sunrpc_msg *rp, const u_char *bp, uint32_t *proc,
             uint32_t *vers)
@@ -977,6 +982,7 @@
  * Return a pointer to the beginning of the actual results.
  * If the packet was truncated, return 0.
  */
+UNALIGNED_OK
 static const uint32_t *
 parserep(netdissect_options *ndo,
          register const struct sunrpc_msg *rp, register u_int length)
diff -r 4558944b6563 -r 619e813680ba external/bsd/tcpdump/dist/print-ntp.c
--- a/external/bsd/tcpdump/dist/print-ntp.c     Mon Feb 24 16:19:35 2020 +0000
+++ b/external/bsd/tcpdump/dist/print-ntp.c     Mon Feb 24 18:39:47 2020 +0000
@@ -26,7 +26,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: print-ntp.c,v 1.7 2017/02/05 04:05:05 spz Exp $");
+__RCSID("$NetBSD: print-ntp.c,v 1.8 2020/02/24 18:39:47 kamil Exp $");
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -205,6 +205,7 @@
 /*
  * Print ntp requests
  */
+UNALIGNED_OK
 void
 ntp_print(netdissect_options *ndo,
           register const u_char *cp, u_int length)
@@ -429,4 +430,3 @@
        f = (uint32_t)(ff * 1000000000.0);      /* treat fraction as parts per billion */
        ND_PRINT((ndo, "%s%d.%09d", signbit ? "-" : "+", i, f));
 }
-
diff -r 4558944b6563 -r 619e813680ba external/bsd/tcpdump/dist/print-ospf6.c
--- a/external/bsd/tcpdump/dist/print-ospf6.c   Mon Feb 24 16:19:35 2020 +0000
+++ b/external/bsd/tcpdump/dist/print-ospf6.c   Mon Feb 24 18:39:47 2020 +0000
@@ -23,7 +23,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: print-ospf6.c,v 1.9 2019/10/01 16:06:16 christos Exp $");
+__RCSID("$NetBSD: print-ospf6.c,v 1.10 2020/02/24 18:39:47 kamil Exp $");
 #endif
 
 /* \summary: IPv6 Open Shortest Path First (OSPFv3) printer */
@@ -388,6 +388,7 @@
                ipaddr_string(ndo, ls_stateid)));
 }
 
+UNALIGNED_OK
 static int



Home | Main Index | Thread Index | Old Index