1 | /* $Id: SUPLibInternal.h 76568 2019-01-01 04:34:11Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox Support Library - Internal header.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2019 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * The contents of this file may alternatively be used under the terms
|
---|
18 | * of the Common Development and Distribution License Version 1.0
|
---|
19 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | * CDDL are applicable instead of those of the GPL.
|
---|
22 | *
|
---|
23 | * You may elect to license modified versions of this file under the
|
---|
24 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | */
|
---|
26 |
|
---|
27 | #ifndef VBOX_INCLUDED_SRC_Support_SUPLibInternal_h
|
---|
28 | #define VBOX_INCLUDED_SRC_Support_SUPLibInternal_h
|
---|
29 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
30 | # pragma once
|
---|
31 | #endif
|
---|
32 |
|
---|
33 | #include <VBox/cdefs.h>
|
---|
34 | #include <VBox/types.h>
|
---|
35 | #include <iprt/stdarg.h>
|
---|
36 |
|
---|
37 |
|
---|
38 | /*******************************************************************************
|
---|
39 | * Defined Constants And Macros *
|
---|
40 | *******************************************************************************/
|
---|
41 | /** @def SUPLIB_DLL_SUFF
|
---|
42 | * The (typical) DLL/DYLIB/SO suffix. */
|
---|
43 | #if defined(RT_OS_DARWIN)
|
---|
44 | # define SUPLIB_DLL_SUFF ".dylib"
|
---|
45 | #elif defined(RT_OS_L4)
|
---|
46 | # define SUPLIB_DLL_SUFF ".s.so"
|
---|
47 | #elif defined(RT_OS_OS2) || defined(RT_OS_WINDOWS)
|
---|
48 | # define SUPLIB_DLL_SUFF ".dll"
|
---|
49 | #else
|
---|
50 | # define SUPLIB_DLL_SUFF ".so"
|
---|
51 | #endif
|
---|
52 |
|
---|
53 | #ifdef RT_OS_SOLARIS
|
---|
54 | /** Number of dummy files to open (2:ip4, 1:ip6, 1:extra) see
|
---|
55 | * @bugref{4650}. */
|
---|
56 | # define SUPLIB_FLT_DUMMYFILES 4
|
---|
57 | #endif
|
---|
58 |
|
---|
59 | /** @def SUPLIB_EXE_SUFF
|
---|
60 | * The (typical) executable suffix. */
|
---|
61 | #if defined(RT_OS_OS2) || defined(RT_OS_WINDOWS)
|
---|
62 | # define SUPLIB_EXE_SUFF ".exe"
|
---|
63 | #else
|
---|
64 | # define SUPLIB_EXE_SUFF ""
|
---|
65 | #endif
|
---|
66 |
|
---|
67 | /** @def SUP_HARDENED_SUID
|
---|
68 | * Whether we're employing set-user-ID-on-execute in the hardening.
|
---|
69 | */
|
---|
70 | #if !defined(RT_OS_OS2) && !defined(RT_OS_WINDOWS) && !defined(RT_OS_L4)
|
---|
71 | # define SUP_HARDENED_SUID
|
---|
72 | #else
|
---|
73 | # undef SUP_HARDENED_SUID
|
---|
74 | #endif
|
---|
75 |
|
---|
76 | #ifdef IN_SUP_HARDENED_R3
|
---|
77 | /** @name Make the symbols in SUPR3HardenedStatic different from the VBoxRT ones.
|
---|
78 | * We cannot rely on DECLHIDDEN to make this separation for us since it doesn't
|
---|
79 | * work with all GCC versions. So, we resort to old fashion precompiler hacking.
|
---|
80 | * @{
|
---|
81 | */
|
---|
82 | # define supR3HardenedPathAppPrivateNoArch supR3HardenedStaticPathAppPrivateNoArch
|
---|
83 | # define supR3HardenedPathAppPrivateArch supR3HardenedStaticPathAppPrivateArch
|
---|
84 | # define supR3HardenedPathAppSharedLibs supR3HardenedStaticPathAppSharedLibs
|
---|
85 | # define supR3HardenedPathAppDocs supR3HardenedStaticPathAppDocs
|
---|
86 | # define supR3HardenedPathAppBin supR3HardenedStaticPathAppBin
|
---|
87 | # define supR3HardenedPathFilename supR3HardenedStaticPathFilename
|
---|
88 | # define supR3HardenedFatalV supR3HardenedStaticFatalV
|
---|
89 | # define supR3HardenedFatal supR3HardenedStaticFatal
|
---|
90 | # define supR3HardenedFatalMsgV supR3HardenedStaticFatalMsgV
|
---|
91 | # define supR3HardenedFatalMsg supR3HardenedStaticFatalMsg
|
---|
92 | # define supR3HardenedErrorV supR3HardenedStaticErrorV
|
---|
93 | # define supR3HardenedError supR3HardenedStaticError
|
---|
94 | # define supR3HardenedOpenLog supR3HardenedStaticOpenLog
|
---|
95 | # define supR3HardenedLogV supR3HardenedStaticLogV
|
---|
96 | # define supR3HardenedLog supR3HardenedStaticLog
|
---|
97 | # define supR3HardenedLogFlush supR3HardenedStaticLogFlush
|
---|
98 | # define supR3HardenedVerifyAll supR3HardenedStaticVerifyAll
|
---|
99 | # define supR3HardenedVerifyFixedDir supR3HardenedStaticVerifyFixedDir
|
---|
100 | # define supR3HardenedVerifyFixedFile supR3HardenedStaticVerifyFixedFile
|
---|
101 | # define supR3HardenedVerifyDir supR3HardenedStaticVerifyDir
|
---|
102 | # define supR3HardenedVerifyFile supR3HardenedStaticVerifyFile
|
---|
103 | # define supR3HardenedGetPreInitData supR3HardenedStaticGetPreInitData
|
---|
104 | # define supR3HardenedRecvPreInitData supR3HardenedStaticRecvPreInitData
|
---|
105 | /** @} */
|
---|
106 | #endif /* IN_SUP_HARDENED_R3 */
|
---|
107 |
|
---|
108 |
|
---|
109 | /** @name CRT function mappings (not using CRT on Windows).
|
---|
110 | * @{
|
---|
111 | */
|
---|
112 | #if defined(IN_SUP_HARDENED_R3) && defined(RT_OS_WINDOWS)
|
---|
113 | # define SUP_HARDENED_NEED_CRT_FUNCTIONS
|
---|
114 | DECLHIDDEN(int) suplibHardenedMemComp(void const *pvDst, const void *pvSrc, size_t cbToComp);
|
---|
115 | DECLHIDDEN(void *) suplibHardenedMemCopy(void *pvDst, const void *pvSrc, size_t cbToCopy);
|
---|
116 | DECLHIDDEN(void *) suplibHardenedMemSet(void *pvDst, int ch, size_t cbToSet);
|
---|
117 | DECLHIDDEN(char *) suplibHardenedStrCopy(char *pszDst, const char *pszSrc);
|
---|
118 | DECLHIDDEN(size_t) suplibHardenedStrLen(const char *psz);
|
---|
119 | DECLHIDDEN(char *) suplibHardenedStrCat(char *pszDst, const char *pszSrc);
|
---|
120 | DECLHIDDEN(int) suplibHardenedStrCmp(const char *psz1, const char *psz2);
|
---|
121 | DECLHIDDEN(int) suplibHardenedStrNCmp(const char *psz1, const char *psz2, size_t cchMax);
|
---|
122 | #else
|
---|
123 | # undef SUP_HARDENED_NEED_CRT_FUNCTIONS
|
---|
124 | # define suplibHardenedMemComp memcmp
|
---|
125 | # define suplibHardenedMemCopy memcpy
|
---|
126 | # define suplibHardenedMemSet memset
|
---|
127 | # define suplibHardenedStrCopy strcpy
|
---|
128 | # define suplibHardenedStrLen strlen
|
---|
129 | # define suplibHardenedStrCat strcat
|
---|
130 | # define suplibHardenedStrCmp strcmp
|
---|
131 | # define suplibHardenedStrNCmp strncmp
|
---|
132 | #endif
|
---|
133 | DECLNORETURN(void) suplibHardenedExit(RTEXITCODE rcExit);
|
---|
134 | DECLHIDDEN(void) suplibHardenedPrintF(const char *pszFormat, ...);
|
---|
135 | DECLHIDDEN(void) suplibHardenedPrintFV(const char *pszFormat, va_list va);
|
---|
136 |
|
---|
137 | /** @} */
|
---|
138 |
|
---|
139 | /** Debug output macro. */
|
---|
140 | #ifdef IN_SUP_HARDENED_R3
|
---|
141 | # if defined(DEBUG_bird) && defined(RT_OS_WINDOWS)
|
---|
142 | # define SUP_DPRINTF(a) do { supR3HardenedStaticLog a; suplibHardenedPrintF a; } while (0)
|
---|
143 | # else
|
---|
144 | # define SUP_DPRINTF(a) do { supR3HardenedStaticLog a; } while (0)
|
---|
145 | # endif
|
---|
146 | #else
|
---|
147 | # if defined(DEBUG_bird) && defined(RT_OS_WINDOWS)
|
---|
148 | # define SUP_DPRINTF(a) RTLogPrintf a
|
---|
149 | # else
|
---|
150 | # define SUP_DPRINTF(a) do { } while (0)
|
---|
151 | # endif
|
---|
152 | #endif
|
---|
153 |
|
---|
154 |
|
---|
155 | /*******************************************************************************
|
---|
156 | * Structures and Typedefs *
|
---|
157 | *******************************************************************************/
|
---|
158 | /**
|
---|
159 | * The type of an installed file.
|
---|
160 | */
|
---|
161 | typedef enum SUPINSTFILETYPE
|
---|
162 | {
|
---|
163 | kSupIFT_Invalid = 0,
|
---|
164 | kSupIFT_Exe,
|
---|
165 | kSupIFT_Dll,
|
---|
166 | kSupIFT_Rc,
|
---|
167 | kSupIFT_Sys,
|
---|
168 | kSupIFT_Script,
|
---|
169 | kSupIFT_Data,
|
---|
170 | kSupIFT_TestExe,
|
---|
171 | kSupIFT_TestDll,
|
---|
172 | kSupIFT_End
|
---|
173 | } SUPINSTFILETYPE;
|
---|
174 |
|
---|
175 | /**
|
---|
176 | * Installation directory specifier.
|
---|
177 | */
|
---|
178 | typedef enum SUPINSTDIR
|
---|
179 | {
|
---|
180 | kSupID_Invalid = 0,
|
---|
181 | kSupID_AppBin,
|
---|
182 | kSupID_AppSharedLib,
|
---|
183 | kSupID_AppPrivArch,
|
---|
184 | kSupID_AppPrivArchComp,
|
---|
185 | kSupID_AppPrivNoArch,
|
---|
186 | kSupID_Testcase,
|
---|
187 | kSupID_End
|
---|
188 | } SUPINSTDIR;
|
---|
189 |
|
---|
190 | /**
|
---|
191 | * Installed file.
|
---|
192 | */
|
---|
193 | typedef struct SUPINSTFILE
|
---|
194 | {
|
---|
195 | /** File type. */
|
---|
196 | SUPINSTFILETYPE enmType;
|
---|
197 | /** Install directory. */
|
---|
198 | SUPINSTDIR enmDir;
|
---|
199 | /** Optional (true) or mandatory (false. */
|
---|
200 | bool fOptional;
|
---|
201 | /** File name. */
|
---|
202 | const char *pszFile;
|
---|
203 | } SUPINSTFILE;
|
---|
204 | typedef SUPINSTFILE *PSUPINSTFILE;
|
---|
205 | typedef SUPINSTFILE const *PCSUPINSTFILE;
|
---|
206 |
|
---|
207 | /**
|
---|
208 | * Status data for a verified file.
|
---|
209 | */
|
---|
210 | typedef struct SUPVERIFIEDFILE
|
---|
211 | {
|
---|
212 | /** The file handle or descriptor. -1 if not open. */
|
---|
213 | intptr_t hFile;
|
---|
214 | /** Whether the file has been validated. */
|
---|
215 | bool fValidated;
|
---|
216 | #ifdef RT_OS_WINDOWS
|
---|
217 | /** Whether we've checked the signature of the file. */
|
---|
218 | bool fCheckedSignature;
|
---|
219 | #endif
|
---|
220 | } SUPVERIFIEDFILE;
|
---|
221 | typedef SUPVERIFIEDFILE *PSUPVERIFIEDFILE;
|
---|
222 | typedef SUPVERIFIEDFILE const *PCSUPVERIFIEDFILE;
|
---|
223 |
|
---|
224 | /**
|
---|
225 | * Status data for a verified directory.
|
---|
226 | */
|
---|
227 | typedef struct SUPVERIFIEDDIR
|
---|
228 | {
|
---|
229 | /** The directory handle or descriptor. -1 if not open. */
|
---|
230 | intptr_t hDir;
|
---|
231 | /** Whether the directory has been validated. */
|
---|
232 | bool fValidated;
|
---|
233 | } SUPVERIFIEDDIR;
|
---|
234 | typedef SUPVERIFIEDDIR *PSUPVERIFIEDDIR;
|
---|
235 | typedef SUPVERIFIEDDIR const *PCSUPVERIFIEDDIR;
|
---|
236 |
|
---|
237 |
|
---|
238 | /**
|
---|
239 | * SUPLib instance data.
|
---|
240 | *
|
---|
241 | * This is data that is passed from the static to the dynamic SUPLib
|
---|
242 | * in a hardened setup.
|
---|
243 | */
|
---|
244 | typedef struct SUPLIBDATA
|
---|
245 | {
|
---|
246 | /** The device handle. */
|
---|
247 | #if defined(RT_OS_WINDOWS)
|
---|
248 | void *hDevice;
|
---|
249 | #else
|
---|
250 | int hDevice;
|
---|
251 | #endif
|
---|
252 | /** Indicates whether we have unrestricted (true) or restricted access to the
|
---|
253 | * support device. */
|
---|
254 | bool fUnrestricted;
|
---|
255 | #if defined(RT_OS_DARWIN)
|
---|
256 | /** The connection to the VBoxSupDrv service. */
|
---|
257 | uintptr_t uConnection;
|
---|
258 | #elif defined(RT_OS_LINUX)
|
---|
259 | /** Indicates whether madvise(,,MADV_DONTFORK) works. */
|
---|
260 | bool fSysMadviseWorks;
|
---|
261 | #elif defined(RT_OS_SOLARIS)
|
---|
262 | /** Extra dummy file descriptors to prevent growing file-descriptor table on
|
---|
263 | * clean up (see @bugref{4650}). */
|
---|
264 | int ahDummy[SUPLIB_FLT_DUMMYFILES];
|
---|
265 | #elif defined(RT_OS_WINDOWS)
|
---|
266 | #endif
|
---|
267 | } SUPLIBDATA;
|
---|
268 | /** Pointer to the pre-init data. */
|
---|
269 | typedef SUPLIBDATA *PSUPLIBDATA;
|
---|
270 | /** Pointer to const pre-init data. */
|
---|
271 | typedef SUPLIBDATA const *PCSUPLIBDATA;
|
---|
272 |
|
---|
273 | /** The NIL value of SUPLIBDATA::hDevice. */
|
---|
274 | #if defined(RT_OS_WINDOWS)
|
---|
275 | # define SUP_HDEVICE_NIL NULL
|
---|
276 | #else
|
---|
277 | # define SUP_HDEVICE_NIL (-1)
|
---|
278 | #endif
|
---|
279 |
|
---|
280 |
|
---|
281 | /**
|
---|
282 | * Pre-init data that is handed over from the hardened executable stub.
|
---|
283 | */
|
---|
284 | typedef struct SUPPREINITDATA
|
---|
285 | {
|
---|
286 | /** Magic value (SUPPREINITDATA_MAGIC). */
|
---|
287 | uint32_t u32Magic;
|
---|
288 | /** The SUPLib instance data. */
|
---|
289 | SUPLIBDATA Data;
|
---|
290 | /** The number of entries in paInstallFiles and paVerifiedFiles. */
|
---|
291 | size_t cInstallFiles;
|
---|
292 | /** g_aSupInstallFiles. */
|
---|
293 | PCSUPINSTFILE paInstallFiles;
|
---|
294 | /** g_aSupVerifiedFiles. */
|
---|
295 | PCSUPVERIFIEDFILE paVerifiedFiles;
|
---|
296 | /** The number of entries in paVerifiedDirs. */
|
---|
297 | size_t cVerifiedDirs;
|
---|
298 | /** g_aSupVerifiedDirs. */
|
---|
299 | PCSUPVERIFIEDDIR paVerifiedDirs;
|
---|
300 | /** Magic value (SUPPREINITDATA_MAGIC). */
|
---|
301 | uint32_t u32EndMagic;
|
---|
302 | } SUPPREINITDATA;
|
---|
303 | typedef SUPPREINITDATA *PSUPPREINITDATA;
|
---|
304 | typedef SUPPREINITDATA const *PCSUPPREINITDATA;
|
---|
305 |
|
---|
306 | /** Magic value for SUPPREINITDATA::u32Magic and SUPPREINITDATA::u32EndMagic. */
|
---|
307 | #define SUPPREINITDATA_MAGIC UINT32_C(0xbeef0001)
|
---|
308 |
|
---|
309 | /** @copydoc supR3PreInit */
|
---|
310 | typedef DECLCALLBACK(int) FNSUPR3PREINIT(PSUPPREINITDATA pPreInitData, uint32_t fFlags);
|
---|
311 | /** Pointer to supR3PreInit. */
|
---|
312 | typedef FNSUPR3PREINIT *PFNSUPR3PREINIT;
|
---|
313 |
|
---|
314 | /** The current SUPR3HardenedMain state / location. */
|
---|
315 | typedef enum SUPR3HARDENEDMAINSTATE
|
---|
316 | {
|
---|
317 | SUPR3HARDENEDMAINSTATE_NOT_YET_CALLED = 0,
|
---|
318 | SUPR3HARDENEDMAINSTATE_WIN_EARLY_INIT_CALLED,
|
---|
319 | SUPR3HARDENEDMAINSTATE_WIN_EARLY_IMPORTS_RESOLVED,
|
---|
320 | SUPR3HARDENEDMAINSTATE_WIN_EARLY_STUB_DEVICE_OPENED,
|
---|
321 | SUPR3HARDENEDMAINSTATE_WIN_EARLY_REAL_DEVICE_OPENED,
|
---|
322 | SUPR3HARDENEDMAINSTATE_WIN_EP_CALLED,
|
---|
323 | SUPR3HARDENEDMAINSTATE_WIN_IMPORTS_RESOLVED,
|
---|
324 | SUPR3HARDENEDMAINSTATE_WIN_VERSION_INITIALIZED,
|
---|
325 | SUPR3HARDENEDMAINSTATE_WIN_VERIFY_TRUST_READY,
|
---|
326 | SUPR3HARDENEDMAINSTATE_HARDENED_MAIN_CALLED,
|
---|
327 | SUPR3HARDENEDMAINSTATE_INIT_RUNTIME,
|
---|
328 | SUPR3HARDENEDMAINSTATE_GET_TRUSTED_MAIN,
|
---|
329 | SUPR3HARDENEDMAINSTATE_CALLED_TRUSTED_MAIN,
|
---|
330 | SUPR3HARDENEDMAINSTATE_END,
|
---|
331 | SUPR3HARDENEDMAINSTATE_32BIT_HACK = 0x7fffffff
|
---|
332 | } SUPR3HARDENEDMAINSTATE;
|
---|
333 |
|
---|
334 |
|
---|
335 | /*******************************************************************************
|
---|
336 | * Global Variables *
|
---|
337 | *******************************************************************************/
|
---|
338 | extern DECLHIDDEN(uint32_t) g_u32Cookie;
|
---|
339 | extern DECLHIDDEN(uint32_t) g_u32SessionCookie;
|
---|
340 | extern DECLHIDDEN(SUPLIBDATA) g_supLibData;
|
---|
341 | extern DECLHIDDEN(uint32_t) g_uSupFakeMode;
|
---|
342 | extern DECLHIDDEN(PSUPGLOBALINFOPAGE) g_pSUPGlobalInfoPageR0;
|
---|
343 | #ifdef VBOX_INCLUDED_SRC_Support_SUPDrvIOC_h
|
---|
344 | extern DECLHIDDEN(PSUPQUERYFUNCS) g_pSupFunctions;
|
---|
345 | #endif
|
---|
346 | extern DECLHIDDEN(SUPR3HARDENEDMAINSTATE) g_enmSupR3HardenedMainState;
|
---|
347 | #ifdef RT_OS_WINDOWS
|
---|
348 | extern DECLHIDDEN(bool) g_fSupEarlyProcessInit;
|
---|
349 | #endif
|
---|
350 |
|
---|
351 |
|
---|
352 | /*******************************************************************************
|
---|
353 | * OS Specific Function *
|
---|
354 | *******************************************************************************/
|
---|
355 | RT_C_DECLS_BEGIN
|
---|
356 | int suplibOsInstall(void);
|
---|
357 | int suplibOsUninstall(void);
|
---|
358 | int suplibOsInit(PSUPLIBDATA pThis, bool fPreInited, bool fUnrestricted, SUPINITOP *penmWhat, PRTERRINFO pErrInfo);
|
---|
359 | int suplibOsTerm(PSUPLIBDATA pThis);
|
---|
360 | int suplibOsHardenedVerifyInit(void);
|
---|
361 | int suplibOsHardenedVerifyTerm(void);
|
---|
362 | int suplibOsIOCtl(PSUPLIBDATA pThis, uintptr_t uFunction, void *pvReq, size_t cbReq);
|
---|
363 | int suplibOsIOCtlFast(PSUPLIBDATA pThis, uintptr_t uFunction, uintptr_t idCpu);
|
---|
364 | int suplibOsPageAlloc(PSUPLIBDATA pThis, size_t cPages, void **ppvPages);
|
---|
365 | int suplibOsPageFree(PSUPLIBDATA pThis, void *pvPages, size_t cPages);
|
---|
366 | int suplibOsQueryVTxSupported(const char **ppszWhy);
|
---|
367 | bool suplibOsIsNemSupportedWhenNoVtxOrAmdV(void);
|
---|
368 |
|
---|
369 |
|
---|
370 | /**
|
---|
371 | * Performs the pre-initialization of the support library.
|
---|
372 | *
|
---|
373 | * This is dynamically resolved and invoked by the static library before it
|
---|
374 | * calls RTR3InitEx and thereby SUPR3Init.
|
---|
375 | *
|
---|
376 | * @returns IPRT status code.
|
---|
377 | * @param pPreInitData The pre init data.
|
---|
378 | * @param fFlags The SUPR3HardenedMain flags.
|
---|
379 | */
|
---|
380 | DECLEXPORT(int) supR3PreInit(PSUPPREINITDATA pPreInitData, uint32_t fFlags);
|
---|
381 |
|
---|
382 |
|
---|
383 | /** @copydoc RTPathAppPrivateNoArch */
|
---|
384 | DECLHIDDEN(int) supR3HardenedPathAppPrivateNoArch(char *pszPath, size_t cchPath);
|
---|
385 | /** @copydoc RTPathAppPrivateArch */
|
---|
386 | DECLHIDDEN(int) supR3HardenedPathAppPrivateArch(char *pszPath, size_t cchPath);
|
---|
387 | /** @copydoc RTPathSharedLibs */
|
---|
388 | DECLHIDDEN(int) supR3HardenedPathAppSharedLibs(char *pszPath, size_t cchPath);
|
---|
389 | /** @copydoc RTPathAppDocs */
|
---|
390 | DECLHIDDEN(int) supR3HardenedPathAppDocs(char *pszPath, size_t cchPath);
|
---|
391 | /** @copydoc RTPathExecDir */
|
---|
392 | DECLHIDDEN(int) supR3HardenedPathAppBin(char *pszPath, size_t cchPath);
|
---|
393 | /** @copydoc RTPathFilename */
|
---|
394 | DECLHIDDEN(char *) supR3HardenedPathFilename(const char *pszPath);
|
---|
395 |
|
---|
396 | /**
|
---|
397 | * Display a fatal error and try call TrustedError or quit.
|
---|
398 | */
|
---|
399 | DECL_NO_RETURN(DECLHIDDEN(void)) supR3HardenedFatalMsgV(const char *pszWhere, SUPINITOP enmWhat, int rc,
|
---|
400 | const char *pszMsgFmt, va_list va);
|
---|
401 |
|
---|
402 | /**
|
---|
403 | * Display a fatal error and try call TrustedError or quit.
|
---|
404 | */
|
---|
405 | DECL_NO_RETURN(DECLHIDDEN(void)) supR3HardenedFatalMsg(const char *pszWhere, SUPINITOP enmWhat, int rc,
|
---|
406 | const char *pszMsgFmt, ...);
|
---|
407 |
|
---|
408 | /**
|
---|
409 | * Display a fatal error and quit.
|
---|
410 | */
|
---|
411 | DECL_NO_RETURN(DECLHIDDEN(void)) supR3HardenedFatalV(const char *pszFormat, va_list va);
|
---|
412 |
|
---|
413 | /**
|
---|
414 | * Display a fatal error and quit.
|
---|
415 | */
|
---|
416 | DECL_NO_RETURN(DECLHIDDEN(void)) supR3HardenedFatal(const char *pszFormat, ...);
|
---|
417 |
|
---|
418 | /**
|
---|
419 | * Display an error which may or may not be fatal.
|
---|
420 | */
|
---|
421 | DECLHIDDEN(int) supR3HardenedErrorV(int rc, bool fFatal, const char *pszFormat, va_list va);
|
---|
422 |
|
---|
423 | /**
|
---|
424 | * Display an error which may or may not be fatal.
|
---|
425 | */
|
---|
426 | DECLHIDDEN(int) supR3HardenedError(int rc, bool fFatal, const char *pszFormat, ...);
|
---|
427 |
|
---|
428 | /**
|
---|
429 | * Open any startup log file specified in the argument.
|
---|
430 | */
|
---|
431 | DECLHIDDEN(void) supR3HardenedOpenLog(int *pcArgs, char **papszArgs);
|
---|
432 |
|
---|
433 | /**
|
---|
434 | * Write to the startup log file.
|
---|
435 | */
|
---|
436 | DECLHIDDEN(void) supR3HardenedLogV(const char *pszFormat, va_list va);
|
---|
437 |
|
---|
438 | /**
|
---|
439 | * Write to the startup log file.
|
---|
440 | */
|
---|
441 | DECLHIDDEN(void) supR3HardenedLog(const char *pszFormat, ...);
|
---|
442 |
|
---|
443 | /**
|
---|
444 | * Flushes the log file.
|
---|
445 | */
|
---|
446 | DECLHIDDEN(void) supR3HardenedLogFlush(void);
|
---|
447 |
|
---|
448 |
|
---|
449 | DECLHIDDEN(int) supR3HardenedVerifyAll(bool fFatal, const char *pszProgName, const char *pszExePath, uint32_t fMainFlags);
|
---|
450 | DECLHIDDEN(int) supR3HardenedVerifyFixedDir(SUPINSTDIR enmDir, bool fFatal);
|
---|
451 | DECLHIDDEN(int) supR3HardenedVerifyFixedFile(const char *pszFilename, bool fFatal);
|
---|
452 | DECLHIDDEN(int) supR3HardenedVerifyDir(const char *pszDirPath, bool fRecursive, bool fCheckFiles, PRTERRINFO pErrInfo);
|
---|
453 | DECLHIDDEN(int) supR3HardenedVerifyFile(const char *pszFilename, RTHCUINTPTR hNativeFile, bool fMaybe3rdParty,
|
---|
454 | PRTERRINFO pErrInfo);
|
---|
455 | #if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX)
|
---|
456 | DECLHIDDEN(int) supR3HardenedVerifyFileFollowSymlinks(const char *pszFilename, RTHCUINTPTR hNativeFile, bool fMaybe3rdParty,
|
---|
457 | PRTERRINFO pErrInfo);
|
---|
458 | #endif
|
---|
459 | DECLHIDDEN(void) supR3HardenedGetPreInitData(PSUPPREINITDATA pPreInitData);
|
---|
460 | DECLHIDDEN(int) supR3HardenedRecvPreInitData(PCSUPPREINITDATA pPreInitData);
|
---|
461 |
|
---|
462 | #ifdef RT_OS_WINDOWS
|
---|
463 | DECLHIDDEN(void) supR3HardenedWinInit(uint32_t fFlags, bool fAvastKludge);
|
---|
464 | DECLHIDDEN(void) supR3HardenedWinInitAppBin(uint32_t fFlags);
|
---|
465 | DECLHIDDEN(void) supR3HardenedWinInitVersion(bool fEarlyInit);
|
---|
466 | DECLHIDDEN(void) supR3HardenedWinInitImports(void);
|
---|
467 | DECLHIDDEN(void) supR3HardenedWinModifyDllSearchPath(uint32_t fFlags, const char *pszAppBinPath);
|
---|
468 | # ifdef IPRT_INCLUDED_nt_nt_h
|
---|
469 | DECLHIDDEN(void) supR3HardenedWinGetVeryEarlyImports(uintptr_t uNtDllAddr,
|
---|
470 | PFNNTWAITFORSINGLEOBJECT *ppfnNtWaitForSingleObject,
|
---|
471 | PFNNTSETEVENT *ppfnNtSetEvent);
|
---|
472 | # endif
|
---|
473 | DECLHIDDEN(void) supR3HardenedWinInitImportsEarly(uintptr_t uNtDllAddr);
|
---|
474 | DECLHIDDEN(void) supR3HardenedWinInitSyscalls(bool fReportErrors, PRTERRINFO pErrInfo);
|
---|
475 | DECLHIDDEN(PFNRT) supR3HardenedWinGetRealDllSymbol(const char *pszDll, const char *pszProcedure);
|
---|
476 | DECLHIDDEN(void) supR3HardenedWinEnableThreadCreation(void);
|
---|
477 | DECLHIDDEN(void) supR3HardenedWinResolveVerifyTrustApiAndHookThreadCreation(const char *pszProgName);
|
---|
478 | DECLHIDDEN(void) supR3HardenedWinFlushLoaderCache();
|
---|
479 | DECLHIDDEN(bool) supR3HardenedWinIsReSpawnNeeded(int iWhich, int cArgs, char **papszArgs);
|
---|
480 | DECLHIDDEN(int) supR3HardenedWinReSpawn(int iWhich);
|
---|
481 | # ifdef _WINDEF_
|
---|
482 | DECLHIDDEN(void) supR3HardenedWinCreateParentWatcherThread(HMODULE hVBoxRT);
|
---|
483 | # endif
|
---|
484 | DECLHIDDEN(void *) supR3HardenedWinLoadLibrary(const char *pszName, bool fSystem32Only, uint32_t fMainFlags);
|
---|
485 | extern RTUTF16 g_wszSupLibHardenedExePath[1024];
|
---|
486 | # ifdef RTPATH_MAX
|
---|
487 | extern char g_szSupLibHardenedExePath[RTPATH_MAX];
|
---|
488 | # endif
|
---|
489 | DECLHIDDEN(void) supR3HardenedWinCompactHeaps(void);
|
---|
490 | DECLHIDDEN(void) supR3HardenedMainOpenDevice(void);
|
---|
491 | DECLHIDDEN(char *) supR3HardenedWinReadErrorInfoDevice(char *pszErrorInfo, size_t cbErrorInfo, const char *pszPrefix);
|
---|
492 | DECLHIDDEN(void) supR3HardenedWinReportErrorToParent(const char *pszWhere, SUPINITOP enmWhat, int rc,
|
---|
493 | const char *pszFormat, va_list va);
|
---|
494 | #else /* !RT_OS_WINDOWS */
|
---|
495 | DECLHIDDEN(void) supR3HardenedPosixInit(void);
|
---|
496 | #endif /* !RT_OS_WINDOWS */
|
---|
497 |
|
---|
498 | SUPR3DECL(int) supR3PageLock(void *pvStart, size_t cPages, PSUPPAGE paPages);
|
---|
499 | SUPR3DECL(int) supR3PageUnlock(void *pvStart);
|
---|
500 |
|
---|
501 | RT_C_DECLS_END
|
---|
502 |
|
---|
503 |
|
---|
504 | #endif /* !VBOX_INCLUDED_SRC_Support_SUPLibInternal_h */
|
---|
505 |
|
---|