VirtualBox

source: vbox/trunk/src/VBox/HostDrivers/Support/Makefile.kmk@ 107044

Last change on this file since 107044 was 106998, checked in by vboxsync, 12 days ago

SUPHardNt: Fixed two more bugs from r165898, first more mixing of TAFs and X.509 certs, second that SUPR3HARDNTPATCH should be a struct not a union. jiraref:VBP-1442

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 37.9 KB
Line 
1# $Id: Makefile.kmk 106998 2024-11-14 01:14:23Z vboxsync $
2## @file
3# Sub-Makefile for the support library and the drivers/modules/kexts it uses.
4#
5
6#
7# Copyright (C) 2006-2024 Oracle and/or its affiliates.
8#
9# This file is part of VirtualBox base platform packages, as
10# available from https://www.virtualbox.org.
11#
12# This program is free software; you can redistribute it and/or
13# modify it under the terms of the GNU General Public License
14# as published by the Free Software Foundation, in version 3 of the
15# License.
16#
17# This program is distributed in the hope that it will be useful, but
18# WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20# General Public License for more details.
21#
22# You should have received a copy of the GNU General Public License
23# along with this program; if not, see <https://www.gnu.org/licenses>.
24#
25# The contents of this file may alternatively be used under the terms
26# of the Common Development and Distribution License Version 1.0
27# (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
28# in the VirtualBox distribution, in which case the provisions of the
29# CDDL are applicable instead of those of the GPL.
30#
31# You may elect to license modified versions of this file under the
32# terms and conditions of either the GPL or the CDDL or both.
33#
34# SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
35#
36
37SUB_DEPTH = ../../../..
38include $(KBUILD_PATH)/subheader.kmk
39
40#
41# Globals.
42#
43VBOX_PATH_SUP_SRC := $(PATH_SUB_CURRENT)
44VBOX_PATH_SUPR3_CERTIFICATES := $(PATH_SUB_CURRENT)/Certificates
45VBOX_PATH_RUNTIME_SRC ?= $(PATH_ROOT)/src/VBox/Runtime
46
47
48#
49# Targets
50#
51if "$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)" != "linux.arm64" || defined(VBOX_WITH_STATIC_ARM64_PAGE_SHIFT) # @todo Required by LoadGenerator in the validationkit but uses PAGE_SIZE++
52 LIBRARIES += SUPR3 SUPR3Static
53endif
54if defined(VBOX_WITH_HARDENING) \
55 && !defined(VBOX_ONLY_VALIDATIONKIT)
56 LIBRARIES += SUPR3HardenedStatic
57endif
58ifndef VBOX_ONLY_BUILD
59 ifdef VBOX_WITH_HARDENING
60 DLLS.win += VBoxSupLib
61 endif
62endif
63ifdef VBOX_WITH_32_ON_64_MAIN_API
64 LIBRARIES += SUPR3-x86
65endif
66if !defined(VBOX_ONLY_DOCS)
67 if1of ($(VBOX_LDR_FMT), pe lx)
68 LIBRARIES += SUPR0
69 endif
70endif
71if !defined(VBOX_ONLY_BUILD) && defined(VBOX_WITH_RAW_MODE)
72 LIBRARIES += SUPRC
73endif
74if !defined(VBOX_ONLY_DOCS) \
75 && !defined(VBOX_ONLY_EXTPACKS) \
76 && !defined(VBOX_ONLY_VALIDATIONKIT) \
77 && "$(intersects $(KBUILD_TARGET_ARCH),$(VBOX_SUPPORTED_HOST_ARCHS))" != ""
78 ifdef VBOX_WITH_SUPSVC
79 PROGRAMS += VBoxSupSvc
80 endif
81 ifdef VBOX_WITH_VBOXDRV
82 LIBRARIES += SUPR0IdcClient
83 SYSMODS.os2 += VBoxDrv
84 endif
85 INSTALLS.linux += vboxdrv-src
86 INSTALLS.freebsd += vboxdrv-src
87
88 #
89 # Include sub-makefile(s).
90 #
91 include $(PATH_SUB_CURRENT)/testcase/Makefile.kmk
92
93 #
94 # Populate FILES_VBOXDRV_NOBIN and FILES_VBOXDRV_BIN
95 #
96 ifeq ($(KBUILD_TARGET),linux)
97 include $(PATH_SUB_CURRENT)/linux/files_vboxdrv
98 endif
99 ifeq ($(KBUILD_TARGET),freebsd)
100 include $(PATH_SUB_CURRENT)/freebsd/files_vboxdrv
101 endif
102endif # !VBOX_ONLY_DOCS && !VBOX_ONLY_EXTPACKS && !VBOX_ONLY_VALIDATIONKIT
103
104#
105# Authenticode related trust anchors and certificates -> .cpp
106#
107VBOX_SUP_WIN_CERTS_FILE = $(SUPR3_0_OUTDIR)/TrustAnchorsAndCerts.cpp
108VBOX_SUP_WIN_CERTS := \
109 SpcRootMicrosoft0=SpcRoot-MicrosoftAuthenticodeTmRootAuthority-01.taf \
110 SpcRootMicrosoft1=SpcRoot-MicrosoftRootAuthority-00c1008b3c3c8811d13ef663ecdf40.taf \
111 SpcRootMicrosoft2=SpcRoot-MicrosoftRootCertificateAuthority-79ad16a14aa0a5ad4c7358f407132e65.taf \
112 SpcRootMicrosoft3=SpcRoot-MicrosoftRootCertificateAuthority2010-28cc3a25bfba44ac449a9b586b4339aa.taf \
113 SpcRootMicrosoft4=SpcRoot-MicrosoftRootCertificateAuthority2011-3f8bc8b5fc9fb29643b569d66c42e144.taf \
114 SpcRootMicrosoft5=SpcRoot-MicrosoftDigitalMediaAuthority2005-6eff330eb6e7569740680870104baaba.taf \
115 SpcRootMicrosoft6=SpcRoot-MicrosoftDevelopmentRootCertificateAuthority2014-078f0a9d03df119e434e4fec1bf0235a.taf \
116 SpcRootMicrosoft7=SpcRoot-MicrosoftTestingRootCertificateAuthority2010-8a334aa8052dd244a647306a76b8178fa215f344.taf \
117 NtRootMicrosoft8=NtRoot-MicrosoftCodeVerificationRoot-729404101f3e0ca347837fca175a8438.taf \
118 TimeRootMicrosoft0=Timestamp-CopyrightC1997MicrosoftCorp-01.taf \
119 TimeRootOracle0=Timestamp-VBoxLegacyWinCA.taf \
120 TimeRootOracle1=Timestamp-VBoxLegacyWinSha1CA.taf \
121 TrustedCertVBox0=Trusted-OracleCorporationVirtualBox-05308b76ac2e15b29720fb4395f65f38.taf \
122 TrustedCertVBox1=Trusted-OracleAmerica-060e2f8f9e1b8be518d5fe2b69cfccb1.taf \
123 AppleRoot0=AppleRoot-2bd06947947609fef46b8d2e40a6f7474d7f085e.taf \
124 AppleRoot1=AppleRoot-G2-c499136c1803c27bc0a3a00d7f72807a1c77268d.taf
125# Hack Alert! Because the DigiCert cross signing certificate we use expired 2020-04-15, we add it as a trusted NT kernel
126# signing root instead, so we can bypass the expiry check in IPRT. NtRootMicrosoft8 is the one found in the
127# 6.1.20 extpack, NtRootMicrosoft9 is the one bird uses at home.
128VBOX_SUP_WIN_CERTS += NtRootDigiCert8=NtRoot-CrossSign-DigiCertAssuredIDRootCA-589567a6c1944d68f11ff3d86576092b.taf
129VBOX_SUP_WIN_CERTS += NtRootDigiCert9=NtRoot-CrossSign-DigiCertHighAssuranceEVRootCA-f4a38dbe86386c554d25f1ce2557a4fe.taf
130
131VBOX_SUP_WIN_CERT_NAMES := $(foreach cert,$(VBOX_SUP_WIN_CERTS),$(firstword $(subst =,$(SPACE) ,$(cert))))
132
133# 1=name, 2=filter, 3=buildcert?.
134if "$(KBUILD_TARGET)" == "win" && defined(VBOX_WITH_HARDENING)
135 VBOX_SUP_GEN_CERT_MACRO = 'SUPTAENTRY const g_aSUP$(1)TAs[] =' '{' \
136 $(if-expr "$(3)" == "",,' SUPTAENTRY_CER(g_abSUPBuildCert),') \
137 $(foreach certnm,$(filter $(2),$(VBOX_SUP_WIN_CERT_NAMES)), ' SUPTAENTRY_TAF(g_abSUP$(certnm)),') \
138 '};' 'unsigned const g_cSUP$(1)TAs = RT_ELEMENTS(g_aSUP$(1)TAs);' '' ''
139else
140 VBOX_SUP_GEN_CERT_MACRO = 'SUPTAENTRY const g_aSUP$(1)TAs[] =' '{' \
141 $(foreach certnm,$(filter $(2),$(VBOX_SUP_WIN_CERT_NAMES)), ' SUPTAENTRY_TAF(g_abSUP$(certnm)),') \
142 '};' 'unsigned const g_cSUP$(1)TAs = RT_ELEMENTS(g_aSUP$(1)TAs);' '' ''
143endif
144
145if ("$(KBUILD_TARGET)" == "win" && defined(VBOX_SIGNING_MODE)) \
146 || ("$(KBUILD_TARGET)" == "darwin" && defined(VBOX_WITH_DARWIN_R0_DARWIN_IMAGE_VERIFICATION) && defined(VBOX_SIGNING_MODE))
147 BLDPROGS += bldSUPSignedDummy
148 bldSUPSignedDummy_TEMPLATE = VBoxBldProg
149 bldSUPSignedDummy_SOURCES = bldSUPSignedDummy.cpp
150 bldSUPSignedDummy_ORDERDEPS.win = $(VBOX_SIGN_IMAGE_ORDERDEPS)
151 bldSUPSignedDummy_POST_CMDS.win = $(call VBOX_SIGN_IMAGE_FN,$(out),,2)
152 bldSUPSignedDummy_POST_CMDS.darwin = $(call VBOX_SIGN_MACHO_FN,$(out),org.virtualbox.org.bldtool.$(target))
153endif
154
155$$(VBOX_SUP_WIN_CERTS_FILE): $(MAKEFILE_CURRENT) \
156 $(foreach cert,$(VBOX_SUP_WIN_CERTS),$(VBOX_PATH_SUPR3_CERTIFICATES)/$(lastword $(subst =,$(SPACE) ,$(cert)))) \
157 $(VBOX_BIN2C) \
158 $(if-expr defined(bldSUPSignedDummy_SOURCES),$(VBOX_RTSIGNTOOL) $$(bldSUPSignedDummy_1_TARGET),) \
159 | $$(dir $$@)
160 $(QUIET)$(RM) -f -- $@ $@.cer
161 $(QUIET)$(APPEND) -n "$@" \
162 '' \
163 '#include <VBox/sup.h>' \
164 '#include <iprt/crypto/store.h>' \
165 ''
166 $(foreach cert,$(VBOX_SUP_WIN_CERTS), $(NLTAB)$(VBOX_BIN2C) -ascii --append --static --no-size \
167 "SUP$(firstword $(subst =,$(SP) ,$(cert)))" \
168 "$(VBOX_PATH_SUPR3_CERTIFICATES)/$(lastword $(subst =,$(SP) ,$(cert)))" \
169 "$@")
170# The build certificate.
171ifdef bldSUPSignedDummy_SOURCES
172 $(VBOX_RTSIGNTOOL) extract-exe-signer-cert --exe "$(bldSUPSignedDummy_1_TARGET)" --output "$@.cer" --der
173 $(VBOX_BIN2C) -ascii --append SUPBuildCert "$@.cer" $@
174 $(QUIET)$(RM) -f -- $@.cer
175endif
176# Generate certificate lists.
177 $(QUIET)$(APPEND) -n "$@" '' \
178 $(call VBOX_SUP_GEN_CERT_MACRO,All,%,build) \
179 $(call VBOX_SUP_GEN_CERT_MACRO,SpcRoot,SpcRoot%) \
180 $(call VBOX_SUP_GEN_CERT_MACRO,NtKernelRoot,NtRoot%) \
181 $(call VBOX_SUP_GEN_CERT_MACRO,Timestamp,TimeRoot%) \
182 $(call VBOX_SUP_GEN_CERT_MACRO,AppleRoot,AppleRoot%) \
183 $(call VBOX_SUP_GEN_CERT_MACRO,Trusted,TrustedCert%,build)
184
185OTHER_CLEAN += $(VBOX_SUP_WIN_CERTS_FILE)
186
187tst: $(VBOX_SUP_WIN_CERTS_FILE)
188
189
190#
191# The Ring-3 Support Library (this is linked into the IPRT dll, VBoxRT).
192#
193SUPR3_TEMPLATE = VBoxR3Dll
194SUPR3_DEFS = \
195 IN_SUP_R3 IN_RT_R3 \
196 $(if $(VBOX_WITH_SUPSVC),VBOX_WITH_SUPSVC) \
197 $(if $(VBOX_WITH_MAIN),VBOX_WITH_MAIN,) \
198 $(if $(VBOX_WITH_RAW_MODE),VBOX_WITH_RAW_MODE,) \
199 $(if $(VBOX_WITH_DRIVERLESS_NEM_FALLBACK),VBOX_WITH_DRIVERLESS_NEM_FALLBACK,) \
200 VBOX_PERMIT_MORE \
201 VBOX_PERMIT_EVEN_MORE
202SUPR3_INCS := $(PATH_SUB_CURRENT)
203SUPR3_SOURCES = \
204 SUPLib.cpp \
205 SUPLibLdr.cpp \
206 SUPLibSem.cpp \
207 SUPLibAll.cpp \
208 SUPR3HardenedIPRT.cpp \
209 SUPR3HardenedVerify.cpp \
210 $(KBUILD_TARGET)/SUPLib-$(KBUILD_TARGET).cpp \
211 $(VBOX_SUP_WIN_CERTS_FILE)
212SUPR3_SOURCES.amd64 = \
213 SUPLibTracerA.asm
214SUPR3_SOURCES.x86 = \
215 SUPLibTracerA.asm
216ifdef VBOX_WITH_HARDENING
217 SUPR3_SOURCES.win = \
218 win/SUPHardenedVerifyImage-win.cpp
219endif
220
221SUPR3-x86_TEMPLATE = VBoxR3Dll-x86
222SUPR3-x86_EXTENDS = SUPR3
223
224
225#
226# Static version of SUPR3. This is more of a stub than anything else in a
227# hardened build, at least on windows.
228#
229SUPR3Static_TEMPLATE := VBoxR3Static
230SUPR3Static_EXTENDS := SUPR3
231SUPR3Static_DEFS = $(SUPR3_DEFS) IN_SUP_R3_STATIC
232SUPR3Static_SOURCES.win = $(filter-out win/SUPHardenedVerifyImage-win.cpp, $(SUPR3_SOURCES.win))
233
234
235#
236# The static part of the hardened support library (ring-3).
237#
238SUPR3HardenedStatic_TEMPLATE = VBoxR3HardenedLib
239SUPR3HardenedStatic_DEFS = IN_SUP_HARDENED_R3
240SUPR3HardenedStatic_DEFS += \
241 $(if $(VBOX_WITH_SUPSVC),VBOX_WITH_SUPSVC,) \
242 $(if $(VBOX_WITH_MAIN),VBOX_WITH_MAIN,) \
243 $(if $(VBOX_WITH_RAW_MODE),VBOX_WITH_RAW_MODE,) \
244 $(if $(VBOX_WITH_DRIVERLESS_NEM_FALLBACK),VBOX_WITH_DRIVERLESS_NEM_FALLBACK,) \
245 $(if $(VBOX_WITHOUT_DEBUGGER_CHECKS),VBOX_WITHOUT_DEBUGGER_CHECKS,) \
246 $(if $(VBOX_WITHOUT_WINDOWS_KERNEL_CODE_SIGNING_CERT),VBOX_WITHOUT_WINDOWS_KERNEL_CODE_SIGNING_CERT,) \
247 $(if $(VBOX_PERMIT_VISUAL_STUDIO_PROFILING),VBOX_PERMIT_VISUAL_STUDIO_PROFILING,) \
248 VBOX_PERMIT_MORE \
249 VBOX_PERMIT_EVEN_MORE
250ifdef VBOX_WITH_VISTA_NO_SP
251 SUPR3HardenedStatic_DEFS.win += VBOX_WITH_VISTA_NO_SP
252endif
253SUPR3HardenedStatic_INCS = .
254SUPR3HardenedStatic_SOURCES = \
255 SUPR3HardenedMain.cpp \
256 SUPR3HardenedVerify.cpp \
257 SUPR3HardenedNoCrt.cpp \
258 $(KBUILD_TARGET)/SUPLib-$(KBUILD_TARGET).cpp
259SUPR3HardenedStatic_SOURCES.win = \
260 win/SUPR3HardenedMain-win.cpp \
261 win/SUPR3HardenedMainImports-win.cpp \
262 win/SUPHardenedVerifyProcess-win.cpp \
263 win/SUPHardenedVerifyImage-win.cpp \
264 $(VBOX_SUP_WIN_CERTS_FILE)
265SUPR3HardenedStatic_SOURCES.x86 += \
266 win/SUPR3HardenedMainA-win.asm \
267 $(VBOX_PATH_RUNTIME_SRC)/common/asm/ASMMemFirstMismatchingU8.asm
268SUPR3HardenedStatic_SOURCES.amd64 += \
269 win/SUPR3HardenedMainA-win.asm \
270 $(VBOX_PATH_RUNTIME_SRC)/common/asm/ASMMemFirstMismatchingU8.asm
271
272
273if "$(KBUILD_TARGET)" == "win" && defined(VBOX_WITH_HARDENING) && !defined(VBOX_ONLY_VALIDATIONKIT) ## @todo some of this move up.
274 SUPR3HardenedStatic_DEFS += \
275 IN_RT_R3 \
276 IN_RT_STATIC \
277 IN_DIS \
278 IN_DIS_STATIC \
279 DIS_CORE_ONLY \
280 VBOX_DIS_WITH_X86_AMD64 \
281 IPRT_NO_CRT \
282 RT_WITH_NOCRT_ALIASES \
283 LOG_DISABLED \
284 IPRT_NO_ERROR_DATA \
285 IPRT_WITHOUT_DIGEST_MD4
286 SUPR3HardenedStatic_DEFS.win += LDR_ONLY_PE __STRALIGN_H_
287
288 SUPR3HardenedStatic_INCS += $(PATH_ROOT)/include/iprt/nocrt $(VBOX_PATH_RUNTIME_SRC)/include
289
290 SUPR3HardenedStatic_SOURCES += \
291 $(VBOX_PATH_RUNTIME_SRC)/common/ldr/ldr.cpp \
292 $(VBOX_PATH_RUNTIME_SRC)/common/ldr/ldrEx.cpp \
293 $(VBOX_PATH_RUNTIME_SRC)/common/ldr/ldrPE.cpp \
294 $(VBOX_PATH_RUNTIME_SRC)/common/alloc/heapsimple.cpp \
295 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-basics.cpp \
296 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-cursor.cpp \
297 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-default-allocator.cpp \
298 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-safer-allocator.cpp \
299 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-dump.cpp \
300 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-encode.cpp \
301 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-bitstring.cpp \
302 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-bitstring-decode.cpp \
303 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-boolean.cpp \
304 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-boolean-decode.cpp \
305 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-core.cpp \
306 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-core-decode.cpp \
307 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-dyntype.cpp \
308 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-dyntype-decode.cpp \
309 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-integer.cpp \
310 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-integer-decode.cpp \
311 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-null.cpp \
312 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-null-decode.cpp \
313 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-objid.cpp \
314 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-objid-decode.cpp \
315 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-octetstring.cpp \
316 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-octetstring-decode.cpp \
317 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-string.cpp \
318 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-string-decode.cpp \
319 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-time.cpp \
320 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-time-decode.cpp \
321 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/digest-core.cpp \
322 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/digest-builtin.cpp \
323 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/key.cpp \
324 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkcs7-asn1-decoder.cpp \
325 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkcs7-core.cpp \
326 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkcs7-init.cpp \
327 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkcs7-sanity.cpp \
328 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkcs7-verify.cpp \
329 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkix-signature-builtin.cpp \
330 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkix-signature-core.cpp \
331 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkix-signature-rsa.cpp \
332 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkix-verify.cpp \
333 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkix-util.cpp \
334 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/rsa-asn1-decoder.cpp \
335 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/rsa-core.cpp \
336 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/rsa-init.cpp \
337 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/rsa-sanity.cpp \
338 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/spc-asn1-decoder.cpp \
339 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/spc-core.cpp \
340 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/spc-init.cpp \
341 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/spc-sanity.cpp \
342 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/x509-asn1-decoder.cpp \
343 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/x509-certpaths.cpp \
344 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/x509-core.cpp \
345 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/x509-init.cpp \
346 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/x509-sanity.cpp \
347 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/x509-verify.cpp \
348 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/store.cpp \
349 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/store-inmem.cpp \
350 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/taf-asn1-decoder.cpp \
351 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/taf-core.cpp \
352 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/taf-init.cpp \
353 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/taf-sanity.cpp \
354 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/tsp-asn1-decoder.cpp \
355 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/tsp-core.cpp \
356 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/tsp-init.cpp \
357 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/tsp-sanity.cpp \
358 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/alt-md2.cpp \
359 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/alt-md5.cpp \
360 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/alt-sha1.cpp \
361 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/alt-sha256.cpp \
362 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/alt-sha512.cpp \
363 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/alt-sha3.cpp \
364 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/md2str.cpp \
365 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/md5str.cpp \
366 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/sha1str.cpp \
367 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/sha256str.cpp \
368 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/sha384str.cpp \
369 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/sha512str.cpp \
370 $(VBOX_PATH_RUNTIME_SRC)/common/err/errinfo.cpp \
371 $(VBOX_PATH_RUNTIME_SRC)/common/path/RTPathChangeToUnixSlashes.cpp \
372 $(VBOX_PATH_RUNTIME_SRC)/common/path/RTPathExt.cpp \
373 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTUtf16PrintHexBytes.cpp \
374 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTUtf16ICmpAscii.cpp \
375 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTUtf16NICmpAscii.cpp \
376 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTUtf16CatAscii.cpp \
377 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTUtf16CopyAscii.cpp \
378 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTUtf16End.cpp \
379 $(VBOX_PATH_RUNTIME_SRC)/common/string/strstrip.cpp \
380 \
381 $(VBOX_PATH_RUNTIME_SRC)/common/err/errmsg.cpp \
382 $(VBOX_PATH_RUNTIME_SRC)/common/math/bignum.cpp \
383 $(VBOX_PATH_RUNTIME_SRC)/common/misc/RTAssertMsg1Weak.cpp \
384 $(VBOX_PATH_RUNTIME_SRC)/common/misc/RTAssertMsg2.cpp \
385 $(VBOX_PATH_RUNTIME_SRC)/common/misc/RTAssertMsg2Weak.cpp \
386 $(VBOX_PATH_RUNTIME_SRC)/common/misc/RTAssertMsg2WeakV.cpp \
387 $(VBOX_PATH_RUNTIME_SRC)/common/path/RTPathAbsEx.cpp \
388 $(VBOX_PATH_RUNTIME_SRC)/common/path/RTPathFilename.cpp \
389 $(VBOX_PATH_RUNTIME_SRC)/common/path/RTPathParse.cpp \
390 $(VBOX_PATH_RUNTIME_SRC)/common/path/RTPathParsedReassemble.cpp \
391 $(VBOX_PATH_RUNTIME_SRC)/common/string/strversion.cpp \
392 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTStrPrintHexBytes.cpp \
393 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTStrCat.cpp \
394 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTStrCmp.cpp \
395 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTStrCopy.cpp \
396 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTStrICmpAscii.cpp \
397 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTStrNCmp.cpp \
398 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTStrNLen.cpp \
399 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTUtf16Copy.cpp \
400 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTUtf16NLenEx.cpp \
401 $(VBOX_PATH_RUNTIME_SRC)/common/string/strformat.cpp \
402 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTStrFormat.cpp \
403 $(VBOX_PATH_RUNTIME_SRC)/common/string/strformatrt.cpp \
404 $(VBOX_PATH_RUNTIME_SRC)/common/string/strformattype.cpp \
405 $(VBOX_PATH_RUNTIME_SRC)/common/string/strformatnum.cpp \
406 $(VBOX_PATH_RUNTIME_SRC)/common/string/stringalloc.cpp \
407 $(VBOX_PATH_RUNTIME_SRC)/common/string/strprintf.cpp \
408 $(VBOX_PATH_RUNTIME_SRC)/common/string/strprintf-ellipsis.cpp \
409 $(VBOX_PATH_RUNTIME_SRC)/common/string/strprintf2.cpp \
410 $(VBOX_PATH_RUNTIME_SRC)/common/string/strprintf2-ellipsis.cpp \
411 $(VBOX_PATH_RUNTIME_SRC)/common/string/strtonum.cpp \
412 $(VBOX_PATH_RUNTIME_SRC)/common/string/utf-16.cpp \
413 $(VBOX_PATH_RUNTIME_SRC)/common/string/utf-8.cpp \
414 $(VBOX_PATH_RUNTIME_SRC)/common/string/utf-8-case.cpp \
415 $(VBOX_PATH_RUNTIME_SRC)/common/string/unidata-upper.cpp \
416 $(VBOX_PATH_RUNTIME_SRC)/common/string/unidata-lower.cpp \
417 $(VBOX_PATH_RUNTIME_SRC)/common/time/time.cpp \
418 $(VBOX_PATH_RUNTIME_SRC)/generic/RTAssertShouldPanic-generic.cpp \
419 $(VBOX_PATH_RUNTIME_SRC)/generic/RTPathGetCurrentDrive-generic.cpp \
420 $(VBOX_PATH_RUNTIME_SRC)/generic/RTPathGetCurrentOnDrive-generic.cpp \
421 $(VBOX_PATH_RUNTIME_SRC)/generic/rtStrFormatKernelAddress-generic.cpp \
422 $(VBOX_PATH_RUNTIME_SRC)/generic/memsafer-generic.cpp \
423 $(VBOX_PATH_RUNTIME_SRC)/generic/uuid-generic.cpp \
424 \
425 ../../Disassembler/Disasm.cpp \
426 ../../Disassembler/DisasmCore-x86-amd64.cpp \
427 ../../Disassembler/DisasmTables-x86-amd64.cpp \
428 ../../Disassembler/DisasmTablesX64.cpp \
429 ../../Disassembler/DisasmMisc.cpp
430
431 SUPR3HardenedStatic_SOURCES.amd64 += \
432 $(VBOX_PATH_RUNTIME_SRC)/common/string/memchr.asm \
433 $(VBOX_PATH_RUNTIME_SRC)/common/string/memcmp.asm \
434 $(VBOX_PATH_RUNTIME_SRC)/common/string/memcpy.asm \
435 $(VBOX_PATH_RUNTIME_SRC)/common/string/memmove.asm \
436 $(VBOX_PATH_RUNTIME_SRC)/common/string/mempcpy.asm \
437 $(VBOX_PATH_RUNTIME_SRC)/common/string/memset.asm \
438 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTStrEnd.asm \
439 $(VBOX_PATH_RUNTIME_SRC)/common/string/strchr.asm \
440 $(VBOX_PATH_RUNTIME_SRC)/common/string/strcmp.asm \
441 $(VBOX_PATH_RUNTIME_SRC)/common/string/strcpy.asm \
442 $(VBOX_PATH_RUNTIME_SRC)/common/string/strlen.asm \
443 $(VBOX_PATH_RUNTIME_SRC)/common/string/strncmp.asm \
444 $(VBOX_PATH_RUNTIME_SRC)/common/string/strncpy.asm \
445 $(VBOX_PATH_RUNTIME_SRC)/common/misc/zero.asm \
446 $(VBOX_PATH_RUNTIME_SRC)/common/math/RTUInt128MulByU64.asm \
447 $(VBOX_PATH_RUNTIME_SRC)/common/math/bignum-amd64-x86.asm \
448 $(VBOX_PATH_RUNTIME_SRC)/win/amd64/ASMGetCS.asm \
449 $(VBOX_PATH_RUNTIME_SRC)/win/amd64/ASMGetSS.asm
450
451 SUPR3HardenedStatic_SOURCES.win += \
452 win/SUPR3HardenedNoCrt-win.cpp \
453 $(VBOX_PATH_RUNTIME_SRC)/nt/RTErrConvertFromNtStatus.cpp \
454 $(VBOX_PATH_RUNTIME_SRC)/nt/RTNtPathFindPossible8dot3Name.cpp \
455 $(VBOX_PATH_RUNTIME_SRC)/nt/RTNtPathExpand8dot3Path.cpp \
456 $(VBOX_PATH_RUNTIME_SRC)/nt/RTNtPathExpand8dot3PathA.cpp \
457 $(VBOX_PATH_RUNTIME_SRC)/r3/nt/pathint-nt.cpp \
458 $(VBOX_PATH_RUNTIME_SRC)/win/RTErrConvertFromWin32.cpp \
459 $(VBOX_PATH_RUNTIME_SRC)/win/errmsgwin.cpp
460
461 # Add necessary compiler specific files from the compiler lib dir.
462 ifeq ($(KBUILD_TARGET),win)
463 ## @todo use the nocrt variants of this glue code!
464
465 include $(KBUILD_PATH)/tools/$(VBOX_VCC_TOOL).kmk
466 SUPR3HardenedStatic_SOURCES.win += \
467 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/chkstk.obj
468
469 # And a few extracted from the static libc to support -guard and cookes.
470 # In 14.2 these files does not import anything from the win32 API and are
471 # mostly tiny bits of code. Needs not initialization that I can spot.
472 ifneq ($(VBOX_VCC_LD_GUARD_CF),)
473 SUPR3HardenedStatic_SOURCES.win += \
474 $(SUPR3HardenedStatic_0_OUTDIR)/loadcfg.obj
475 # These are for the /guard option.
476 SUPR3HardenedStatic_SOURCES.win += \
477 $(SUPR3HardenedStatic_0_OUTDIR)/gs_cookie.obj \
478 $(SUPR3HardenedStatic_0_OUTDIR)/guard_support.obj
479 SUPR3HardenedStatic_SOURCES.win.amd64 += \
480 $(SUPR3HardenedStatic_0_OUTDIR)/guard_dispatch.obj \
481 $(SUPR3HardenedStatic_0_OUTDIR)/guard_xfg_dispatch.obj
482 SUPR3HardenedStatic_SOURCES.win.arm64 += \
483 $(SUPR3HardenedStatic_0_OUTDIR)/guard_dispatch.obj
484 # These next ones are for supporting the /GS option. We skip gs_report.obj as it
485 # import lots from kernel32 and we're better of reporting the problem ourselves.
486 SUPR3HardenedStatic_SOURCES.win.amd64 += \
487 $(SUPR3HardenedStatic_0_OUTDIR)/amdsecgs.obj \
488 $(SUPR3HardenedStatic_0_OUTDIR)/gshandler.obj
489 SUPR3HardenedStatic_SOURCES.win.x86 += \
490 $(SUPR3HardenedStatic_0_OUTDIR)/secchk.obj \
491 $(SUPR3HardenedStatic_0_OUTDIR)/alloca16.obj
492
493 $$(SUPR3HardenedStatic_0_OUTDIR)/loadcfg.obj \
494 $$(SUPR3HardenedStatic_0_OUTDIR)/gs_cookie.obj \
495 $$(SUPR3HardenedStatic_0_OUTDIR)/guard_support.obj \
496 $$(SUPR3HardenedStatic_0_OUTDIR)/guard_dispatch.obj \
497 $$(SUPR3HardenedStatic_0_OUTDIR)/guard_xfg_dispatch.obj \
498 $$(SUPR3HardenedStatic_0_OUTDIR)/amdsecgs.obj \
499 $$(SUPR3HardenedStatic_0_OUTDIR)/gs_report.obj \
500 $$(SUPR3HardenedStatic_0_OUTDIR)/gshandler.obj \
501 $$(SUPR3HardenedStatic_0_OUTDIR)/secchk.obj \
502 $$(SUPR3HardenedStatic_0_OUTDIR)/alloca16.obj: \
503 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/libcmt.lib | $$(dir $$@)
504 set -x; $(TOOL_$(VBOX_VCC_TOOL)_AR) "/EXTRACT:$$($(TOOL_$(VBOX_VCC_TOOL)_AR) /LIST "$<" | $(SED_EXT) -e '/$(notdir $@)/!d' -e '/arm64ec/d' )" "/OUT:$@" "$<"
505 endif
506 endif
507endif
508
509# macOS specifics.
510ifeq ($(KBUILD_TARGET),darwin)
511 SUPR3HardenedStatic_DEFS += \
512 LOG_DISABLED
513
514 SUPR3HardenedStatic_INCS += $(VBOX_PATH_RUNTIME_SRC)/include
515
516 SUPR3HardenedStatic_SOURCES += \
517 darwin/SUPR3HardenedMain-darwin.cpp \
518 \
519 $(VBOX_PATH_RUNTIME_SRC)/common/misc/RTAssertMsg1Weak.cpp \
520 $(VBOX_PATH_RUNTIME_SRC)/common/misc/RTAssertMsg2.cpp \
521 $(VBOX_PATH_RUNTIME_SRC)/common/misc/RTAssertMsg2Weak.cpp \
522 $(VBOX_PATH_RUNTIME_SRC)/common/misc/RTAssertMsg2WeakV.cpp \
523 $(VBOX_PATH_RUNTIME_SRC)/generic/RTAssertShouldPanic-generic.cpp
524endif
525
526# Things specific to the rest of the posix crowd.
527if1of ($(KBUILD_TARGET), linux solaris)
528 SUPR3HardenedStatic_DEFS += \
529 IN_DIS \
530 IN_DIS_STATIC \
531 DIS_CORE_ONLY \
532 VBOX_DIS_WITH_X86_AMD64 \
533 LOG_DISABLED
534 SUPR3HardenedStatic_DEFS.linux += \
535 SUP_HARDENED_WITH_DLMOPEN
536 SUPR3HardenedStatic_DEFS.solaris += \
537 SUP_HARDENED_WITH_DLMOPEN
538 SUPR3HardenedStatic_DEFS.asan += SUP_HARDENED_WITHOUT_DLOPEN_PATCHING
539
540 SUPR3HardenedStatic_INCS += $(VBOX_PATH_RUNTIME_SRC)/include
541
542 SUPR3HardenedStatic_SOURCES += \
543 posix/SUPR3HardenedMain-posix.cpp \
544 posix/SUPR3HardenedMainA-posix.asm \
545 \
546 $(VBOX_PATH_RUNTIME_SRC)/common/misc/RTAssertMsg1Weak.cpp \
547 $(VBOX_PATH_RUNTIME_SRC)/common/misc/RTAssertMsg2.cpp \
548 $(VBOX_PATH_RUNTIME_SRC)/common/misc/RTAssertMsg2Weak.cpp \
549 $(VBOX_PATH_RUNTIME_SRC)/common/misc/RTAssertMsg2WeakV.cpp \
550 $(VBOX_PATH_RUNTIME_SRC)/generic/RTAssertShouldPanic-generic.cpp \
551 \
552 ../../Disassembler/Disasm.cpp \
553 ../../Disassembler/DisasmCore-x86-amd64.cpp \
554 ../../Disassembler/DisasmTables-x86-amd64.cpp \
555 ../../Disassembler/DisasmTablesX64.cpp \
556 ../../Disassembler/DisasmMisc.cpp
557endif
558
559SUPR3HardenedMain.cpp_DEFS = VBOX_SVN_REV=$(VBOX_SVN_REV)
560
561
562#
563# VBoxSupLib - Windows DLL for catching thread creation and termination.
564#
565VBoxSupLib_TEMPLATE = VBoxR3StaticNoCrt
566VBoxSupLib_SDKS.win = VBoxNtDll
567VBoxSupLib_LDFLAGS.win.amd64 = -Entry:DllMainEntrypoint
568VBoxSupLib_LDFLAGS.win.x86 = -Entry:DllMainEntrypoint
569VBoxSupLib_LDFLAGS.win.arm64 = -Entry:DllMainEntrypoint
570VBoxSupLib_DEFS = \
571 $(if $(VBOX_WITHOUT_DEBUGGER_CHECKS),VBOX_WITHOUT_DEBUGGER_CHECKS,)
572VBoxSupLib_SOURCES = \
573 $(KBUILD_TARGET)/VBoxSupLib-$(KBUILD_TARGET).cpp
574VBoxSupLib_SOURCES.win.amd64 = \
575 $(VBOX_PATH_RUNTIME_SRC)/common/compiler/vcc/stack-probe-vcc.asm
576VBoxSupLib_SOURCES.win.x86 = \
577 $(VBOX_PATH_RUNTIME_SRC)/common/compiler/vcc/stack-probe-vcc.asm
578VBoxSupLib_SOURCES.win = \
579 win/VBoxSupLib.rc
580ifndef VBOX_WITH_NOCRT_STATIC
581 ifdef VBOX_WITH_HARDENING # for /guard:cf stuff
582 VBoxSupLib_LIBS.win.x86 = \
583 $(PATH_TOOL_$(TEMPLATE_VBoxR3StaticNoCrt_TOOL.win.x86)_LIB)/libcmt.lib
584 VBoxSupLib_LIBS.win.amd64 = \
585 $(PATH_TOOL_$(TEMPLATE_VBoxR3StaticNoCrt_TOOL.win.amd64)_LIB)/libcmt.lib
586 endif
587endif
588VBoxSupLib_VBOX_IMPORT_CHECKER.win.x86 = xp
589VBoxSupLib_VBOX_IMPORT_CHECKER.win.amd64 = xp64
590
591
592#
593# VBoxSupSvc - The system wide service/daemon.
594#
595VBoxSupSvc_TEMPLATE = VBoxR3Exe
596VBoxSupSvc_SOURCES = \
597 SUPSvc.cpp \
598 SUPSvcGlobal.cpp \
599 $(KBUILD_TARGET)/SUPSvc-$(KBUILD_TARGET).cpp
600if1of ($(KBUILD_TARGET), win)
601 VBoxSupSvc_SOURCES += \
602 SUPSvcGrant.cpp
603endif
604ifn1of ($(KBUILD_TARGET), win)
605 VBoxSupSvc_SOURCES += \
606 SUPSvcMain-posix.cpp
607endif
608VBoxSupSvc_LIBS = \
609 $(LIB_RUNTIME)
610
611
612#
613# SUPR0 - The Ring-0 Import library.
614#
615SUPR0_TEMPLATE = VBoxR0
616if1of ($(VBOX_LDR_FMT), pe lx)
617 SUPR0_SOURCES = $(SUPR0_0_OUTDIR)/SUPR0.def
618 SUPR0_CLEAN = $(SUPR0_0_OUTDIR)/SUPR0.def
619 $$(SUPR0_0_OUTDIR)/SUPR0.def: \
620 $(PATH_SUB_CURRENT)/SUPDrv.cpp \
621 $(PATH_SUB_CURRENT)/SUPR0-def-$(VBOX_LDR_FMT).sed \
622 | $$(dir $$@)
623 $(SED) \
624 -e '/not-arch-$(KBUILD_TARGET_ARCH)/d' \
625 -f $(dir $<)/SUPR0-def-$(VBOX_LDR_FMT).sed \
626 --output $@ \
627 $<
628 # Experiment: Let's see how blunt the ones messing our NULL_THUNK_DATA entries on W10 are.
629 ifeq ($(KBUILD_TARGET),win)
630 ifdef KLIBTWEAKER_EXT
631 SUPR0_POST_CMDS = $(KLIBTWEAKER_EXT) --clear-timestamps --fill-null_thunk_data $(out)
632 endif
633 endif
634endif
635
636
637#
638# SUPRC - The raw-mode context library.
639#
640SUPRC_TEMPLATE := VBoxRc
641SUPRC_DEFS := IN_SUP_RC IN_RT_RC IN_VMM_RC
642SUPRC_SOURCES := SUPLibAll.cpp
643
644
645#
646# SUPR0IdcClient - The Ring-0 IDC client driver library.
647#
648SUPR0IdcClient_TEMPLATE = VBoxR0DrvLib
649SUPR0IdcClient_DEFS = IN_RT_R0 IN_SUP_R0 IN_SUP_STATIC
650SUPR0IdcClient_SDKS.win = ReorderCompilerIncs $(VBOX_WINDDK) $(VBOX_WINPSDK_INCS)
651SUPR0IdcClient_SOURCES.$(KBUILD_TARGET) = \
652 $(KBUILD_TARGET)/SUPR0IdcClient-$(KBUILD_TARGET).c
653SUPR0IdcClient_SOURCES = \
654 SUPR0IdcClient.c \
655 SUPR0IdcClientComponent.c \
656 SUPR0IdcClientStubs.c
657
658
659
660if !defined(VBOX_ONLY_DOCS) \
661 && !defined(VBOX_ONLY_EXTPACKS) \
662 && !defined(VBOX_ONLY_VALIDATIONKIT)
663
664 ifeq ($(KBUILD_TARGET),os2)
665
666 #
667 # VBoxDrv.sys - The OS/2 driver.
668 #
669 VBoxDrv_TEMPLATE = VBoxR0Drv
670 VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0
671 VBoxDrv_INCS := $(PATH_SUB_CURRENT)
672 #VBoxDrv_LDFLAGS = -s -t -v
673 VBoxDrv_SOURCES = \
674 os2/SUPDrvA-os2.asm \
675 os2/SUPDrv-os2.def
676 VBoxDrv_LIBS = \
677 $(VBoxDrvLib_1_TARGET) \
678 $(PATH_STAGE_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB) \
679 $(VBOX_GCC_LIBGCC) \
680 end
681
682 # temp hack to ensure that SUPDrvA-os2.asm is first in the link.
683 LIBRARIES += VBoxDrvLib
684 VBoxDrvLib_TEMPLATE = VBoxR0Drv
685 VBoxDrvLib_INSTTYPE = none
686 VBoxDrvLib_DEFS = IN_RT_R0 IN_SUP_R0
687 VBoxDrvLib_INCS := \
688 . \
689 $(PATH_ROOT)/src/VBox/Runtime/include
690 VBoxDrvLib_SOURCES = \
691 os2/SUPDrv-os2.cpp \
692 SUPDrv.cpp \
693 SUPDrvGip.cpp \
694 SUPDrvSem.cpp \
695 SUPLibAll.cpp
696
697 endif # os2
698
699
700 #
701 # New VBoxDrv target. TODO: Convert all the above to use this!
702 #
703 if1of ($(KBUILD_TARGET), darwin freebsd solaris win)
704 ifdef VBOX_WITH_VBOXDRV
705 SYSMODS += VBoxDrv
706 endif
707 VBoxDrv_TEMPLATE = VBoxR0Drv
708 VBoxDrv_NAME.freebsd = vboxdrv
709 VBoxDrv_NAME.solaris = vboxdrv
710 VBoxDrv_NAME.win = VBoxSup
711 ifdef VBOX_SIGNING_MODE
712 VBoxDrv_INSTTYPE.win = none
713 VBoxDrv_DEBUG_INSTTYPE.win = both
714 endif
715 VBoxDrv_INST.darwin = $(INST_VBOXDRV)Contents/MacOS/
716 VBoxDrv_DEBUG_INST.darwin = $(patsubst %/,%,$(INST_VBOXDRV))
717 VBoxDrv_SDKS.win = ReorderCompilerIncs $(VBOX_WINDDK) $(VBOX_WINPSDK_INCS)
718
719 VBoxDrv_DEFS := IN_RT_R0 IN_SUP_R0 SUPDRV_WITH_RELEASE_LOGGER VBOX_SVN_REV=$(VBOX_SVN_REV)
720 ifdef VBOX_WITH_MINIMAL_R0
721 VBoxDrv_DEFS += VBOX_WITH_MINIMAL_R0
722 endif
723 ifdef VBOX_WITH_MINIMAL_HARDENING
724 VBoxDrv_DEFS += VBOX_WITH_MINIMAL_HARDENING
725 endif
726 ifdef VBOX_WITH_DTRACE_R0DRV
727 VBoxDrv_DEFS += VBOX_WITH_DTRACE VBOX_WITH_DTRACE_R0DRV
728 endif
729 ifdef VBOX_WITHOUT_DEBUGGER_CHECKS
730 VBoxDrv_DEFS += VBOX_WITHOUT_DEBUGGER_CHECKS
731 endif
732 ifdef VBOX_PERMIT_VISUAL_STUDIO_PROFILING
733 VBoxDrv_DEFS += VBOX_PERMIT_VISUAL_STUDIO_PROFILING
734 endif
735 VBoxDrv_DEFS += VBOX_PERMIT_MORE VBOX_PERMIT_EVEN_MORE
736 #VBoxDrv_DEFS.debug += DEBUG_DARWIN_GIP
737 VBoxDrv_DEFS.darwin := VBOX_WITH_HOST_VMX
738 ifdef VBOX_WITH_RAW_MODE
739 VBoxDrv_DEFS.darwin += VBOX_WITH_RAW_MODE
740 endif
741 if defined(VBOX_WITH_DARWIN_R0_DARWIN_IMAGE_VERIFICATION) && defined(VBOX_SIGNING_MODE)
742 VBoxDrv_DEFS.darwin += VBOX_WITH_DARWIN_R0_DARWIN_IMAGE_VERIFICATION
743 ifeq ($(VBOX_SIGNING_MODE),test)
744 VBoxDrv_DEFS.darwin += VBOX_WITH_DARWIN_R0_TEST_SIGN
745 endif
746 endif
747 ifdef VBOX_WITH_NETFLT
748 VBoxDrv_DEFS.solaris += VBOX_WITH_NETFLT
749 endif
750 ifdef VBOX_WITH_NATIVE_SOLARIS_LOADING
751 VBoxDrv_DEFS.solaris += VBOX_WITH_NATIVE_SOLARIS_LOADING
752 endif
753 ifdef VBOX_WITHOUT_NATIVE_R0_LOADER
754 VBoxDrv_DEFS.win += VBOX_WITHOUT_NATIVE_R0_LOADER
755 endif
756 ifdef VBOX_WITH_VISTA_NO_SP
757 VBoxDrv_DEFS.win += VBOX_WITH_VISTA_NO_SP
758 endif
759 ifdef VBOX_WITH_HARDENING
760 VBoxDrv_ASDEFS += VBOX_WITH_HARDENING
761 endif
762 ifdef VBOX_WITH_RAM_IN_KERNEL
763 VBoxDrv_DEFS += VBOX_WITHOUT_EFLAGS_AC_SET_IN_VBOXDRV IPRT_WITHOUT_EFLAGS_AC_PRESERVING
764 else if ($(VBOX_VERSION_BUILD) % 2) == 1
765 VBoxDrv_DEFS += VBOX_WITH_EFLAGS_AC_SET_IN_VBOXDRV IPRT_WITH_EFLAGS_AC_PRESERVING
766 endif
767
768 VBoxDrv_INCS = . $(VBoxDrv_0_OUTDIR)
769 VBoxDrv_INCS.darwin = ./darwin
770
771 VBoxDrv_LIBS = $(PATH_STAGE_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
772 VBoxDrv_LIBS.win = \
773 $(PATH_STAGE_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB) \
774 $(PATH_SDK_$(VBOX_WINDDK)_LIB)/ntoskrnl.lib \
775 $(PATH_SDK_$(VBOX_WINDDK)_LIB)/hal.lib
776 ifn1of ($(VBOX_WINDDK), WINDDK80 WINDDK71)
777 VBoxDrv_LIBS.win.x86 = \
778 $(PATH_SDK_$(VBOX_WINDDK)_LIB)/BufferOverflowK.lib
779 endif
780 VBoxDrv_LIBS.win.arm64 = \
781 $(PATH_SDK_$(VBOX_WINDDK)_LIB)/BufferOverflowFastFailK.lib
782
783 #VBoxDrv_LDFLAGS.darwin = -Wl,-sectcreate,__TEXT,__info_plist,$(VBoxDrv.kext_0_OUTDIR)/Info.plist
784 #VBoxDrv_LDFLAGS.darwin = -v -Wl,-whyload -Wl,-v -Wl,-whatsloaded
785 VBoxDrv_LDFLAGS.solaris += -N misc/ctf
786 ifdef VBOX_WITH_NATIVE_DTRACE
787 VBoxDrv_LDFLAGS.solaris += -N drv/dtrace
788 endif
789 VBoxDrv_LDFLAGS.win.x86 = -Entry:DriverEntry@8
790 VBoxDrv_LDFLAGS.win.amd64 = -Entry:DriverEntry
791 VBoxDrv_LDFLAGS.win.arm64 = -Entry:DriverEntry
792
793 VBoxDrv_SOURCES.darwin = \
794 darwin/SUPDrv-darwin.cpp
795 ifdef VBOX_WITH_DARWIN_R0_DARWIN_IMAGE_VERIFICATION
796 VBoxDrv_SOURCES.darwin += \
797 $(VBOX_SUP_WIN_CERTS_FILE)
798 endif
799 VBoxDrv_SOURCES.solaris = \
800 solaris/SUPDrv-solaris.c
801 VBoxDrv_SOURCES.win = \
802 win/SUPDrv-win.cpp \
803 win/VBoxDrv.rc
804 VBoxDrv_SOURCES.win.x86 = \
805 win/SUPDrvA-win.asm
806 VBoxDrv_SOURCES.win.amd64 = \
807 win/SUPDrvA-win.asm
808 if defined(VBOX_WITH_HARDENING) || defined(VBOX_WITH_MINIMAL_HARDENING)
809 VBoxDrv_SOURCES.win += \
810 win/SUPHardenedVerifyImage-win.cpp \
811 win/SUPHardenedVerifyProcess-win.cpp \
812 $(VBOX_SUP_WIN_CERTS_FILE)
813 ifdef VBOX_WITHOUT_WINDOWS_KERNEL_CODE_SIGNING_CERT
814 VBoxDrv_DEFS.win += VBOX_WITHOUT_WINDOWS_KERNEL_CODE_SIGNING_CERT
815 endif
816 endif
817 VBoxDrv_SOURCES = \
818 SUPDrv.d \
819 SUPDrv.cpp \
820 SUPDrvGip.cpp \
821 SUPDrvSem.cpp \
822 SUPDrvTracer.cpp \
823 SUPLibAll.cpp
824 ifdef VBOX_WITH_NATIVE_DTRACE
825 VBoxDrv_SOURCES += \
826 SUPDrv-dtrace.cpp
827 SUPDrv-dtrace.cpp_DEFS.darwin += VBOX_PATH_MACOSX_DTRACE_H=\"$(VBOX_PATH_MACOSX_SDK)/usr/include/sys/dtrace.h\"
828 endif
829 ifn1of ($(KBUILD_TARGET), linux freebsd)
830 VBoxDrv_SOURCES.x86 += \
831 SUPDrvTracerA.asm
832 VBoxDrv_SOURCES.amd64 += \
833 SUPDrvTracerA.asm
834 VBoxDrv_SOURCES.arm64 += \
835 SUPDrvTracerA-arm64.S
836 endif
837
838 linux/SUPDrv-linux.c_DEPS = $(VBOX_SVN_REV_HEADER)
839
840 endif
841
842
843
844 if defined(VBOX_WITH_VBOXDRV) && "$(KBUILD_TARGET)" == "darwin"
845 # Files necessary to make a darwin kernel extension bundle.
846 INSTALLS.darwin += VBoxDrv.kext
847 VBoxDrv.kext_INST = $(INST_VBOXDRV)Contents/
848 VBoxDrv.kext_SOURCES = $(VBoxDrv.kext_0_OUTDIR)/Contents/Info.plist
849 VBoxDrv.kext_CLEAN = $(VBoxDrv.kext_0_OUTDIR)/Contents/Info.plist
850 VBoxDrv.kext_BLDDIRS = $(VBoxDrv.kext_0_OUTDIR)/Contents/
851
852 $$(VBoxDrv.kext_0_OUTDIR)/Contents/Info.plist: \
853 $(PATH_SUB_CURRENT)/darwin/Info.plist \
854 $(VBOX_VERSION_MK) | $$(dir $$@)
855 $(call MSG_GENERATE,VBoxDrv,$@,$<)
856 $(QUIET)$(RM) -f $@
857 $(QUIET)$(SED) \
858 -e 's+@VBOX_VERSION_STRING@+$(if !defined(VBOX_MAVERICS_CODE_SIGNING_HACK),$(VBOX_VERSION_STRING),4.2.51)+g' \
859 -e 's+@VBOX_VERSION_MAJOR@+$(if !defined(VBOX_MAVERICS_CODE_SIGNING_HACK),$(VBOX_VERSION_MAJOR),4)+g' \
860 -e 's+@VBOX_VERSION_MINOR@+$(if !defined(VBOX_MAVERICS_CODE_SIGNING_HACK),$(VBOX_VERSION_MINOR),2)+g' \
861 -e 's+@VBOX_VERSION_BUILD@+$(if !defined(VBOX_MAVERICS_CODE_SIGNING_HACK),$(VBOX_VERSION_BUILD),51)+g' \
862 -e 's+@VBOX_VENDOR@+$(VBOX_VENDOR)+g' \
863 -e 's+@VBOX_PRODUCT@+$(VBOX_PRODUCT)+g' \
864 -e 's+@VBOX_C_YEAR@+$(VBOX_C_YEAR)+g' \
865 --output $@ \
866 $<
867
868 $(evalcall2 VBOX_TEST_SIGN_KEXT,VBoxDrv)
869 endif
870
871
872 if1of ($(KBUILD_TARGET), darwin solaris)
873 ifdef VBOX_WITH_VBOXDRV
874 # Common manual loader script.
875 INSTALLS += SUPDrvScripts
876 SUPDrvScripts_INST = $(INST_DIST)
877 SUPDrvScripts_EXEC_SOURCES = \
878 $(KBUILD_TARGET)/load.sh
879 endif
880 endif
881
882
883 if1of ($(KBUILD_TARGET), linux freebsd)
884 if1of ($(KBUILD_TARGET_ARCH), $(VBOX_SUPPORTED_HOST_ARCHS))
885 #
886 # Targets for installing the linux sources.
887 #
888 vboxdrv-src_INST = bin/src/vboxdrv/
889 vboxdrv-src_SOURCES = \
890 $(subst $(DQUOTE),,$(FILES_VBOXDRV_NOBIN)) \
891 $(vboxdrv-src_0_OUTDIR)/Makefile
892 vboxdrv-src_EXEC_SOURCES = \
893 $(subst $(DQUOTE),,$(FILES_VBOXDRV_BIN))
894 vboxdrv-src_CLEAN = \
895 $(vboxdrv-src_0_OUTDIR)/Makefile \
896 $(PATH_TARGET)/vboxdrv-src-1.dep
897
898 # Scripts needed for building the kernel modules
899 includedep $(PATH_TARGET)/vboxdrv-src-1.dep
900 $$(vboxdrv-src_0_OUTDIR)/Makefile: \
901 $(PATH_SUB_CURRENT)/$(KBUILD_TARGET)/Makefile \
902 $$(if $$(eq $$(Support/$(KBUILD_TARGET)/Makefile_VBOX_HARDENED),$$(VBOX_WITH_HARDENING)),,FORCE) \
903 $$(if $$(eq $$(Support/$(KBUILD_TARGET)/Makefile_VBOX_RAM_IN_KERNEL),$$(VBOX_WITH_RAM_IN_KERNEL)),,FORCE) \
904 | $$(dir $$@)
905 $(call MSG_TOOL,Creating,,$@)
906 $(QUIET)$(SED) -e "" \
907 $(if-expr !defined(VBOX_WITH_HARDENING),-e "s;VBOX_WITH_HARDENING;;g",) \
908 --output $@ $<
909 %$(QUIET2)$(APPEND) -t -n '$(PATH_TARGET)/vboxdrv-src-1.dep' \
910 'Support/$(KBUILD_TARGET)/Makefile_VBOX_HARDENED=$(VBOX_WITH_HARDENING)' \
911 'Support/$(KBUILD_TARGET)/Makefile_VBOX_RAM_IN_KERNEL=$(VBOX_WITH_RAM_IN_KERNEL)'
912
913 #
914 # Build test for the linux host kernel modules.
915 #
916 $(evalcall2 VBOX_LINUX_KMOD_TEST_BUILD_RULE_FN,vboxdrv-src,,save_symvers)
917
918 ifdef VBOX_WITH_KMOD_WRAPPED_R0_MODS
919 #
920 # Common wrapper module files.
921 #
922 INSTALLS.linux += vboxwrappermod-common-src
923 vboxwrappermod-common-src_INST = bin/src/common/
924 vboxwrappermod-common-src_SOURCES = \
925 linux/SUPWrapperMod-linux.c=>SUPWrapperMod-linux.c \
926 linux/Makefile-wrapper.gmk=>Makefile-wrapper.gmk \
927 $(PATH_ROOT)/src/VBox/Installer/linux/Makefile-header.gmk=>Makefile-header.gmk \
928 $(PATH_ROOT)/src/VBox/Installer/linux/Makefile-footer.gmk=>Makefile-footer.gmk
929 endif
930
931 endif # supported host arch
932 endif # linux freebsd
933
934
935 ifdef VBOX_WITH_VBOXDRV
936 ifeq ($(KBUILD_TARGET),win)
937 INSTALLS.win += VBoxSup-inf
938 VBoxSup-inf_TEMPLATE = VBoxR0DrvInfCat
939 VBoxSup-inf_SOURCES = \
940 $(PATH_TARGET)/VBoxSupCat.dir/VBoxSup.inf
941 VBoxSup-inf_CLEAN = $(VBoxSup-inf_SOURCES)
942 VBoxSup-inf_BLDDIRS = $(PATH_TARGET)/VBoxSupCat.dir
943
944 $(PATH_TARGET)/VBoxSupCat.dir/VBoxSup.inf: $(PATH_SUB_CURRENT)/win/VBoxSup.inf $(MAKEFILE_CURRENT) | $$(dir $$@)
945 $(call MSG_GENERATE,VBoxSup-inf,$@,$<)
946 $(call VBOX_EDIT_INF_FN,$<,$@)
947
948 ifdef VBOX_SIGNING_MODE
949 VBoxSup-inf_SOURCES += \
950 $(PATH_TARGET)/VBoxSupCat.dir/VBoxSup.sys \
951 $(PATH_TARGET)/VBoxSupCat.dir/VBoxSup.cat
952 VBoxSup-inf_SOURCES.amd64 += \
953 $(PATH_TARGET)/VBoxSupCat.dir/VBoxSup.cat=>VBoxSup-PreW10.cat
954 VBoxSup-inf_SOURCES.x86 += \
955 $(PATH_TARGET)/VBoxSupCat.dir/VBoxSup.cat=>VBoxSup-PreW10.cat
956
957 $(PATH_TARGET)/VBoxSupCat.dir/VBoxSup.sys: $$(VBoxDrv_1_TARGET) | $$(dir $$@)
958 $(INSTALL) -m 644 -- "$<" "$(@D)"
959
960 $(PATH_TARGET)/VBoxSupCat.dir/VBoxSup.cat: \
961 $(PATH_TARGET)/VBoxSupCat.dir/VBoxSup.inf \
962 $(PATH_TARGET)/VBoxSupCat.dir/VBoxSup.sys
963 $(call MSG_TOOL,Inf2Cat,VBoxSup-inf,$@,$<)
964 $(call VBOX_MAKE_CAT_FN, $(@D),$@)
965 endif # signing
966 endif # win
967 endif # VBOX_WITH_VBOXDRV
968
969 #
970 # Linux only.
971 #
972 PROGRAMS.linux += LnxPerfHack
973 LnxPerfHack_TEMPLATE = VBoxR3Tool
974 LnxPerfHack_SOURCES = linux/LnxPerfHack.cpp
975
976
977
978endif # !VBOX_ONLY_DOCS && !VBOX_ONLY_EXTPACKS && !VBOX_ONLY_VALIDATIONKIT
979include $(FILE_KBUILD_SUB_FOOTER)
980
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette