components/nmap/patches/nping-sparc-alignment.patch
author Rich Burridge <rich.burridge@oracle.com>
Thu, 06 Apr 2017 11:44:41 -0700
changeset 7843 56b5a2b1ab27
permissions -rw-r--r--
25141953 nping --icmp dumps core on SPARC
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7843
56b5a2b1ab27 25141953 nping --icmp dumps core on SPARC
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     1
 alignment problems on SPARC. Based on similar fixes found at:
56b5a2b1ab27 25141953 nping --icmp dumps core on SPARC
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     2
56b5a2b1ab27 25141953 nping --icmp dumps core on SPARC
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     3
  https://lists.debian.org/debian-sparc/2012/01/msg00012.html
56b5a2b1ab27 25141953 nping --icmp dumps core on SPARC
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     4
56b5a2b1ab27 25141953 nping --icmp dumps core on SPARC
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     5
and:
56b5a2b1ab27 25141953 nping --icmp dumps core on SPARC
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     6
56b5a2b1ab27 25141953 nping --icmp dumps core on SPARC
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     7
  https://www.winehq.org/pipermail/wine-patches/2011-February/098547.html
56b5a2b1ab27 25141953 nping --icmp dumps core on SPARC
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     8
56b5a2b1ab27 25141953 nping --icmp dumps core on SPARC
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     9
This change needs to be sent upstream.
56b5a2b1ab27 25141953 nping --icmp dumps core on SPARC
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    10
56b5a2b1ab27 25141953 nping --icmp dumps core on SPARC
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    11
--- nmap-7.11/nping/nping.cc.orig	2017-04-06 11:17:11.026808836 +0000
56b5a2b1ab27 25141953 nping --icmp dumps core on SPARC
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    12
+++ nmap-7.11/nping/nping.cc	2017-04-06 11:17:36.219605075 +0000
56b5a2b1ab27 25141953 nping --icmp dumps core on SPARC
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    13
@@ -164,6 +164,14 @@
56b5a2b1ab27 25141953 nping --icmp dumps core on SPARC
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    14
   ProbeMode prob;
56b5a2b1ab27 25141953 nping --icmp dumps core on SPARC
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    15
   NpingTarget *t=NULL;
56b5a2b1ab27 25141953 nping --icmp dumps core on SPARC
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    16
 
56b5a2b1ab27 25141953 nping --icmp dumps core on SPARC
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    17
+/*
56b5a2b1ab27 25141953 nping --icmp dumps core on SPARC
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    18
+ * 'ta 6' tells the kernel to synthesize any unaligned accesses this process
56b5a2b1ab27 25141953 nping --icmp dumps core on SPARC
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    19
+ * makes, instead of just signalling an error and terminating the process.
56b5a2b1ab27 25141953 nping --icmp dumps core on SPARC
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    20
+ */
56b5a2b1ab27 25141953 nping --icmp dumps core on SPARC
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    21
+#ifdef __sparc
56b5a2b1ab27 25141953 nping --icmp dumps core on SPARC
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    22
+    __asm("ta 6");
56b5a2b1ab27 25141953 nping --icmp dumps core on SPARC
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    23
+#endif
56b5a2b1ab27 25141953 nping --icmp dumps core on SPARC
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    24
+
56b5a2b1ab27 25141953 nping --icmp dumps core on SPARC
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    25
   /* Get current time */
56b5a2b1ab27 25141953 nping --icmp dumps core on SPARC
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    26
   now = time(NULL);
56b5a2b1ab27 25141953 nping --icmp dumps core on SPARC
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    27
   tm = localtime(&now);