| 1 |
<html> |
| 2 |
<head> |
| 3 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| 4 |
<title>13. README.solaris</title> |
| 5 |
<link rel="stylesheet" type="text/css" href="vg_basic.css"> |
| 6 |
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"> |
| 7 |
<link rel="home" href="index.html" title="Valgrind Documentation"> |
| 8 |
<link rel="up" href="dist.html" title="Valgrind Distribution Documents"> |
| 9 |
<link rel="prev" href="dist.readme-riscv64.html" title="12. README.riscv64"> |
| 10 |
<link rel="next" href="dist.readme-freebsd.html" title="14. README.freebsd"> |
| 11 |
</head> |
| 12 |
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> |
| 13 |
<div><table class="nav" width="100%" cellspacing="3" cellpadding="3" border="0" summary="Navigation header"><tr> |
| 14 |
<td width="22px" align="center" valign="middle"><a accesskey="p" href="dist.readme-riscv64.html"><img src="images/prev.png" width="18" height="21" border="0" alt="Prev"></a></td> |
| 15 |
<td width="25px" align="center" valign="middle"><a accesskey="u" href="dist.html"><img src="images/up.png" width="21" height="18" border="0" alt="Up"></a></td> |
| 16 |
<td width="31px" align="center" valign="middle"><a accesskey="h" href="index.html"><img src="images/home.png" width="27" height="20" border="0" alt="Up"></a></td> |
| 17 |
<th align="center" valign="middle">Valgrind Distribution Documents</th> |
| 18 |
<td width="22px" align="center" valign="middle"><a accesskey="n" href="dist.readme-freebsd.html"><img src="images/next.png" width="18" height="21" border="0" alt="Next"></a></td> |
| 19 |
</tr></table></div> |
| 20 |
<div class="chapter"> |
| 21 |
<div class="titlepage"><div><div><h1 class="title"> |
| 22 |
<a name="dist.readme-solaris"></a>13. README.solaris</h1></div></div></div> |
| 23 |
<div class="literallayout"><p><br> |
| 24 |
Requirements<br> |
| 25 |
------------<br> |
| 26 |
- You need a recent Solaris-like OS to compile this port. Solaris 11 or<br> |
| 27 |
any illumos-based distribution should work, Solaris 10 is not supported.<br> |
| 28 |
Running `uname -r` has to print '5.11'.<br> |
| 29 |
- Recent GCC tools are required, GCC 3 will probably not work. GCC version<br> |
| 30 |
4.5 (or higher) is recommended.<br> |
| 31 |
- On Illumos you can install the 'build-essential' metapackage which<br> |
| 32 |
includes GCC and many other developer tools.<br> |
| 33 |
- Solaris ld has to be the first linker in the PATH. GNU ld cannot be used.<br> |
| 34 |
There is currently no linker check in the configure script but the linking<br> |
| 35 |
phase fails if GNU ld is used. Recent Solaris/illumos distributions are ok.<br> |
| 36 |
- A working combination of autotools is required: aclocal, autoheader,<br> |
| 37 |
automake and autoconf have to be found in the PATH. You should be able to<br> |
| 38 |
install pkg:/developer/build/automake and pkg:/developer/build/autoconf<br> |
| 39 |
packages to fulfil this requirement.<br> |
| 40 |
- System header files are required. On Solaris, these can be installed with:<br> |
| 41 |
# pkg install system/header<br> |
| 42 |
- GNU make is also required. On Solaris, this can be quickly achieved with:<br> |
| 43 |
$ PATH=/usr/gnu/bin:$PATH; export PATH<br> |
| 44 |
- For remote debugging support, working GDB is required (see below).<br> |
| 45 |
- For running regression tests, GNU sed, grep, awk, diff are required.<br> |
| 46 |
This can be quickly achieved on Solaris by prepending /usr/gnu/bin to PATH.<br> |
| 47 |
<br> |
| 48 |
<br> |
| 49 |
Compilation<br> |
| 50 |
-----------<br> |
| 51 |
Please follow the generic instructions in the README file,<br> |
| 52 |
in the section 'Building and installing it'.<br> |
| 53 |
<br> |
| 54 |
The configure script detects a canonical host to determine which version of<br> |
| 55 |
Valgrind should be built. If the system compiler by default produces 32-bit<br> |
| 56 |
binaries then only a 32-bit version of Valgrind will be built. To enable<br> |
| 57 |
compilation of both 64-bit and 32-bit versions on such a system, issue the<br> |
| 58 |
configure script as follows:<br> |
| 59 |
./configure CC='gcc -m64' CXX='g++ -m64'<br> |
| 60 |
<br> |
| 61 |
<br> |
| 62 |
Oracle Solaris and illumos support<br> |
| 63 |
----------------------------------<br> |
| 64 |
One of the main goal of this port is to support both Oracle Solaris and<br> |
| 65 |
illumos kernels. This is a very hard task because Solaris kernel traditionally<br> |
| 66 |
does not provide a stable syscall interface and because Valgrind contains<br> |
| 67 |
several parts that are closely tied to the underlying kernel. For these<br> |
| 68 |
reasons, the port needs to detect which syscall interfaces are present. This<br> |
| 69 |
detection cannot be done easily at run time and is currently implemented as<br> |
| 70 |
a set of configure tests. This means that a binary version of this port can be<br> |
| 71 |
executed only on a kernel that is compatible with a kernel that was used<br> |
| 72 |
during the configure and compilation time.<br> |
| 73 |
<br> |
| 74 |
Main currently-known incompatibilities:<br> |
| 75 |
- Solaris 11 (released in November 2011) removed a large set of syscalls where<br> |
| 76 |
*at variant of the syscall was also present, for example, open() versus<br> |
| 77 |
openat(AT_FDCWD) [1]<br> |
| 78 |
- syscall number for unlinkat() is 76 on Solaris 11, but 65 on illumos [2]<br> |
| 79 |
- illumos (in April 2013) changed interface of the accept() and pipe()<br> |
| 80 |
syscalls [3]<br> |
| 81 |
- posix_spawn() functionality is backed up by true spawn() syscall on Solaris 11.4<br> |
| 82 |
whereas illumos and Solaris 11.3 leverage vfork()<br> |
| 83 |
- illumos and older Solaris use utimesys() syscall whereas newer Solaris<br> |
| 84 |
uses utimensat()<br> |
| 85 |
<br> |
| 86 |
[1] http://docs.oracle.com/cd/E26502_01/html/E28556/gkzlf.html#gkzip<br> |
| 87 |
[2] https://www.illumos.org/issues/521<br> |
| 88 |
[3] https://github.com/illumos/illumos-gate/commit/5dbfd19ad5fcc2b779f40f80fa05c1bd28fd0b4e<br> |
| 89 |
<br> |
| 90 |
<br> |
| 91 |
Limitations<br> |
| 92 |
-----------<br> |
| 93 |
- The port is Work-In-Progress, many things may not work or they can be subtly<br> |
| 94 |
broken.<br> |
| 95 |
- Coredumps produced by Valgrind do not contain all information available,<br> |
| 96 |
especially microstate accounting and processor bindings.<br> |
| 97 |
- Accessing contents of /proc/self/psinfo is not thread-safe. That is because<br> |
| 98 |
Valgrind emulates this file on behalf of the client programs. Entire<br> |
| 99 |
open() - read() - close() sequence on this file needs to be performed<br> |
| 100 |
atomically.<br> |
| 101 |
- Fork limitations: vfork() is translated to fork(), forkall() is not<br> |
| 102 |
supported.<br> |
| 103 |
- Valgrind does not track definedness of some eflags (OF, SF, ZF, AF, CF, PF)<br> |
| 104 |
individually for each flag. After a syscall is finished, when a carry flag<br> |
| 105 |
is set and defined, all other mentioned flags will be also defined even<br> |
| 106 |
though they might be undefined before making the syscall.<br> |
| 107 |
- System call "execve" with a file descriptor which points to a hardlink<br> |
| 108 |
is currently not supported. That is because from the opened file descriptor<br> |
| 109 |
itself it is not possible to reverse map the intended pathname.<br> |
| 110 |
Examples are fexecve(3C) and isaexec(3C).<br> |
| 111 |
- Program headers PT_SUNW_SYSSTAT and PT_SUNW_SYSSTAT_ZONE are not supported.<br> |
| 112 |
That is, programs linked with mapfile directive RESERVE_SEGMENT and attribute<br> |
| 113 |
TYPE equal to SYSSTAT or SYSSTAT_ZONE will cause Valgrind exit. It is not<br> |
| 114 |
possible for Valgrind to arrange mapping of a kernel shared page at the<br> |
| 115 |
address specified in the mapfile for the guest application. There is currently<br> |
| 116 |
no such mechanism in Solaris. Hacky workarounds are possible, though.<br> |
| 117 |
- When a thread has no stack then all system calls will result in Valgrind<br> |
| 118 |
crash, even though such system calls use just parameters passed in registers.<br> |
| 119 |
This should happen only in pathological situations when a thread is created<br> |
| 120 |
with custom mmap'ed stack and this stack is then unmap'ed during thread<br> |
| 121 |
execution.<br> |
| 122 |
<br> |
| 123 |
<br> |
| 124 |
Remote debugging support<br> |
| 125 |
------------------------<br> |
| 126 |
Solaris port of GDB has a major flaw which prevents remote debugging from<br> |
| 127 |
working correctly. Fortunately this flaw has an easy fix [4]. Unfortunately<br> |
| 128 |
it is not present in the current GDB 7.6.2. This boils down to several<br> |
| 129 |
options:<br> |
| 130 |
- Use GDB shipped with Solaris 11.2 which has this flaw fixed.<br> |
| 131 |
- Wait until GDB 7.7 becomes available (there won't be other 7.6.x releases).<br> |
| 132 |
- Build GDB 7.6.2 with the fix by yourself using the following steps:<br> |
| 133 |
# pkg install developer/gnu-binutils<br> |
| 134 |
$ wget http://ftp.gnu.org/gnu/gdb/gdb-7.6.2.tar.gz<br> |
| 135 |
$ gzip -dc gdb-7.6.2.tar.gz | tar xf -<br> |
| 136 |
$ cd gdb-7.6.2<br> |
| 137 |
$ patch -p1 -i /path/to/valgrind-solaris/solaris/gdb-sol-thread.patch<br> |
| 138 |
$ export LIBS="-lncurses"<br> |
| 139 |
$ export CC="gcc -m64"<br> |
| 140 |
$ ./configure --with-x=no --with-curses --with-libexpat-prefix=/usr/lib<br> |
| 141 |
$ gmake && gmake install<br> |
| 142 |
<br> |
| 143 |
[4] https://sourceware.org/ml/gdb-patches/2013-12/msg00573.html<br> |
| 144 |
<br> |
| 145 |
<br> |
| 146 |
TODO list<br> |
| 147 |
---------<br> |
| 148 |
- Fix few remaining failing tests.<br> |
| 149 |
- Add more Solaris-specific tests (especially for the door and spawn<br> |
| 150 |
syscalls).<br> |
| 151 |
- Provide better error reporting for various subsyscalls.<br> |
| 152 |
- Implement storing of extra register state in signal frame.<br> |
| 153 |
- Performance comparison against other platforms.<br> |
| 154 |
- Prevent SIGPIPE when writing to a socket (coregrind/m_libcfile.c).<br> |
| 155 |
- Implement ticket locking for fair scheduling (--fair-sched=yes).<br> |
| 156 |
- Implement support in DRD and Helgrind tools for thr_join() with thread == 0.<br> |
| 157 |
- Add support for accessing thread-local variables via gdb (auxprogs/getoff.c).<br> |
| 158 |
Requires research on internal libc TLS representation.<br> |
| 159 |
- VEX supports AVX, BMI and AVX2. Investigate if they can be enabled on<br> |
| 160 |
Solaris/illumos.<br> |
| 161 |
- Investigate support for more flags in AT_SUN_AUXFLAGS.<br> |
| 162 |
- Fix Valgrind crash when a thread has no stack and syswrap-main.c accesses<br> |
| 163 |
all possible syscall parameters. Enable helgrind/tests/stackteardown.c<br> |
| 164 |
to see this in effect. Would require awareness of syscall parameter semantics.<br> |
| 165 |
- Correctly print arguments of DW_CFA_ORCL_arg_loc in show_CF_instruction() when<br> |
| 166 |
it is implemented in libdwarf.<br> |
| 167 |
- Handle a situation when guest program sets SC_CANCEL_FLG in schedctl and<br> |
| 168 |
Valgrind needs to invoke a syscall on its own.<br> |
| 169 |
<br> |
| 170 |
<br> |
| 171 |
Summary of Solaris 11 Kernel Interfaces Used<br> |
| 172 |
--------------------------------------------<br> |
| 173 |
Valgrind uses directly the following kernel interfaces (not exhaustive list).<br> |
| 174 |
Then, of course, it has very intimate knowledge of all syscalls, many ioctls<br> |
| 175 |
and some door calls because it has wrappers around them.<br> |
| 176 |
- Syscalls:<br> |
| 177 |
. clock_gettime<br> |
| 178 |
. close<br> |
| 179 |
. connect<br> |
| 180 |
. execve<br> |
| 181 |
. exit<br> |
| 182 |
. faccessat<br> |
| 183 |
. fcntl<br> |
| 184 |
. forksys<br> |
| 185 |
. fstatat<br> |
| 186 |
. getcwd<br> |
| 187 |
. getdents<br> |
| 188 |
. geteuid<br> |
| 189 |
. getgid<br> |
| 190 |
. getgroups<br> |
| 191 |
. getpeername<br> |
| 192 |
. getpid<br> |
| 193 |
. getrlimit<br> |
| 194 |
. getsockname<br> |
| 195 |
. getsockopt<br> |
| 196 |
. gettimeofday<br> |
| 197 |
. kill<br> |
| 198 |
. lseek<br> |
| 199 |
. lwp_create<br> |
| 200 |
. lwp_exit<br> |
| 201 |
. lwp_self<br> |
| 202 |
. lwp_sigqueue<br> |
| 203 |
. mknodat<br> |
| 204 |
. mmap<br> |
| 205 |
. mprotect<br> |
| 206 |
. munmap<br> |
| 207 |
. openat<br> |
| 208 |
. pipe<br> |
| 209 |
. pollsys<br> |
| 210 |
. pread<br> |
| 211 |
. prgpsys<br> |
| 212 |
. pwrite<br> |
| 213 |
. read<br> |
| 214 |
. readlinkat<br> |
| 215 |
. renameat<br> |
| 216 |
. rt_sigprocmask<br> |
| 217 |
. send<br> |
| 218 |
. setrlimit<br> |
| 219 |
. setsockopt<br> |
| 220 |
. sigaction<br> |
| 221 |
. sigreturn<br> |
| 222 |
. sigtimedwait<br> |
| 223 |
. so_socket<br> |
| 224 |
. spawn<br> |
| 225 |
. uname<br> |
| 226 |
. unlinkat<br> |
| 227 |
. waitsys<br> |
| 228 |
. write<br> |
| 229 |
- Signal frames. Valgrind decomposes and synthetizes signal frames.<br> |
| 230 |
- Flag sc_sigblock flag in the schedctl structure by replacing<br> |
| 231 |
function block_all_signals() from libc. The replacement emulates lwp_sigmask<br> |
| 232 |
syscall. More details in coregrind/vg_preloaded.c.<br> |
| 233 |
- Initial stack layout for the main thread is synthetized.<br> |
| 234 |
- procfs agent thread and other procfs commands for manipulating the process.<br> |
| 235 |
- mmapobj syscall is emulated because it gets in the way of the address space<br> |
| 236 |
manager's control.<br> |
| 237 |
<br> |
| 238 |
<br> |
| 239 |
Contacts<br> |
| 240 |
--------<br> |
| 241 |
Please send bug reports and any questions about the port to:<br> |
| 242 |
Ivo Raisr <[email protected]><br> |
| 243 |
Petr Pavlu <[email protected]><br> |
| 244 |
<br> |
| 245 |
</p></div> |
| 246 |
</div> |
| 247 |
<div> |
| 248 |
<br><table class="nav" width="100%" cellspacing="3" cellpadding="2" border="0" summary="Navigation footer"> |
| 249 |
<tr> |
| 250 |
<td rowspan="2" width="40%" align="left"> |
| 251 |
<a accesskey="p" href="dist.readme-riscv64.html"><< 12. README.riscv64</a> </td> |
| 252 |
<td width="20%" align="center"><a accesskey="u" href="dist.html">Up</a></td> |
| 253 |
<td rowspan="2" width="40%" align="right"> <a accesskey="n" href="dist.readme-freebsd.html">14. README.freebsd >></a> |
| 254 |
</td> |
| 255 |
</tr> |
| 256 |
<tr><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td></tr> |
| 257 |
</table> |
| 258 |
</div> |
| 259 |
</body> |
| 260 |
</html> |