From: Ivo Raisr Date: Sat, 1 Aug 2015 21:53:08 +0000 (+0000) Subject: Check for Solaris specific program headers PT_SUNW_SYSSTAT and PT_SUNW_SYSSTAT_ZONE; X-Git-Tag: svn/VALGRIND_3_11_0~188 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9ac18328146275eadd43cf237a81a6e65506ba0b;p=thirdparty%2Fvalgrind.git Check for Solaris specific program headers PT_SUNW_SYSSTAT and PT_SUNW_SYSSTAT_ZONE; and act accordingly. Test cases provided. n-i-bz git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15469 --- diff --git a/README.solaris b/README.solaris index 9c138d3628..6d4a1ec9ac 100644 --- a/README.solaris +++ b/README.solaris @@ -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 diff --git a/configure.ac b/configure.ac index 3024e3cf48..532e42e4ce 100644 --- a/configure.ac +++ b/configure.ac @@ -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 +]], [[ + 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 +]], [[ + 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" diff --git a/coregrind/m_ume/elf.c b/coregrind/m_ume/elf.c index ee4b4e1817..93f28de315 100644 --- a/coregrind/m_ume/elf.c +++ b/coregrind/m_ume/elf.c @@ -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; diff --git a/none/tests/solaris/Makefile.am b/none/tests/solaris/Makefile.am index 2527ea0bc8..4506b46007 100644 --- a/none/tests/solaris/Makefile.am +++ b/none/tests/solaris/Makefile.am @@ -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 index 0000000000..9b6bdc2ec2 --- /dev/null +++ b/none/tests/solaris/reserve_sysstat_addr.c @@ -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 index 0000000000..bde3ea3c1d --- /dev/null +++ b/none/tests/solaris/reserve_sysstat_addr.map @@ -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 index 0000000000..05d2cc671a --- /dev/null +++ b/none/tests/solaris/reserve_sysstat_addr.stderr.exp @@ -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 index 0000000000..c3e8d14e7b --- /dev/null +++ b/none/tests/solaris/reserve_sysstat_addr.vgtest @@ -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 index 0000000000..9b6bdc2ec2 --- /dev/null +++ b/none/tests/solaris/reserve_sysstat_zone_addr.c @@ -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 index 0000000000..0f20af1960 --- /dev/null +++ b/none/tests/solaris/reserve_sysstat_zone_addr.map @@ -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 index 0000000000..e907920471 --- /dev/null +++ b/none/tests/solaris/reserve_sysstat_zone_addr.stderr.exp @@ -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 index 0000000000..e48b278867 --- /dev/null +++ b/none/tests/solaris/reserve_sysstat_zone_addr.vgtest @@ -0,0 +1,3 @@ +prereq: test -e reserve_sysstat_zone_addr +prog: reserve_sysstat_zone_addr +vgopts: -q