]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Check for Solaris specific program headers PT_SUNW_SYSSTAT and PT_SUNW_SYSSTAT_ZONE;
authorIvo Raisr <ivosh@ivosh.net>
Sat, 1 Aug 2015 21:53:08 +0000 (21:53 +0000)
committerIvo Raisr <ivosh@ivosh.net>
Sat, 1 Aug 2015 21:53:08 +0000 (21:53 +0000)
and act accordingly. Test cases provided. n-i-bz

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15469

12 files changed:
README.solaris
configure.ac
coregrind/m_ume/elf.c
none/tests/solaris/Makefile.am
none/tests/solaris/reserve_sysstat_addr.c [new file with mode: 0644]
none/tests/solaris/reserve_sysstat_addr.map [new file with mode: 0644]
none/tests/solaris/reserve_sysstat_addr.stderr.exp [new file with mode: 0644]
none/tests/solaris/reserve_sysstat_addr.vgtest [new file with mode: 0644]
none/tests/solaris/reserve_sysstat_zone_addr.c [new file with mode: 0644]
none/tests/solaris/reserve_sysstat_zone_addr.map [new file with mode: 0644]
none/tests/solaris/reserve_sysstat_zone_addr.stderr.exp [new file with mode: 0644]
none/tests/solaris/reserve_sysstat_zone_addr.vgtest [new file with mode: 0644]

index 9c138d3628b6370030703c89d102a04a4276c136..6d4a1ec9ac7c1659f90f1c8119e127a1b10459be 100644 (file)
@@ -73,6 +73,12 @@ Limitations
   is currently not supported. That is because from the opened file descriptor
   itself it is not possible to reverse map the intended pathname.
   Examples are fexecve(3C) and isaexec(3C).
+- Program headers PT_SUNW_SYSSTAT and PT_SUNW_SYSSTAT_ZONE are not supported.
+  That is, programs linked with mapfile directive RESERVE_SEGMENT and atribute
+  TYPE equal to SYSSTAT or SYSSTAT_ZONE will cause Valgrind exit. It is not
+  possible for Valgrind to arrange mapping of a kernel shared page at the
+  address specified in the mapfile for the guest application. There is currently
+  no such mechanism in Solaris.
 - When a thread has no stack then all system calls will result in Valgrind
   crash, even though such system calls use just parameters passed in registers.
   This should happen only in pathological situations when a thread is created
index 3024e3cf4813cf051f0ecce627dcf7aa58ccc8e7..532e42e4ced8a38ae9cad0b6f19f4621409206a5 100644 (file)
@@ -3279,6 +3279,60 @@ AC_MSG_RESULT([$version])
 AC_DEFINE_UNQUOTED([SOLARIS_REPCACHE_PROTOCOL_VERSION], [$version],
                    [Version number of the repository door cache protocol.])
 
+
+# Solaris-specific check determining if "sysstat" segment reservation type
+# is available.
+#
+# New "sysstat" segment reservation (available on Solaris 12):
+# - program header type:    PT_SUNW_SYSSTAT
+# - auxiliary vector entry: AT_SUN_SYSSTAT_ADDR
+#
+# C-level symbol: SOLARIS_RESERVE_SYSSTAT_ADDR
+# Automake-level symbol: SOLARIS_RESERVE_SYSSTAT_ADDR
+#
+AC_MSG_CHECKING([for the new `sysstat' segment reservation (Solaris-specific)])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <sys/auxv.h>
+]], [[
+  return !AT_SUN_SYSSTAT_ADDR;
+]])], [
+solaris_reserve_sysstat_addr=yes
+AC_MSG_RESULT([yes])
+AC_DEFINE([SOLARIS_RESERVE_SYSSTAT_ADDR], 1,
+          [Define to 1 if you have the new `sysstat' segment reservation.])
+], [
+solaris_reserve_sysstat_addr=no
+AC_MSG_RESULT([no])
+])
+AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ADDR, test x$solaris_reserve_sysstat_addr = xyes)
+
+
+# Solaris-specific check determining if "sysstat_zone" segment reservation type
+# is available.
+#
+# New "sysstat_zone" segment reservation (available on Solaris 12):
+# - program header type:    PT_SUNW_SYSSTAT_ZONE
+# - auxiliary vector entry: AT_SUN_SYSSTAT_ZONE_ADDR
+#
+# C-level symbol: SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR
+# Automake-level symbol: SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR
+#
+AC_MSG_CHECKING([for the new `sysstat_zone' segment reservation (Solaris-specific)])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <sys/auxv.h>
+]], [[
+  return !AT_SUN_SYSSTAT_ZONE_ADDR;
+]])], [
+solaris_reserve_sysstat_zone_addr=yes
+AC_MSG_RESULT([yes])
+AC_DEFINE([SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR], 1,
+          [Define to 1 if you have the new `sysstat_zone' segment reservation.])
+], [
+solaris_reserve_sysstat_zone_addr=no
+AC_MSG_RESULT([no])
+])
+AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR, test x$solaris_reserve_sysstat_zone_addr = xyes)
+
 else
 AM_CONDITIONAL(SOLARIS_SUN_STUDIO_AS, false)
 AM_CONDITIONAL(SOLARIS_XPG_SYMBOLS_PRESENT, false)
@@ -3300,6 +3354,8 @@ AM_CONDITIONAL(SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE, false)
 AM_CONDITIONAL(SOLARIS_GETHRT_FASTTRAP, false)
 AM_CONDITIONAL(SOLARIS_GETZONEOFFSET_FASTTRAP, false)
 AM_CONDITIONAL(SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS, false)
+AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ADDR, false)
+AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR, false)
 fi # test "$VGCONF_OS" = "solaris"
 
 
index ee4b4e18173fb6b40693aff04586f5c9607fa821..93f28de315bc34db0dd0c6ee320841eba203cacb 100644 (file)
@@ -460,6 +460,19 @@ Int VG_(load_ELF)(Int fd, const HChar* name, /*MOD*/ExeInfo* info)
          break;
 #     endif
 
+#     if defined(PT_SUNW_SYSSTAT)
+      /* Solaris-specific program header which requires link-time support. */
+      case PT_SUNW_SYSSTAT:
+         VG_(unimplemented)("Support for program header PT_SUNW_SYSSTAT.");
+         break;
+#     endif
+#     if defined(PT_SUNW_SYSSTAT_ZONE)
+      /* Solaris-specific program header which requires link-time support. */
+      case PT_SUNW_SYSSTAT_ZONE:
+         VG_(unimplemented)("Support for program header PT_SUNW_SYSSTAT_ZONE.");
+         break;
+#     endif
+
       default:
          // do nothing
          break;
index 2527ea0bc8bc1eea697f89dff7971bd995b7ad24..4506b46007348b81f60d2d0060953b53cf17af33 100644 (file)
@@ -21,6 +21,8 @@ EXTRA_DIST = \
        proc_psinfo.stderr.exp proc_psinfo.stdout.exp proc_psinfo.vgtest \
        posix_spawn.stderr.exp posix_spawn.stdout.exp posix_spawn.vgtest \
        pthread-stack.stderr.exp pthread-stack.vgtest \
+       reserve_sysstat_addr.map reserve_sysstat_addr.stderr.exp reserve_sysstat_addr.vgtest \
+       reserve_sysstat_zone_addr.map reserve_sysstat_zone_addr.stderr.exp reserve_sysstat_zone_addr.vgtest \
        resolv.stdout.exp resolv.stderr.exp resolv.vgtest \
        sigresend.stderr.exp sigresend.stdout.exp sigresend.vgtest \
        stack-overflow.stderr.exp stack-overflow.vgtest \
@@ -56,3 +58,13 @@ pthread_stack_LDADD = -lpthread
 resolv_LDADD = -lresolv
 stack_prot_LDFLAGS = -Wl,-M,/usr/lib/ld/map.noexstk
 threads_exitall_LDADD = -lpthread
+
+if SOLARIS_RESERVE_SYSSTAT_ADDR
+check_PROGRAMS += reserve_sysstat_addr
+reserve_sysstat_addr_LDFLAGS = -Wl,-M,reserve_sysstat_addr.map
+endif
+
+if SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR
+check_PROGRAMS += reserve_sysstat_zone_addr
+reserve_sysstat_zone_addr_LDFLAGS = -Wl,-M,reserve_sysstat_zone_addr.map
+endif
diff --git a/none/tests/solaris/reserve_sysstat_addr.c b/none/tests/solaris/reserve_sysstat_addr.c
new file mode 100644 (file)
index 0000000..9b6bdc2
--- /dev/null
@@ -0,0 +1,3 @@
+int main(void) {
+    return 0;
+}
diff --git a/none/tests/solaris/reserve_sysstat_addr.map b/none/tests/solaris/reserve_sysstat_addr.map
new file mode 100644 (file)
index 0000000..bde3ea3
--- /dev/null
@@ -0,0 +1,7 @@
+$mapfile_version 2
+
+RESERVE_SEGMENT reserve_sysstat {
+       TYPE  = SYSSTAT;
+       SIZE  = 4096;
+       VADDR = 0x9002000;
+};
diff --git a/none/tests/solaris/reserve_sysstat_addr.stderr.exp b/none/tests/solaris/reserve_sysstat_addr.stderr.exp
new file mode 100644 (file)
index 0000000..05d2cc6
--- /dev/null
@@ -0,0 +1,14 @@
+
+Valgrind detected that your program requires
+the following unimplemented functionality:
+   Support for program header PT_SUNW_SYSSTAT.
+This may be because the functionality is hard to implement,
+or because no reasonable program would behave this way,
+or because nobody has yet needed it.  In any case, let us know at
+www.valgrind.org and/or try to work around the problem, if you can.
+
+Valgrind has to exit now.  Sorry.  Bye!
+
+
+sched status:
+  running_tid=0
diff --git a/none/tests/solaris/reserve_sysstat_addr.vgtest b/none/tests/solaris/reserve_sysstat_addr.vgtest
new file mode 100644 (file)
index 0000000..c3e8d14
--- /dev/null
@@ -0,0 +1,3 @@
+prereq: test -e reserve_sysstat_addr
+prog: reserve_sysstat_addr
+vgopts: -q
diff --git a/none/tests/solaris/reserve_sysstat_zone_addr.c b/none/tests/solaris/reserve_sysstat_zone_addr.c
new file mode 100644 (file)
index 0000000..9b6bdc2
--- /dev/null
@@ -0,0 +1,3 @@
+int main(void) {
+    return 0;
+}
diff --git a/none/tests/solaris/reserve_sysstat_zone_addr.map b/none/tests/solaris/reserve_sysstat_zone_addr.map
new file mode 100644 (file)
index 0000000..0f20af1
--- /dev/null
@@ -0,0 +1,7 @@
+$mapfile_version 2
+
+RESERVE_SEGMENT reserve_sysstat_zone {
+       TYPE  = SYSSTAT_ZONE;
+       SIZE  = 4096;
+       VADDR = 0x9004000;
+};
diff --git a/none/tests/solaris/reserve_sysstat_zone_addr.stderr.exp b/none/tests/solaris/reserve_sysstat_zone_addr.stderr.exp
new file mode 100644 (file)
index 0000000..e907920
--- /dev/null
@@ -0,0 +1,14 @@
+
+Valgrind detected that your program requires
+the following unimplemented functionality:
+   Support for program header PT_SUNW_SYSSTAT_ZONE.
+This may be because the functionality is hard to implement,
+or because no reasonable program would behave this way,
+or because nobody has yet needed it.  In any case, let us know at
+www.valgrind.org and/or try to work around the problem, if you can.
+
+Valgrind has to exit now.  Sorry.  Bye!
+
+
+sched status:
+  running_tid=0
diff --git a/none/tests/solaris/reserve_sysstat_zone_addr.vgtest b/none/tests/solaris/reserve_sysstat_zone_addr.vgtest
new file mode 100644 (file)
index 0000000..e48b278
--- /dev/null
@@ -0,0 +1,3 @@
+prereq: test -e reserve_sysstat_zone_addr
+prog: reserve_sysstat_zone_addr
+vgopts: -q