VirtualBox

Changeset 11725

Show
Ignore:
Timestamp:
08/28/08 00:21:47 (3 months ago)
Author:
vboxsync
Message:

#3076: Merged in the branch with the alternate driver authentication method. (34468:HEAD)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Config.kmk

    r11721 r11725  
    327327# Enable the new async completion manager 
    328328VBOX_WITH_PDM_ASYNC_COMPLETION = 1 
    329 # Enable use of the $ORIGIN rpath feature. This is the default on 
    330 # Solaris, but not else where for various reasons (ld.so, dist builds). 
    331 ifeq ($(KBUILD_TARGET),solaris) 
    332  VBOX_WITH_ORIGIN = 1 
    333 endif 
    334329# Temporary switch for enabling / disabling the new USB code on Darwin. 
    335330VBOX_WITH_NEW_USB_CODE_ON_DARWIN=1 
     
    354349if1of ($(KBUILD_TARGET), solaris) 
    355350 VBOX_WITH_PYTHON = 1 
     351endif 
     352# Enables hardening. 
     353# Most developers will want to disable this in their LocalConfig.kmk. 
     354VBOX_WITH_HARDENING = 1 
     355# Where the application files are (going to be) installed. 
     356#VBOX_PATH_APP_PRIVATE       = /usr/lib/virtualbox 
     357ifdef VBOX_WITH_HARDENING 
     358 if1of ($(KBUILD_TARGET), solaris) 
     359  VBOX_PATH_APP_PRIVATE      = /opt/VirtualBox 
     360 else ifeq ($(KBUILD_TARGET),darwin) 
     361  VBOX_PATH_APP_PRIVATE      = /Applications/VirtualBox.app/Contents/MacOS 
     362 endif 
     363endif 
     364# Where the architecture specific application files are (going to be) installed. 
     365#VBOX_PATH_APP_PRIVATE_ARCH  = /usr/lib/virtualbox 
     366ifdef VBOX_WITH_HARDENING 
     367 if1of ($(KBUILD_TARGET), darwin solaris) 
     368  VBOX_PATH_APP_PRIVATE_ARCH = $(VBOX_PATH_APP_PRIVATE) 
     369 endif 
     370endif 
     371# Where the shared libraries are (going to be) installed. 
     372#VBOX_PATH_SHARED_LIBS       = /usr/lib 
     373ifdef VBOX_WITH_HARDENING 
     374 if1of ($(KBUILD_TARGET), darwin solaris) 
     375  VBOX_PATH_SHARED_LIBS      = $(VBOX_PATH_APP_PRIVATE) 
     376 endif 
     377endif 
     378# Where the documentation is (going to be) installed. 
     379#VBOX_PATH_APP_DOCS         = /usr/share/doc/virtualbox 
     380ifdef VBOX_WITH_HARDENING 
     381 if1of ($(KBUILD_TARGET), darwin solaris) 
     382  VBOX_PATH_APP_DOCS         = $(VBOX_PATH_APP_PRIVATE) 
     383 endif 
     384endif 
     385# The DT_RPATH/DT_RUNPATH to embed into the binaries (ELF). 
     386# (This one is used for all binaries, there is no need to adjust this 
     387# depending on the location of the object.) 
     388#VBOX_WITH_RUNPATH = /usr/lib/virtualbox 
     389ifdef VBOX_WITH_HARDENING 
     390 if1of ($(KBUILD_TARGET), solaris) 
     391  VBOX_WITH_RUNPATH = $(VBOX_PATH_APP_PRIVATE) 
     392 endif 
     393endif 
     394# Enable use of the $ORIGIN DT_RPATH/DT_RUNPATH feature (ELF). 
     395# Because of the setuid usage on all ELF platforms when hardening the build 
     396# things gets a bit complicated since the $ORIGIN+setuid policy differs. 
     397#VBOX_WITH_ORIGIN=1 
     398ifdef VBOX_WITH_HARDENING 
     399 if1of ($(KBUILD_TARGET), linux) 
     400  VBOX_WITH_ORIGIN = 1 
     401 endif 
     402else if1of ($(KBUILD_TARGET), solaris) ## @todo add all the ELF dudes here! 
     403 VBOX_WITH_ORIGIN = 1 
     404endif 
     405# Enable the system wide support service/daemon. 
     406# Work in progress, but required for hardening on Windows. 
     407#VBOX_WITH_SUPSVC = 1 
     408ifdef VBOX_WITH_HARDENING 
     409 if1of ($(KBUILD_TARGET), win) 
     410  VBOX_WITH_SUPSVC = 1 
     411 endif 
    356412endif 
    357413 
     
    412468 VBOX_WITH_PDM_ASYNC_COMPLETION= 
    413469 VBOX_WITH_KCHMVIEWER= 
     470 VBOX_WITH_HARDENING= 
    414471endif 
    415472 
     
    426483 VBOX_WITH_PDM_ASYNC_COMPLETION= 
    427484 VBOX_WITH_KCHMVIEWER= 
     485 VBOX_WITH_HARDENING= 
    428486endif 
    429487 
     
    499557 VBOX_WITH_AHCI= 
    500558 VBOX_WITH_PDM_ASYNC_COMPLETION= 
     559 if1of ($(KBUILD_TARGET), darwin) 
     560  # Disable hardening cause it'll cause unnecessary trouble. 
     561  VBOX_WITH_HARDENING= 
     562 endif 
    501563endif 
    502564 
     
    569631ifndef VBOX_WITH_QT4GUI 
    570632 VBOX_WITH_KCHMVIEWER= 
     633endif 
     634 
     635# 
     636# Check for incompatible combinations. 
     637# 
     638ifdef VBOX_WITH_RUNPATH 
     639 ifdef VBOX_WITH_ORIGIN 
     640  $(error VBOX_WITH_RUNPATH and VBOX_WITH_ORIGIN are mutually exclusive (lazy bird)) 
     641 endif 
    571642endif 
    572643 
     
    855926 DEFS += VBOX_WITH_64_BITS_GUESTS 
    856927endif 
     928ifdef VBOX_WITH_HARDENING 
     929 DEFS += VBOX_WITH_HARDENING 
     930endif 
     931ifdef VBOX_PATH_APP_PRIVATE 
     932 DEFS += RTPATH_APP_PRIVATE=\"$(VBOX_PATH_APP_PRIVATE)\" 
     933endif 
     934ifdef VBOX_PATH_APP_PRIVATE_ARCH 
     935 DEFS += RTPATH_APP_PRIVATE_ARCH=\"$(VBOX_PATH_APP_PRIVATE_ARCH)\" 
     936endif 
     937ifdef VBOX_PATH_SHARED_LIBS 
     938 DEFS += RTPATH_SHARED_LIBS=\"$(VBOX_PATH_SHARED_LIBS)\" 
     939endif 
     940ifdef VBOX_PATH_APP_DOCS 
     941 DEFS += RTPATH_APP_DOCS=\"$(VBOX_PATH_APP_DOCS)\" 
     942endif 
    857943## @todo eliminate these guys. 
    858944ifdef VBOX_WITH_INTERNAL_NETWORKING 
     
    9871073 LIB_SETTINGS    = $(PATH_LIB)/VBoxSettings.lib 
    9881074endif 
     1075VBOX_LIB_SUPHARDENED = $(PATH_LIB)/SUPR3HardenedStatic$(VBOX_SUFF_LIB) 
    9891076 
    9901077# The kprofile build automagically links with kProfile. 
     
    11311218 VBOX_DARWIN_DEF_SDK_LDFLAGS   := -mmacosx-version-min=$(VBOX_DEF_MACOSX_VERSION_MIN) -Wl,-syslibroot,$(VBOX_PATH_MACOSX_SDK) $(VBOX_DARWIN_CLASSIC_LINKER) 
    11321219endif # target=darwin 
     1220 
     1221# 
     1222# Macro switching between @executable_path and /Applications/VirtualBox.app 
     1223# depending on whether the build is hardened or not (dylib install_name) 
     1224# 
     1225ifndef VBOX_DYLD_EXECUTABLE_PATH 
     1226 ifdef VBOX_WITH_HARDENING 
     1227  VBOX_DYLD_EXECUTABLE_PATH = $(VBOX_PATH_APP_PRIVATE_ARCH) 
     1228 else 
     1229  VBOX_DYLD_EXECUTABLE_PATH = @executable_path 
     1230 endif 
     1231endif 
    11331232 
    11341233# 
     
    21092208TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile   = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.krelease) 
    21102209 endif 
    2111  ifdef VBOX_WITH_ORIGIN 
     2210 ifdef VBOX_WITH_RUNPATH 
     2211  TEMPLATE_VBOXR3EXE_LDFLAGS          += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)' 
     2212 else ifdef VBOX_WITH_ORIGIN 
    21122213  TEMPLATE_VBOXR3EXE_LDFLAGS          += '$(VBOX_GCC_RPATH_OPT)$$(VBOX_ORIGIN)' 
     2214  TEMPLATE_VBOXR3EXE_LDFLAGS.linux    += -Wl,-z,origin 
    21132215 endif 
    21142216endif 
     
    21572259 
    21582260# 
     2261# Template for building hardened Ring-3 executables. 
     2262# 
     2263TEMPLATE_VBOXR3HARDENEDEXE = Hardened VBox Ring-3 EXE 
     2264TEMPLATE_VBOXR3HARDENEDEXE_EXTENDS = VBOXR3EXE 
     2265TEMPLATE_VBOXR3HARDENEDEXE_LIBS = $(VBOX_LIB_SUPHARDENED) $(TEMPLATE_VBOXR3EXE_LIBS) 
     2266TEMPLATE_VBOXR3HARDENEDEXE_LDFLAGS.darwin = $(TEMPLATE_VBOXR3EXE_LDFLAGS.darwin) -framework IOKit 
     2267 
     2268# 
     2269# Template for building hardened Ring-3 libraries. 
     2270# 
     2271TEMPLATE_VBOXR3HARDENEDLIB = Hardened VBox Ring-3 LIB 
     2272TEMPLATE_VBOXR3HARDENEDLIB_EXTENDS = VBOXR3HARDENEDEXE 
     2273TEMPLATE_VBOXR3HARDENEDLIB_LIBS = $(NO_SUCH_VARIABLE) 
     2274 
     2275# 
    21592276# Ring-3 testcase. 
    21602277# This is the VBOXR3EXE template only with a different install dir. 
     
    21642281TEMPLATE_VBOXR3TSTEXE_INST    = $(INST_TESTCASE) 
    21652282TEMPLATE_VBOXR3TSTEXE_LIBS    = $(LIB_RUNTIME) $(TEMPLATE_VBOXR3EXE_LIBS) 
    2166 ifdef VBOX_WITH_ORIGIN 
    2167  TEMPLATE_VBOXR3TSTEXE_LDFLAGS= '$(VBOX_GCC_RPATH_OPT)$$(VBOX_ORIGIN)/..' $(TEMPLATE_VBOXR3EXE_LDFLAGS) 
     2283ifdef VBOX_WITH_RUNPATH 
     2284 TEMPLATE_VBOXR3TSTEXE_LDFLAGS = '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)' $(TEMPLATE_VBOXR3EXE_LDFLAGS) 
     2285else ifdef VBOX_WITH_ORIGIN 
     2286 TEMPLATE_VBOXR3TSTEXE_LDFLAGS = '$(VBOX_GCC_RPATH_OPT)$$(VBOX_ORIGIN)/..' $(TEMPLATE_VBOXR3EXE_LDFLAGS) 
    21682287endif 
    21692288ifeq ($(KBUILD_TARGET),win) 
     
    23732492TEMPLATE_VBOXMAINEXE_CXXFLAGS           += $(VBOX_DARWIN_DEF_SDK_CXXFLAGS) 
    23742493TEMPLATE_VBOXMAINEXE_OBJCFLAGS          += $(VBOX_DARWIN_DEF_SDK_OBJCFLAGS) 
    2375 TEMPLATE_VBOXMAINEXE_LDFLAGS            += $(VBOX_DARWIN_DEF_SDK_LDFLAGS) -bind_at_load -framework Carbon 
     2494TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin     += -bind_at_load 
     2495TEMPLATE_VBOXMAINEXE_LDFLAGS            += $(VBOX_DARWIN_DEF_SDK_LDFLAGS) -framework Carbon 
    23762496TEMPLATE_VBOXMAINEXE_LIBS                = $(LIB_RUNTIME) 
    23772497 else if1of ($(KBUILD_TARGET), freebsd netbsd openbsd) 
     
    23862506TEMPLATE_VBOXMAINEXE_LIBS                = 
    23872507 endif 
    2388  ifdef VBOX_WITH_ORIGIN 
     2508 ifdef VBOX_WITH_RUNPATH 
     2509TEMPLATE_VBOXMAINEXE_LDFLAGS            += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)' 
     2510 else ifdef VBOX_WITH_ORIGIN 
    23892511TEMPLATE_VBOXMAINEXE_LDFLAGS            += '$(VBOX_GCC_RPATH_OPT)$$(VBOX_ORIGIN)' 
     2512TEMPLATE_VBOXMAINEXE_LDFLAGS.linux      += -Wl,-z,origin 
    23902513 endif 
    23912514 
     
    24212544# This differs from VBOXMAINEXE only in PIC handling and similar DLL stuff. 
    24222545# 
    2423  
    24242546TEMPLATE_VBOXMAINDLL  = VBox Main Component (shared library) 
    24252547TEMPLATE_VBOXMAINDLL_EXTENDS = VBOXMAINEXE 
     
    24322554 endif 
    24332555endif 
    2434 ifeq ($(KBUILD_TARGET),darwin) 
    2435  TEMPLATE_VBOXMAINDLL_LDFLAGS   = $(filter-out -bind_at_load,$(TEMPLATE_VBOXMAINEXE_LDFLAGS)) \ 
     2556TEMPLATE_VBOXMAINDLL_LDFLAGS.darwin = $(filter-out -bind_at_load,$(TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin)) \ 
    24362557        -current_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) 
    2437 endif 
     2558 
     2559
     2560# Template identical to VBOXMAINDLL except for where the stuff is 
     2561# installed when using XPCOM (components/). 
     2562
     2563# Note! In the hardened build this gets a bit ugly since $ORIGIN/.. 
     2564#       doesn't work. So, we use $ORIGIN there and let the installers 
     2565#       handle the symlinking. 
     2566
     2567# (No difference when building against COM on Windows.) 
     2568
     2569TEMPLATE_VBOXMAINCOMP  = VBox Main COM/XPCOM Component (shared library) 
     2570TEMPLATE_VBOXMAINCOMP_EXTENDS = VBOXMAINEXE 
     2571ifn1of ($(KBUILD_TARGET), win) ## WARNING! Linux used to be excluded too, so this may cause trouble. 
     2572 TEMPLATE_VBOXMAINCOMP_INST = $(INST_BIN)components/ 
     2573endif 
     2574ifeq ($(filter-out solaris.x86 %.amd64,$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)),) 
     2575 ifneq ($(KBUILD_TARGET),win) 
     2576  TEMPLATE_VBOXMAINCOMP_DEFS     = PIC $(TEMPLATE_VBOXMAINEXE_DEFS) 
     2577  TEMPLATE_VBOXMAINCOMP_CFLAGS   = -fPIC $(TEMPLATE_VBOXMAINEXE_CFLAGS) 
     2578  TEMPLATE_VBOXMAINCOMP_CXXFLAGS = -fPIC $(TEMPLATE_VBOXMAINEXE_CXXFLAGS) 
     2579  ifdef VBOX_WITH_ORIGIN 
     2580   ifndef VBOX_WITH_HARDENING 
     2581    TEMPLATE_VBOXMAINCOMP_LDFLAGS  = -fPIC $(filter-out '$(VBOX_GCC_RPATH_OPT)$$(VBOX_ORIGIN)',$(TEMPLATE_VBOXMAINEXE_LDFLAGS)) '$(VBOX_GCC_RPATH_OPT)$$(VBOX_ORIGIN)/..' 
     2582   endif 
     2583  endif 
     2584  ifndef TEMPLATE_VBOXMAINCOMP_LDFLAGS 
     2585   TEMPLATE_VBOXMAINCOMP_LDFLAGS   = -fPIC $(TEMPLATE_VBOXMAINEXE_LDFLAGS) 
     2586  endif 
     2587 endif 
     2588endif 
     2589ifdef VBOX_WITH_ORIGIN 
     2590 ifndef TEMPLATE_VBOXMAINCOMP_LDFLAGS 
     2591  ifndef VBOX_WITH_HARDENING 
     2592   TEMPLATE_VBOXMAINCOMP_LDFLAGS   = $(filter-out '$(VBOX_GCC_RPATH_OPT)$$(VBOX_ORIGIN)',$(TEMPLATE_VBOXMAINEXE_LDFLAGS)) '$(VBOX_GCC_RPATH_OPT)$$(VBOX_ORIGIN)/..' 
     2593  endif 
     2594 endif 
     2595endif 
     2596TEMPLATE_VBOXMAINCOMP_LDFLAGS.darwin = $(filter-out -bind_at_load,$(TEMPLATE_VBOXMAINEXE_LDFLAGS.darwin)) \ 
     2597        -current_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) 
    24382598 
    24392599# 
     
    24642624 TEMPLATE_VBOXMAINCLIENTEXE_CXXFLAGS.linux = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.linux) \ 
    24652625        -pthread 
    2466  ifeq ($(KBUILD_TARGET),darwin) 
    2467   TEMPLATE_VBOXMAINCLIENTEXE_LDFLAGS = $(TEMPLATE_VBOXMAINEXE_LDFLAGS) -bind_at_load -framework Carbon 
    2468  endif 
    24692626endif 
    24702627 
     
    24842641 endif 
    24852642endif 
    2486 ifeq ($(KBUILD_TARGET),darwin) 
    2487  TEMPLATE_VBOXMAINCLIENTDLL_LDFLAGS     = $(filter-out -bind_at_load,$(TEMPLATE_VBOXMAINCLIENTEXE_LDFLAGS)) 
    2488 endif 
     2643TEMPLATE_VBOXMAINCLIENTDLL_LDFLAGS.darwin = $(filter-out -bind_at_load,$(TEMPLATE_VBOXMAINCLIENTEXE_LDFLAGS.darwin)) 
    24892644 
    24902645 
     
    25722727  TEMPLATE_VBOXQTGUIEXE_CXXFLAGS += $(VBOX_DARWIN_DEF_SDK_CXXFLAGS) 
    25732728  TEMPLATE_VBOXQTGUIEXE_OBJCFLAGS += $(VBOX_DARWIN_DEF_SDK_OBJCFLAGS) 
    2574   TEMPLATE_VBOXQTGUIEXE_LDFLAGS += $(VBOX_DARWIN_DEF_SDK_LDFLAGS) -framework Carbon -framework QuickTime -bind_at_load 
     2729  TEMPLATE_VBOXQTGUIEXE_LDFLAGS.darwin += -bind_at_load 
    25752730  TEMPLATE_VBOXQTGUIEXE_LIBS += 
    25762731  TEMPLATE_VBOXQTGUIEXE_LIBPATH += 
     
    26052760  endif 
    26062761 endif 
    2607  ifdef VBOX_WITH_ORIGIN 
     2762 ifdef VBOX_WITH_RUNPATH 
     2763  ifeq ($(KBUILD_TARGET),solaris) 
     2764   TEMPLATE_VBOXQTGUIEXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH):$(VBOX_WITH_RUNPATH)/qtgcc/lib' 
     2765  else 
     2766   TEMPLATE_VBOXQTGUIEXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)' 
     2767  endif 
     2768 else ifdef VBOX_WITH_ORIGIN 
    26082769  ifeq ($(KBUILD_TARGET),solaris) 
    26092770   TEMPLATE_VBOXQTGUIEXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$$(VBOX_ORIGIN):$$(VBOX_ORIGIN)/qtgcc/lib' 
     
    26442805TEMPLATE_VBOXQTGUI_LIBS = $(filter-out $(QTMAIN),$(TEMPLATE_VBOXQTGUIEXE_LIBS)) 
    26452806ifeq ($(KBUILD_TARGET),darwin) 
    2646  TEMPLATE_VBOXQTGUI_LDFLAGS = $(filter-out -framework Carbon -framework QuickTime -bind_at_load,$(TEMPLATE_VBOXQTGUIEXE_LDFLAGS)) \ 
     2807 TEMPLATE_VBOXQTGUI_LDFLAGS.darwin = $(filter-out -bind_at_load,$(TEMPLATE_VBOXQTGUIEXE_LDFLAGS.darwin)) \ 
    26472808        -current_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) 
    26482809endif 
  • trunk/debian/LocalConfig.kmk

    r8171 r11725  
    2626KBUILD_MSG_STYLE        := brief 
    2727 
    28 DEFS                    += RTPATH_APP_DOCS=\"$(VBOX_PATH_PACKAGE_DOCS)\" 
    29 DEFS                    += RTPATH_APP_PRIVATE_ARCH=\"/usr/lib/virtualbox-ose\" 
    30 DEFS                    += RTPATH_APP_PRIVATE=\"/usr/share/virtualbox-ose\" 
    31 DEFS                    += RTPATH_SHARED_LIBS=\"/usr/lib\" 
     28VBOX_WITH_HARDENING        := 1 
     29VBOX_WITH_ORIGIN           := 
     30VBOX_PATH_APP_PRIVATE_ARCH := /usr/lib/virtualbox-ose 
     31VBOX_PATH_SHARED_LIBS      := $(VBOX_PATH_APP_PRIVATE_ARCH) 
     32VBOX_WITH_RUNPATH          := $(VBOX_PATH_APP_PRIVATE_ARCH) 
     33VBOX_PATH_APP_PRIVATE      := /usr/share/virtualbox-ose 
     34VBOX_PATH_APP_DOCS          = $(VBOX_PATH_PACKAGE_DOCS) 
  • trunk/debian/postinst

    r9190 r11725  
    3939  udev_ver=`expr "$udev_out" : '[^0-9]*\([0-9]*\)'` 
    4040  if [ "$udev_ver" = "" -o "$udev_ver" -lt 55 ]; then 
    41     echo 'KERNEL="vboxdrv", NAME="vboxdrv", OWNER="root", GROUP="vboxusers", MODE="0660"' \ 
     41    echo 'KERNEL="vboxdrv", NAME="vboxdrv", OWNER="root", GROUP="root", MODE="0600"' \ 
    4242      > /etc/udev/rules.d/60-vboxdrv.rules 
    4343  else 
    44     echo 'KERNEL=="vboxdrv", NAME="vboxdrv", OWNER="root", GROUP="vboxusers", MODE="0660"' \ 
     44    echo 'KERNEL=="vboxdrv", NAME="vboxdrv", OWNER="root", GROUP="root", MODE="0600"' \ 
    4545      > /etc/udev/rules.d/60-vboxdrv.rules 
    4646  fi 
     
    9090fi 
    9191 
     92# The starters need to be Suid root. They drop the privileges before starting 
     93# the real frontend. 
     94if ! dpkg-statoverride --list /usr/lib/virtualbox-ose/VirtualBox > /dev/nnull 2>&1; then 
     95  chmod 4711 /usr/lib/virtualbox-ose/VirtualBox 
     96fi 
     97if ! dpkg-statoverride --list /usr/lib/virtualbox-ose/VBoxHeadless > /dev/nnull 2>&1; then 
     98  chmod 4711 /usr/lib/virtualbox-ose/VBoxHeadless 
     99fi 
     100if ! dpkg-statoverride --list /usr/lib/virtualbox-ose/VBoxSDL > /dev/nnull 2>&1; then 
     101  chmod 4711 /usr/lib/virtualbox-ose/VBoxSDL 
     102fi 
     103 
    92104#DEBHELPER# 
    93105 
  • trunk/debian/rules

    r11524 r11725  
    167167        mv $(archdir)/VBoxXPCOMIPCD $(prefix)/usr/lib/$(package) 
    168168        mv $(archdir)/components $(prefix)/usr/lib/$(package)/components 
    169         mv $(archdir)/*.so $(prefix)/usr/lib 
    170         mv $(archdir)/*.so.4 $(prefix)/usr/lib || true 
     169        mv $(archdir)/*.so $(prefix)/usr/lib/$(package) 
     170        mv $(archdir)/*.so.4 $(prefix)/usr/lib/$(package) || true 
    171171        mv $(archdir)/sdk  $(prefix)/usr/share/$(package) 
    172172        $(if $(HEADLESS),,mv $(archdir)/nls $(prefix)/usr/share/$(package)) 
  • trunk/include/VBox/sup.h

    r10377 r11725  
    312312 
    313313/** 
     314 * Secure main. 
     315 * 
     316 * This is used for the set-user-ID-on-execute binaries on unixy systems 
     317 * and when using the open-vboxdrv-via-root-service setup on Windows. 
     318 * 
     319 * This function will perform the integrity checks of the VirtualBox 
     320 * installation, open the support driver, open the root service (later), 
     321 * and load the DLL corresponding to \a pszProgName and execute its main 
     322 * function. 
     323 * 
     324 * @returns Return code appropriate for main(). 
     325 * 
     326 * @param   pszProgName     The program name. This will be used to figure out which 
     327 *                          DLL/SO/DYLIB to load and execute. 
     328 * @param   fFlags          Flags. 
     329 * @param   argc            The argument count. 
     330 * @param   argv            The argument vector. 
     331 * @param   envp            The environment vector. 
     332 */ 
     333DECLHIDDEN(int) SUPR3HardenedMain(const char *pszProgName, uint32_t fFlags, int argc, char **argv, char **envp); 
     334 
     335/** @name SUPR3SecureMain flags. 
     336 * @{ */ 
     337/** Don't open the device. (Intended for VirtualBox without -startvm.) */ 
     338#define SUPSECMAIN_FLAGS_DONT_OPEN_DEV      RT_BIT_32(0) 
     339/** @} */ 
     340 
     341/** 
    314342 * Initializes the support library. 
    315343 * Each succesful call to SUPInit() must be countered by a 
  • trunk/include/iprt/err.h

    r11562 r11725  
    449449/** The timer can't be stopped because i's already suspended. */ 
    450450#define VERR_TIMER_SUSPENDED                (-69) 
    451 /** The operation was cancelled by the user. */ 
     451/** The operation was cancelled by the user (copy) or another thread (local ipc). */ 
    452452#define VERR_CANCELLED                      (-70) 
    453453/** Failed to initialize a memory object. 
  • trunk/src/VBox/Debugger/Makefile.kmk

    r10052 r11725  
    121121        VBoxDbgStats.cpp 
    122122 
    123 VBoxDbg_LDFLAGS.darwin = -install_name @executable_path/VBoxDbg.dylib 
     123VBoxDbg_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxDbg.dylib 
    124124 
    125125VBoxDbg_LIBS = \ 
  • trunk/src/VBox/Devices/Makefile.kmk

    r11721 r11725  
    102102        $(L4_LIBDIR)/libl4sys.p.a 
    103103endif 
    104 VBoxDDU_LDFLAGS.darwin   = -install_name @executable_path/VBoxDDU.dylib 
     104VBoxDDU_LDFLAGS.darwin   = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxDDU.dylib 
    105105ifdef VBOX_WITH_USB 
    106106 ifdef VBOX_WITH_NEW_USB_CODE_ON_DARWIN 
     
    190190VBoxDD_LIBS.darwin     += \ 
    191191        $(LIB_REM) 
    192 VBoxDD_LDFLAGS.darwin   = -install_name @executable_path/VBoxDD.dylib \ 
     192VBoxDD_LDFLAGS.darwin   = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxDD.dylib \ 
    193193        -framework CoreAudio \ 
    194194        -framework IOKit \ 
     
    230230endif 
    231231VBoxDD2_LIBS.darwin    += $(LIB_REM) 
    232 VBoxDD2_LDFLAGS.darwin  = -install_name @executable_path/VBoxDD2.dylib 
     232VBoxDD2_LDFLAGS.darwin  = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxDD2.dylib 
    233233VBoxDD2_LDFLAGS.linux   = -Wl,--no-undefined 
    234234VBoxDD2_LDFLAGS.l4      = -Wl,--no-undefined 
  • trunk/src/VBox/Devices/testcase/Makefile.kmk

    r11721 r11725  
    115115$(PATH_TARGET)/tstDeviceStructSizeGC.h: $$(INSTARGET_tstDeviceStructSizeGC) 
    116116        $(call MSG_GENERATE,,$@) 
    117         $(QUIET)$(REDIRECT) -wo $@ -- $(INSTARGET_tstDeviceStructSizeGC) 
     117        $(QUIET)$(REDIRECT) -wo $@ $(if $(eq $(KBUILD_TARGET),darwin),-E 'DYLD_LIBRARY_PATH=$(dir $^)') -- $^ 
    118118 
    119119# 3. run it. 
    120120$(PATH_TARGET)/tstDeviceStructSize.run: $$(INSTARGET_tstDeviceStructSize) 
    121121        $(QUIET)$(RM) -f $@ 
    122         $
     122        $(if $(eq $(KBUILD_TARGET),darwin),$(REDIRECT) -E 'DYLD_LIBRARY_PATH=$(dir $^)' --) $
    123123        $(QUIET)$(APPEND) "$@" "done" 
    124124 
  • trunk/src/VBox/Frontends/VBoxBFE/Makefile.kmk

    r10058 r11725  
    2828include $(KBUILD_PATH)/subheader.kmk 
    2929 
    30 PROGRAMS += VBoxBFE 
     30
     31# Targets. 
     32
     33ifdef VBOX_WITH_HARDENING 
     34 ifneq ($(KBUILD_TARGET),darwin) # No hardened VBoxBFE on darwin (.m). 
     35  PROGRAMS += VBoxBFEHardened 
     36  DLLS += VBoxBFE 
     37 endif 
     38else 
     39 PROGRAMS += VBoxBFE 
     40endif 
     41 
     42
     43# Hardened VBoxBFE. 
     44
     45VBoxBFEHardened_TEMPLATE = VBOXR3HARDENEDEXE 
     46VBoxBFEHardened_SOURCES = VBoxBFEHardened.cpp 
     47VBoxBFEHardened_NAME = VBoxBFE 
     48 
    3149 
    3250# 
    3351# VBoxBFE 
    3452# 
    35 VBoxBFE_TEMPLATE = VBOXR3NPEXE 
     53VBoxBFE_TEMPLATE = 
     54VBoxBFE_TEMPLATE  := $(if $(VBOX_WITH_HARDENING),VBOXR3NP,VBOXR3NPEXE) 
    3655#ifdef VBOX_WITH_SECURELABEL 
    3756#VBoxBFE_DEFS += VBOX_SECURELABEL 
  • trunk/src/VBox/Frontends/VBoxBFE/VBoxBFE.cpp

    r11158 r11725  
    415415 
    416416/** entry point */ 
    417 int main(int argc, char **argv
     417extern "C" DECLEXPORT(int) TrustedMain (int argc, char **argv, char **envp
    418418{ 
    419 #ifdef RT_OS_L4 
    420 #ifndef L4API_l4v2onv4 
    421     /* clear Fiasco kernel trace buffer */ 
    422     fiasco_tbuf_clear(); 
    423 #endif 
    424     /* set the environment.  Must be done before the runtime is 
    425        initialised.  Yes, it really must. */ 
    426     for (int i = 0; i < argc; i++) 
    427         if (strcmp(argv[i], "-env") == 0) 
    428         { 
    429             if (++i >= argc) 
    430                 return SyntaxError("missing argument to -env (format: var=value)!\n"); 
    431             /* add it to the environment */ 
    432             if (putenv(argv[i]) != 0) 
    433                 return SyntaxError("Error setting environment string %s.\n", argv[i]); 
    434         } 
    435 #endif /* RT_OS_L4 */ 
    436  
    437     /* 
    438      * Before we do *anything*, we initialize the runtime. 
    439      */ 
    440     int rc = RTR3Init(); 
    441     if (VBOX_FAILURE(rc)) 
    442         return FatalError("RTR3Init failed rc=%Vrc\n", rc); 
    443  
    444  
    445419    bool fFullscreen = false; 
    446420#ifdef VBOX_VRDP 
     
    455429    uint32_t u32MaxVRAM; 
    456430#endif 
     431    int rc = VINF_SUCCESS; 
    457432 
    458433    RTPrintf("VirtualBox Simple SDL GUI built %s %s\n", __DATE__, __TIME__); 
     
    1011986 
    1012987 
     988#ifndef VBOX_WITH_HARDENING 
     989/** 
     990 * Main entry point. 
     991 */ 
     992int main(int argc, char **argv) 
     993{ 
     994# ifdef RT_OS_L4 
     995# ifndef L4API_l4v2onv4 
     996    /* clear Fiasco kernel trace buffer */ 
     997    fiasco_tbuf_clear(); 
     998# endif 
     999    /* set the environment.  Must be done before the runtime is 
     1000       initialised.  Yes, it really must. */ 
     1001    for (int i = 0; i < argc; i++) 
     1002        if (strcmp(argv[i], "-env") == 0) 
     1003        { 
     1004            if (++i >= argc) 
     1005                return SyntaxError("missing argument to -env (format: var=value)!\n"); 
     1006            /* add it to the environment */ 
     1007            if (putenv(argv[i]) != 0) 
     1008                return SyntaxError("Error setting environment string %s.\n", argv[i]); 
     1009        } 
     1010# endif /* RT_OS_L4 */ 
     1011 
     1012    /* 
     1013     * Before we do *anything*, we initialize the runtime. 
     1014     */ 
     1015    int rc = RTR3Init(); 
     1016    if (VBOX_FAILURE(rc)) 
     1017        return FatalError("RTR3Init failed rc=%Vrc\n", rc); 
     1018 
     1019    return TrustedMain(argc, argv, NULL); 
     1020} 
     1021#endif /* !VBOX_WITH_HARDENING */ 
     1022 
    10131023 
    10141024/** 
  • trunk/src/VBox/Frontends/VBoxHeadless/Makefile.kmk

    r10058 r11725  
    2828include $(KBUILD_PATH)/subheader.kmk 
    2929 
    30 PROGRAMS += VBoxHeadless 
    3130include $(PATH_SUB_CURRENT)/testcase/Makefile.kmk 
    3231ifdef VBOX_WITH_FFMPEG 
     
    3433endif 
    3534 
    36 VBoxHeadless_TEMPLATE   = VBOXMAINCLIENTEXE 
     35
     36# Targets. 
     37
     38ifdef VBOX_WITH_HARDENING 
     39 PROGRAMS += VBoxHeadlessHardened 
     40 DLLS += VBoxHeadless 
     41else 
     42 PROGRAMS += VBoxHeadless 
     43endif 
     44 
     45 
     46
     47# Hardened VBoxHeadless. 
     48
     49VBoxHeadlessHardened_TEMPLATE = VBOXR3HARDENEDEXE 
     50VBoxHeadlessHardened_SOURCES = VBoxHeadlessHardened.cpp 
     51VBoxHeadlessHardened_NAME = VBoxHeadless 
     52 
     53 
     54
     55# VBoxHeadless 
     56
     57VBoxHeadless_TEMPLATE  := $(if $(VBOX_WITH_HARDENING),VBOXMAINCLIENTDLL,VBOXMAINCLIENTEXE) 
    3758VBoxHeadless_DEFS       = VBOX_FFMPEG 
    3859VBoxHeadless_SOURCES    = VBoxHeadless.cpp 
     
    4162 VBoxHeadless_SOURCES  += Framebuffer.cpp 
    4263endif 
     64ifdef VBOX_WITH_HARDENING 
     65 VBoxHeadless_LDFLAGS.darwin += -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxHeadless.dylib 
     66endif 
    4367 
    4468include $(KBUILD_PATH)/subfooter.kmk 
  • trunk/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp

    r11442 r11725  
    406406 *  Entry point. 
    407407 */ 
    408 int main (int argc, char **argv
     408extern "C" DECLEXPORT (int) TrustedMain (int argc, char **argv, char **envp
    409409{ 
    410410#ifdef VBOX_WITH_VRDP 
     
    430430    /** @todo this should really be taken care of in Main. */ 
    431431    RTEnvUnset("DISPLAY"); 
    432     // initialize VBox Runtime 
    433     RTR3Init(true, ~(size_t)0); 
    434432 
    435433    LogFlow (("VBoxHeadless STARTED.\n")); 
     
    938936} 
    939937 
     938 
     939#ifndef VBOX_WITH_HARDENING 
     940/** 
     941 * Main entry point. 
     942 */ 
     943int main (int argc, char **argv, char **envp) 
     944{ 
     945    // initialize VBox Runtime 
     946    RTR3Init (true, ~(size_t)0); 
     947    return TrustedMain (argc, argv, envp); 
     948} 
     949#endif /* !VBOX_WITH_HARDENING */ 
     950 
  • trunk/src/VBox/Frontends/VBoxSDL/Makefile.kmk

    r11673 r11725  
    2828include $(KBUILD_PATH)/subheader.kmk 
    2929 
    30 PROGRAMS += VBoxSDL tstSDL 
     30 
     31
     32# Targets. 
     33
     34ifdef VBOX_WITH_HARDENING 
     35 ifneq ($(KBUILD_TARGET),darwin) # No hardened VBoxSDL on darwin. 
     36  PROGRAMS += VBoxSDLHardened 
     37  DLLS += VBoxSDL 
     38 endif 
     39else 
     40 PROGRAMS += VBoxSDL 
     41endif 
     42PROGRAMS += tstSDL 
     43 
     44 
     45
     46# Hardened VBoxSDL 
     47
     48VBoxSDLHardened_TEMPLATE = VBOXR3HARDENEDEXE 
     49VBoxSDLHardened_SOURCES = VBoxSDLHardened.cpp 
     50VBoxSDLHardened_NAME = VBoxSDL 
    3151 
    3252 
     
    3454# VBoxSDL 
    3555# 
    36  
    37 VBoxSDL_TEMPLATE   = VBOXMAINCLIENTEXE 
     56VBoxSDL_TEMPLATE  := $(if $(VBOX_WITH_HARDENING),VBOXMAINCLIENTDLL,VBOXMAINCLIENTEXE) 
    3857VBoxSDL_SDKS       = LIBSDL 
    3958VBoxSDL_SOURCES    = \ 
  • trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp

    r11661 r11725  
    946946 
    947947/** entry point */ 
    948 int main(int argc, char *argv[]) 
     948extern "C" 
     949DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp) 
    949950{ 
    950     /* 
    951      * Before we do *anything*, we initialize the runtime. 
    952      */ 
    953     int rcRT = RTR3Init(true, ~(size_t)0); 
    954     if (VBOX_FAILURE(rcRT)) 
    955     { 
    956         RTPrintf("Error: RTR3Init failed rcRC=%d\n", rcRT); 
    957         return 1; 
    958     } 
    959  
    960951#ifdef VBOXSDL_WITH_X11 
    961952    /* 
     
    29262917    return FAILED (rc) ? 1 : 0; 
    29272918} 
     2919 
     2920 
     2921#ifndef VBOX_WITH_HARDENING 
     2922/** 
     2923 * Main entry point 
     2924 */ 
     2925int main(int argc, char **argv) 
     2926{ 
     2927    /* 
     2928     * Before we do *anything*, we initialize the runtime. 
     2929     */ 
     2930    int rcRT = RTR3Init(true, ~(size_t)0); 
     2931    if (VBOX_FAILURE(rcRT)) 
     2932    { 
     2933        RTPrintf("Error: RTR3Init failed rcRC=%d\n", rcRT); 
     2934        return 1; 
     2935    } 
     2936    return TrustedMain(argc, argv, NULL); 
     2937} 
     2938#endif /* !VBOX_WITH_HARDENING */ 
     2939 
    29282940 
    29292941/** 
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r10637 r11725  
    3434# The targets. 
    3535# 
    36 PROGRAMS = VirtualBox 
     36ifdef VBOX_WITH_HARDENING 
     37 PROGRAMS += VirtualBox3Hardened 
     38 DLLS += VirtualBox 
     39else 
     40 PROGRAMS += VirtualBox 
     41endif 
    3742ifeq ($(filter-out freebsd linux openbsd netbsd solaris,$(KBUILD_TARGET)),) # X11 
    38  DLLS = VBoxKeyboard3 
    39  OTHERS = $(PATH_BIN)/vboxkeyboard3.tar.gz 
     43 DLLS += VBoxKeyboard3 
     44 OTHERS += $(PATH_BIN)/vboxkeyboard3.tar.gz 
    4045endif 
    4146DLLS.os2 += VBoxHlp 
    4247ifndef USE_KBUILD_QT3_UNIT 
    43  INSTALLS = VirtualBox.nls 
     48 INSTALLS += VirtualBox.nls 
    4449endif 
    4550 
     
    104109        $(call MSG_TOOL,tar/gzip,,$@) 
    105110        $(QUIET)cd $(PATH_TARGET) && tar -chf - $(addprefix $(SOURCE_DIRECTORY)/,$(subst $(DIRECTORY_PREFIX),,$(VBoxKeyboard3_TARSOURCES))) | gzip - > $@ 
     111 
     112 
     113# 
     114# Hardened VirtualBox4. 
     115# 
     116VirtualBox3Hardened_TEMPLATE = VBOXR3HARDENEDEXE 
     117VirtualBox3Hardened_SOURCES = src/hardenedmain.cpp 
     118VirtualBox3Hardened_NAME = VirtualBox3 
     119ifeq ($(KBUILD_TARGET),darwin) ## @todo use .darwin when ticket 36 has been fixed. 
     120 #VirtualBox3Hardened_INST.darwin = $(INST_BIN)VirtualBox3 $(INST_BIN)VirtualBoxVM3 
     121 VirtualBox3Hardened_INST = $(INST_BIN)VirtualBox3 $(INST_BIN)VirtualBoxVM3 
     122endif 
    106123 
    107124 
     
    163180# VirtualBox - The GUI program. 
    164181# 
    165 VirtualBox_TEMPLATE = VBOXQTGUIEXE 
     182VirtualBox_TEMPLATE := $(if $(VBOX_WITH_HARDENING),VBOXQTGUI,VBOXQTGUIEXE) 
    166183VirtualBox_NAME     = VirtualBox3 
     184ifndef VBOX_WITH_HARDENING # For the launch trick we need different inode numbers. 
     185 ifeq ($(KBUILD_TARGET),darwin) ## @todo use .darwin when ticket 36 has been fixed. 
     186  #VirtualBox_INST.darwin = $(INST_BIN)VirtualBox3 $(INST_BIN)VirtualBoxVM3 
     187  VirtualBox_INST = $(INST_BIN)VirtualBox3 $(INST_BIN)VirtualBoxVM3 
     188 endif 
     189endif 
    167190ifdef USE_KBUILD_QT3_UNIT 
    168191 USES += qt3 
     
    177200endif 
    178201 
    179 ifeq ($(KBUILD_TARGET),darwin) 
    180  # For the launch trick we need different inode numbers. 
    181  VirtualBox_INST = $(INST_BIN)VirtualBox3 $(INST_BIN)VirtualBoxVM3 
    182  # For testing iChat Theater stuff change the sdk path (HACK ALERT) 
    183  ifdef VBOX_WITH_ICHAT_THEATER 
    184   VBOX_PATH_MACOSX_SDK = /Developer/SDKs/MacOSX10.5.sdk 
    185  endif 
    186 endif # darwin 
     202# For testing iChat Theater stuff change the sdk path (HACK ALERT) 
     203ifdef VBOX_WITH_ICHAT_THEATER 
     204 VBOX_PATH_MACOSX_SDK = /Developer/SDKs/MacOSX10.5.sdk 
     205endif 
    187206 
    188207# Import translation sources 
     
    405424endif 
    406425VirtualBox_LDFLAGS.os2    = -Zlinker /PM:PM -Zno-fork 
    407 VirtualBox_LDFLAGS.darwin = -framework IOKit 
     426VirtualBox_LDFLAGS.darwin = \ 
     427        -framework IOKit -framework Carbon -framework QuickTime \ 
     428        $(if $(VBOX_WITH_HARDENING),-install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VirtualBox3.dylib) 
    408429ifdef VBOX_WITH_ICHAT_THEATER 
    409430 VirtualBox_LDFLAGS.darwin += -framework Foundation -framework AppKit -framework InstantMessage -framework QuartzCore 
  • trunk/src/VBox/Frontends/VirtualBox/src/main.cpp

    r8155 r11725  
    114114} 
    115115 
    116 int main (int argc, char **argv
     116extern "C" DECLEXPORT(int) TrustedMain (int argc, char **argv, char **envp
    117117{ 
    118     /* Initialize VBox Runtime. Initialize the Suplib+GC as well only if we 
    119      * are really about to start a VM. Don't do this if we are only starting 
    120      * the selector window. */ 
    121     bool fInitGC = false; 
    122     for (int i = 0; i < argc; i++) 
    123     { 
    124         if (!::strcmp(argv[i], "-startvm" )) 
    125         { 
    126             fInitGC = true; 
    127             break; 
    128         } 
    129     } 
    130     RTR3Init (fInitGC, ~(size_t)0); 
    131  
    132118    LogFlowFuncEnter(); 
    133119 
     
    281267    return rc; 
    282