Index: /trunk/include/VBox/sup.h
===================================================================
--- /trunk/include/VBox/sup.h	(revision 35151)
+++ /trunk/include/VBox/sup.h	(revision 35152)
@@ -1038,8 +1038,9 @@
  * @param   pszFilename     Image filename. This must have a path.
  * @param   phLdrMod        Where to store the handle to the loaded module.
+ * @param   fFlags          See RTLDRFLAGS_.
  * @param   pszError        Where to return error message on failure.
  * @param   cbError         The size of the error buffer.
  */
-SUPR3DECL(int) SUPR3HardenedLdrLoad(const char *pszFilename, PRTLDRMOD phLdrMod, char *pszError, size_t cbError);
+SUPR3DECL(int) SUPR3HardenedLdrLoad(const char *pszFilename, PRTLDRMOD phLdrMod, uint32_t fFlags, char *pszError, size_t cbError);
 
 /**
@@ -1051,10 +1052,11 @@
  *
  * @returns iprt status code.
- * @param   pszFilename Image filename.
- * @param   phLdrMod    Where to store the handle to the loaded module.
+ * @param   pszFilename     Image filename.
+ * @param   phLdrMod        Where to store the handle to the loaded module.
+ * @param   fFlags          See RTLDRFLAGS_*.
  * @param   pszError        Where to return error message on failure.
  * @param   cbError         The size of the error buffer.
  */
-SUPR3DECL(int) SUPR3HardenedLdrLoadAppPriv(const char *pszFilename, PRTLDRMOD phLdrMod, char *pszError, size_t cbError);
+SUPR3DECL(int) SUPR3HardenedLdrLoadAppPriv(const char *pszFilename, PRTLDRMOD phLdrMod, uint32_t fFlags, char *pszError, size_t cbError);
 
 /**
Index: /trunk/include/iprt/ldr.h
===================================================================
--- /trunk/include/iprt/ldr.h	(revision 35151)
+++ /trunk/include/iprt/ldr.h	(revision 35152)
@@ -36,4 +36,12 @@
  */
 
+/** Symbols defined in this library are not made available to resolve
+ * references in subsequently loaded libraries (default). */
+#define RTLDRFLAGS_LOCAL        0
+/** Symbols defined in this library will be made available for symbol
+ * resolution of subsequently loaded libraries. */
+#define RTLDRFLAGS_GLOBAL       RT_BIT(0)
+
+
 RT_C_DECLS_BEGIN
 
@@ -89,8 +97,9 @@
  * @param   pszFilename Image filename.
  * @param   phLdrMod    Where to store the handle to the loader module.
+ * @param   fFlags      See RTLDFLAGS_.
  * @param   pszError    Where to store an error message on failure. Optional.
  * @param   cbError     The size of the buffer pointed to by @a pszError.
  */
-RTDECL(int) RTLdrLoadEx(const char *pszFilename, PRTLDRMOD phLdrMod, char *pszError, size_t cbError);
+RTDECL(int) RTLdrLoadEx(const char *pszFilename, PRTLDRMOD phLdrMod, uint32_t fFlags, char *pszError, size_t cbError);
 
 /**
Index: /trunk/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp	(revision 35151)
+++ /trunk/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp	(revision 35152)
@@ -836,5 +836,5 @@
 
             Log2(("VBoxHeadless: loading VBoxFFmpegFB shared library\n"));
-            rrc = SUPR3HardenedLdrLoadAppPriv("VBoxFFmpegFB", &hLdrFFmpegFB, szErr, sizeof(szErr));
+            rrc = SUPR3HardenedLdrLoadAppPriv("VBoxFFmpegFB", &hLdrFFmpegFB, 0 /*=fFlags*/, szErr, sizeof(szErr));
 
             if (RT_SUCCESS(rrc))
Index: /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp	(revision 35151)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp	(revision 35152)
@@ -5115,5 +5115,5 @@
         char szErr[8192];
         szErr[0] = '\0';
-        int vrc = SUPR3HardenedLdrLoadAppPriv("VBoxDbg", &mhVBoxDbg, szErr, sizeof(szErr));
+        int vrc = SUPR3HardenedLdrLoadAppPriv("VBoxDbg", &mhVBoxDbg, 0 /*=fFlags*/, szErr, sizeof(szErr));
         if (RT_FAILURE(vrc))
         {
Index: /trunk/src/VBox/GuestHost/OpenGL/Makefile.kmk
===================================================================
--- /trunk/src/VBox/GuestHost/OpenGL/Makefile.kmk	(revision 35151)
+++ /trunk/src/VBox/GuestHost/OpenGL/Makefile.kmk	(revision 35152)
@@ -400,4 +400,8 @@
 	$(VBOX_PATH_CROGL_GENFILES)/state_isenabled.c \
 	$(VBOX_PATH_CROGL_GENFILES)/state/cr_statefuncs.h
+ifneq ($(KBUILD_TARGET),win)
+state_tracker/state_lists.c_CFLAGS += $(VBOX_GCC_Wno-pointer-sign)
+VBoxOGLcrstate_CFLAGS += 
+endif
 
 #
Index: /trunk/src/VBox/HostDrivers/Support/SUPLib.cpp
===================================================================
--- /trunk/src/VBox/HostDrivers/Support/SUPLib.cpp	(revision 35151)
+++ /trunk/src/VBox/HostDrivers/Support/SUPLib.cpp	(revision 35152)
@@ -2083,8 +2083,9 @@
  * @param   pszFilename     The full file name.
  * @param   phLdrMod        Where to store the handle to the loaded module.
+ * @param   fFlags          See RTLDFLAGS_.
  * @param   pszError        Where to return the loader error. Optional.
  * @param   cbError         The size of the buffer pointed to by @a pszError.
  */
-static int supR3HardenedLdrLoadIt(const char *pszFilename, PRTLDRMOD phLdrMod, char *pszError, size_t cbError)
+static int supR3HardenedLdrLoadIt(const char *pszFilename, PRTLDRMOD phLdrMod, uint32_t fFlags, char *pszError, size_t cbError)
 {
 #ifdef VBOX_WITH_HARDENING
@@ -2103,9 +2104,9 @@
      * Try load it.
      */
-    return RTLdrLoadEx(pszFilename, phLdrMod, pszError, cbError);
-}
-
-
-SUPR3DECL(int) SUPR3HardenedLdrLoad(const char *pszFilename, PRTLDRMOD phLdrMod, char *pszError, size_t cbError)
+    return RTLdrLoadEx(pszFilename, phLdrMod, fFlags, pszError, cbError);
+}
+
+
+SUPR3DECL(int) SUPR3HardenedLdrLoad(const char *pszFilename, PRTLDRMOD phLdrMod, uint32_t fFlags, char *pszError, size_t cbError)
 {
     /*
@@ -2145,11 +2146,11 @@
      * Pass it on to the common library loader.
      */
-    return supR3HardenedLdrLoadIt(pszFilename, phLdrMod, pszError, cbError);
-}
-
-
-SUPR3DECL(int) SUPR3HardenedLdrLoadAppPriv(const char *pszFilename, PRTLDRMOD phLdrMod, char *pszError, size_t cbError)
-{
-    LogFlow(("SUPR3HardenedLdrLoadAppPriv: pszFilename=%p:{%s} phLdrMod=%p pszError=%p cbError=%zu\n", pszFilename, pszFilename, phLdrMod, pszError, cbError));
+    return supR3HardenedLdrLoadIt(pszFilename, phLdrMod, fFlags, pszError, cbError);
+}
+
+
+SUPR3DECL(int) SUPR3HardenedLdrLoadAppPriv(const char *pszFilename, PRTLDRMOD phLdrMod, uint32_t fFlags, char *pszError, size_t cbError)
+{
+    LogFlow(("SUPR3HardenedLdrLoadAppPriv: pszFilename=%p:{%s} phLdrMod=%p fFlags=%08x pszError=%p cbError=%zu\n", pszFilename, pszFilename, phLdrMod, fFlags, pszError, cbError));
 
     /*
@@ -2207,5 +2208,5 @@
      * Pass it on to SUPR3HardenedLdrLoad.
      */
-    rc = SUPR3HardenedLdrLoad(szPath, phLdrMod, pszError, cbError);
+    rc = SUPR3HardenedLdrLoad(szPath, phLdrMod, fFlags, pszError, cbError);
 
     LogFlow(("SUPR3HardenedLdrLoadAppPriv: returns %Rrc\n", rc));
@@ -2244,5 +2245,5 @@
      * Try load it.
      */
-    return RTLdrLoadEx(pszFilename, phLdrMod, pszErr, cbErr);
+    return RTLdrLoadEx(pszFilename, phLdrMod, 0 /*=fFlags*/, pszErr, cbErr);
 }
 
Index: /trunk/src/VBox/Main/ConsoleVRDPServer.cpp
===================================================================
--- /trunk/src/VBox/Main/ConsoleVRDPServer.cpp	(revision 35151)
+++ /trunk/src/VBox/Main/ConsoleVRDPServer.cpp	(revision 35152)
@@ -2340,5 +2340,5 @@
             rc = SUPR3HardenedLdrLoadPlugIn(pszLibraryName, &mVRDPLibrary, szErr, sizeof(szErr));
         else
-            rc = SUPR3HardenedLdrLoadAppPriv(pszLibraryName, &mVRDPLibrary, szErr, sizeof(szErr));
+            rc = SUPR3HardenedLdrLoadAppPriv(pszLibraryName, &mVRDPLibrary, 0 /*=fFlags*/, szErr, sizeof(szErr));
         if (RT_SUCCESS(rc))
         {
Index: /trunk/src/VBox/Main/ExtPackManagerImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/ExtPackManagerImpl.cpp	(revision 35151)
+++ /trunk/src/VBox/Main/ExtPackManagerImpl.cpp	(revision 35152)
@@ -149,4 +149,8 @@
     /** The current context. */
     VBOXEXTPACKCTX      enmContext;
+#if !defined(RT_OS_WINDOWS) && !defined(RT_OS_DARWIN)
+    /** File handle for the VBoxVMM libary which we slurp because ExtPacks depend on it. */
+    RTLDRMOD            hVBoxVMM;
+#endif
 
     RTMEMEF_NEW_AND_DELETE_OPERATORS();
@@ -1171,5 +1175,5 @@
     {
         char szError[8192];
-        vrc = RTLdrLoadEx(m->strMainModPath.c_str(), &m->hMainMod, szError, sizeof(szError));
+        vrc = RTLdrLoadEx(m->strMainModPath.c_str(), &m->hMainMod, 0 /*=fFlags*/, szError, sizeof(szError));
         if (RT_FAILURE(vrc))
         {
@@ -1761,4 +1765,18 @@
     m->pVirtualBox          = a_pVirtualBox;
     m->enmContext           = a_enmContext;
+
+    /*
+     * Slurp in VBoxVMM which is used by VBoxPuelMain.
+     */
+#if !defined(RT_OS_WINDOWS) && !defined(RT_OS_DARWIN)
+    if (a_enmContext == VBOXEXTPACKCTX_PER_USER_DAEMON)
+    {
+        char szError[8192];
+        int vrc = SUPR3HardenedLdrLoadAppPriv("VBoxVMM", &m->hVBoxVMM, RTLDRFLAGS_GLOBAL, szError, sizeof(szError));
+        if (RT_FAILURE(vrc))
+            m->hVBoxVMM = NIL_RTLDRMOD;
+        /* cleanup in ::uninit()? */
+    }
+#endif
 
     /*
Index: /trunk/src/VBox/Main/VRDEServerImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/VRDEServerImpl.cpp	(revision 35151)
+++ /trunk/src/VBox/Main/VRDEServerImpl.cpp	(revision 35152)
@@ -494,5 +494,5 @@
         rc = SUPR3HardenedLdrLoadPlugIn(pszLibraryName, &hmod, szErr, sizeof(szErr));
     else
-        rc = SUPR3HardenedLdrLoadAppPriv(pszLibraryName, &hmod, szErr, sizeof(szErr));
+        rc = SUPR3HardenedLdrLoadAppPriv(pszLibraryName, &hmod, 0 /*=fFlags*/, szErr, sizeof(szErr));
     if (RT_SUCCESS(rc))
     {
Index: /trunk/src/VBox/Main/hgcm/HGCM.cpp
===================================================================
--- /trunk/src/VBox/Main/hgcm/HGCM.cpp	(revision 35151)
+++ /trunk/src/VBox/Main/hgcm/HGCM.cpp	(revision 35152)
@@ -264,5 +264,5 @@
     char szErr[8192];
     szErr[0] = '\0';
-    int rc = SUPR3HardenedLdrLoadAppPriv (m_pszSvcLibrary, &m_hLdrMod, szErr, sizeof(szErr));
+    int rc = SUPR3HardenedLdrLoadAppPriv (m_pszSvcLibrary, &m_hLdrMod, 0 /*=fFlags*/, szErr, sizeof(szErr));
 
     if (RT_SUCCESS(rc))
Index: /trunk/src/VBox/Main/webservice/vboxweb.cpp
===================================================================
--- /trunk/src/VBox/Main/webservice/vboxweb.cpp	(revision 35151)
+++ /trunk/src/VBox/Main/webservice/vboxweb.cpp	(revision 35152)
@@ -1155,5 +1155,5 @@
             do
             {
-                rc = RTLdrLoad(filename.c_str(), &hlibAuth);
+                rc = RTLdrLoad(filename.c_str(), &hlibAuth, RTLDRFLAGS_LOCAL);
                 if (RT_FAILURE(rc))
                 {
Index: /trunk/src/VBox/Runtime/common/ldr/ldrNative.cpp
===================================================================
--- /trunk/src/VBox/Runtime/common/ldr/ldrNative.cpp	(revision 35151)
+++ /trunk/src/VBox/Runtime/common/ldr/ldrNative.cpp	(revision 35152)
@@ -96,12 +96,12 @@
 RTDECL(int) RTLdrLoad(const char *pszFilename, PRTLDRMOD phLdrMod)
 {
-    return RTLdrLoadEx(pszFilename, phLdrMod, NULL, 0);
+    return RTLdrLoadEx(pszFilename, phLdrMod, 0 /*=fFlags*/, NULL, 0);
 }
 RT_EXPORT_SYMBOL(RTLdrLoad);
 
 
-RTDECL(int) RTLdrLoadEx(const char *pszFilename, PRTLDRMOD phLdrMod, char *pszError, size_t cbError)
-{
-    LogFlow(("RTLdrLoadEx: pszFilename=%p:{%s} phLdrMod=%p pszError=%p cbError=%zu\n", pszFilename, pszFilename, phLdrMod, pszError, cbError));
+RTDECL(int) RTLdrLoadEx(const char *pszFilename, PRTLDRMOD phLdrMod, uint32_t fFlags, char *pszError, size_t cbError)
+{
+    LogFlow(("RTLdrLoadEx: pszFilename=%p:{%s} phLdrMod=%p fFlags=%08x pszError=%p cbError=%zu\n", pszFilename, pszFilename, phLdrMod, fFlags, pszError, cbError));
 
     /*
@@ -136,5 +136,5 @@
          * Attempt to open the module.
          */
-        rc = rtldrNativeLoad(pszFilename, &pMod->hNative, pszError, cbError);
+        rc = rtldrNativeLoad(pszFilename, &pMod->hNative, fFlags, pszError, cbError);
         if (RT_SUCCESS(rc))
         {
Index: /trunk/src/VBox/Runtime/include/internal/ldr.h
===================================================================
--- /trunk/src/VBox/Runtime/include/internal/ldr.h	(revision 35151)
+++ /trunk/src/VBox/Runtime/include/internal/ldr.h	(revision 35152)
@@ -365,8 +365,9 @@
  * @param   pszFilename     The image filename.
  * @param   phHandle        Where to store the module handle on success.
+ * @param   fFlags          See RTLDRFLAGS_.
  * @param   pszError        Where to store the error message. Optional.
  * @param   cbError         The size of the error message buffer.
  */
-int rtldrNativeLoad(const char *pszFilename, uintptr_t *phHandle, char *pszError, size_t cbError);
+int rtldrNativeLoad(const char *pszFilename, uintptr_t *phHandle, uint32_t fFlags, char *pszError, size_t cbError);
 
 int rtldrPEOpen(PRTLDRREADER pReader, uint32_t fFlags, RTLDRARCH enmArch, RTFOFF offNtHdrs, PRTLDRMOD phLdrMod);
Index: /trunk/src/VBox/Runtime/r3/posix/ldrNative-posix.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/posix/ldrNative-posix.cpp	(revision 35151)
+++ /trunk/src/VBox/Runtime/r3/posix/ldrNative-posix.cpp	(revision 35152)
@@ -41,5 +41,5 @@
 
 
-int rtldrNativeLoad(const char *pszFilename, uintptr_t *phHandle, char *pszError, size_t cbError)
+int rtldrNativeLoad(const char *pszFilename, uintptr_t *phHandle, uint32_t fFlags, char *pszError, size_t cbError)
 {
     /*
@@ -69,5 +69,10 @@
      * Attempt load.
      */
-    void *pvMod = dlopen(pszFilename, RTLD_NOW | RTLD_LOCAL);
+    int fFlagsNative = RTLD_NOW;
+    if (fFlags & RTLDRFLAGS_GLOBAL)
+        fFlagsNative |= RTLD_GLOBAL;
+    else
+        fFlagsNative |= RTLD_LOCAL;
+    void *pvMod = dlopen(pszFilename, fFlagsNative);
     if (pvMod)
     {
Index: /trunk/src/VBox/Runtime/r3/win/ldrNative-win.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/win/ldrNative-win.cpp	(revision 35151)
+++ /trunk/src/VBox/Runtime/r3/win/ldrNative-win.cpp	(revision 35152)
@@ -40,7 +40,8 @@
 
 
-int rtldrNativeLoad(const char *pszFilename, uintptr_t *phHandle, char *pszError, size_t cbError)
+int rtldrNativeLoad(const char *pszFilename, uintptr_t *phHandle, uint32_t fFlags, char *pszError, size_t cbError)
 {
     Assert(sizeof(*phHandle) >= sizeof(HMODULE));
+    AssertReturn(fFlags == 0, VERR_INVALID_PARAMETER);
 
     /*
Index: /trunk/src/VBox/Storage/VD.cpp
===================================================================
--- /trunk/src/VBox/Storage/VD.cpp	(revision 35151)
+++ /trunk/src/VBox/Storage/VD.cpp	(revision 35152)
@@ -2129,5 +2129,5 @@
         }
 
-        rc = SUPR3HardenedLdrLoad(pszPluginPath, &hPlugin, NULL, 0);
+        rc = SUPR3HardenedLdrLoad(pszPluginPath, &hPlugin, 0 /*=fFlags*/, NULL, 0);
         if (RT_SUCCESS(rc))
         {
@@ -2253,5 +2253,5 @@
         }
 
-        rc = SUPR3HardenedLdrLoad(pszPluginPath, &hPlugin, NULL, 0);
+        rc = SUPR3HardenedLdrLoad(pszPluginPath, &hPlugin, 0 /*=fFlags*/, NULL, 0);
         if (RT_SUCCESS(rc))
         {
Index: /trunk/src/recompiler/VBoxREMWrapper.cpp
===================================================================
--- /trunk/src/recompiler/VBoxREMWrapper.cpp	(revision 35151)
+++ /trunk/src/recompiler/VBoxREMWrapper.cpp	(revision 35152)
@@ -2133,5 +2133,5 @@
      */
     const char *pszModule = remIs64bitEnabled(pVM) ? "VBoxREM64" : "VBoxREM32";
-    int rc = SUPR3HardenedLdrLoadAppPriv(pszModule, &g_ModREM2, NULL, 0);
+    int rc = SUPR3HardenedLdrLoadAppPriv(pszModule, &g_ModREM2, 0 /*=fFlags*/, NULL, 0);
     if (RT_SUCCESS(rc))
     {
