Update bug status.
[valgrind.git] / coregrind / pub_core_ume.h
blobd6230fff77f76d148638601e155486a5c8ff84a1
2 /*--------------------------------------------------------------------*/
3 /*--- User-mode execve. pub_core_ume.h ---*/
4 /*--------------------------------------------------------------------*/
6 /*
7 This file is part of Valgrind, a dynamic binary instrumentation
8 framework.
10 Copyright (C) 2000-2017 Julian Seward
11 jseward@acm.org
13 This program is free software; you can redistribute it and/or
14 modify it under the terms of the GNU General Public License as
15 published by the Free Software Foundation; either version 2 of the
16 License, or (at your option) any later version.
18 This program is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, see <http://www.gnu.org/licenses/>.
26 The GNU General Public License is contained in the file COPYING.
29 #ifndef __PUB_CORE_UME_H
30 #define __PUB_CORE_UME_H
32 #include "pub_core_basics.h" // VG_ macro
34 //--------------------------------------------------------------------
35 // PURPOSE: This module implements user-mode execve, ie. program loading
36 // and exec'ing.
37 //--------------------------------------------------------------------
39 /*------------------------------------------------------------*/
40 /*--- Loading files ---*/
41 /*------------------------------------------------------------*/
43 // Info needed to load and run a program. IN/INOUT/OUT refers to the
44 // inputs/outputs of do_exec().
45 typedef
46 struct {
47 const HChar** argv; // IN: the original argv
49 Addr exe_base; // INOUT: lowest (allowed) address of exe
50 Addr exe_end; // INOUT: highest (allowed) address
52 #if !defined(VGO_darwin)
53 Addr phdr; // OUT: address phdr was mapped at
54 Int phnum; // OUT: number of phdrs
55 UInt stack_prot; // OUT: stack permissions
56 PtrdiffT interp_offset; // OUT: relocation offset for ld.so
57 #else
58 Addr stack_start; // OUT: address of start of stack segment (hot)
59 Addr stack_end; // OUT: address of end of stack segment (cold)
60 Addr text; // OUT: address of executable's Mach header
61 Bool dynamic; // OUT: False iff executable is static
62 HChar* executable_path; // OUT: path passed to execve()
63 #endif
65 #if defined(VGO_solaris)
66 Addr init_thrptr; // OUT: architecture-specific user per-thread location
67 Bool real_phdr_present; // OUT: PT_PHDR found, include phdr in auxv
68 Bool ldsoexec; // OUT: the program is the runtime linker itself
69 #endif
71 #if defined(VGO_linux)
72 // INOUT: architecture-specific ELF loading state
73 struct vki_arch_elf_state *arch_elf_state;
74 #endif
76 Addr entry; // OUT: entrypoint in main executable
77 Addr init_ip; // OUT: address of first instruction to execute
78 Addr brkbase; // OUT: base address of brk segment
79 Addr init_toc; // OUT: address of table-of-contents, on
80 // platforms for which that makes sense
81 // (ppc64-linux only)
83 // These are the extra args added by #! scripts
84 HChar* interp_name; // OUT: the interpreter name
85 HChar* interp_args; // OUT: the args for the interpreter
87 ExeInfo;
89 // Do a number of appropriate checks to see if the file looks executable by
90 // the kernel: ie. it's a file, it's readable and executable, and it's in
91 // either binary or "#!" format. On success, 'out_fd' gets the fd of the file
92 // if it's non-NULL. Otherwise the fd is closed.
93 extern SysRes VG_(pre_exec_check)(const HChar* exe_name, Int* out_fd,
94 Bool allow_setuid);
96 // Does everything short of actually running 'exe': finds the file,
97 // checks execute permissions, sets up interpreter if program is a script,
98 // reads headers, maps file into memory, and returns important info about
99 // the program.
100 extern Int VG_(do_exec)(const HChar* exe, ExeInfo* info);
102 #endif /* __PUB_CORE_UME_H */
104 /*--------------------------------------------------------------------*/
105 /*--- end ---*/
106 /*--------------------------------------------------------------------*/