summaryrefslogtreecommitdiffstats
path: root/src/VBox/Runtime
diff options
context:
space:
mode:
Diffstat (limited to 'src/VBox/Runtime')
-rw-r--r--src/VBox/Runtime/common/misc/reqpool.cpp6
-rw-r--r--src/VBox/Runtime/common/path/RTPathGlob.cpp4
-rw-r--r--src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c27
-rw-r--r--src/VBox/Runtime/r3/win/process-win.cpp2
-rw-r--r--src/VBox/Runtime/r3/xml.cpp16
5 files changed, 49 insertions, 6 deletions
diff --git a/src/VBox/Runtime/common/misc/reqpool.cpp b/src/VBox/Runtime/common/misc/reqpool.cpp
index 1489c5b7..594289c6 100644
--- a/src/VBox/Runtime/common/misc/reqpool.cpp
+++ b/src/VBox/Runtime/common/misc/reqpool.cpp
@@ -395,6 +395,7 @@ static DECLCALLBACK(int) rtReqPoolThreadProc(RTTHREAD hThreadSelf, void *pvArg)
if (pReq)
{
Assert(RTListIsEmpty(&pThread->IdleNode)); /* Must not be in the idle list. */
+ ASMAtomicDecU32(&pPool->cIdleThreads); /* Was already marked as idle above. */
RTCritSectLeave(&pPool->CritSect);
rtReqPoolThreadProcessRequest(pPool, pThread, pReq);
@@ -437,7 +438,10 @@ static DECLCALLBACK(int) rtReqPoolThreadProc(RTTHREAD hThreadSelf, void *pvArg)
{
uint64_t cNsIdle = RTTimeNanoTS() - pThread->uIdleNanoTs;
if (cNsIdle >= pPool->cNsMinIdle)
+ {
+ ASMAtomicDecU32(&pPool->cIdleThreads); /* Was already marked as idle above. */
return rtReqPoolThreadExit(pPool, pThread, true /*fLocked*/);
+ }
}
if (RTListIsEmpty(&pThread->IdleNode))
@@ -578,7 +582,7 @@ DECLHIDDEN(void) rtReqPoolSubmit(PRTREQPOOLINT pPool, PRTREQINT pReq)
* If there is an incoming worker thread already or we've reached the
* maximum number of worker threads, we're done.
*/
- if ( pPool->cIdleThreads > 0
+ if ( pPool->cIdleThreads >= pPool->cCurPendingRequests
|| pPool->cCurThreads >= pPool->cMaxThreads)
{
RTCritSectLeave(&pPool->CritSect);
diff --git a/src/VBox/Runtime/common/path/RTPathGlob.cpp b/src/VBox/Runtime/common/path/RTPathGlob.cpp
index 46a634b2..16527527 100644
--- a/src/VBox/Runtime/common/path/RTPathGlob.cpp
+++ b/src/VBox/Runtime/common/path/RTPathGlob.cpp
@@ -486,7 +486,7 @@ static DECLCALLBACK(int) rtPathVarQuery_Path(uint32_t iItem, char *pszBuf, size_
#endif
if (rc == VERR_BUFFER_OVERFLOW)
{
- for (uint32_t iTry = 0; iTry < 10; iTry++)
+ for (uint32_t iTry = 0;; iTry++)
{
size_t cbPathBuf = RT_ALIGN_Z(cchActual + 1 + 64 * iTry, 64);
pszPathFree = (char *)RTMemTmpAlloc(cbPathBuf);
@@ -495,6 +495,8 @@ static DECLCALLBACK(int) rtPathVarQuery_Path(uint32_t iItem, char *pszBuf, size_
break;
RTMemTmpFree(pszPathFree);
AssertReturn(cchActual >= cbPathBuf, VERR_INTERNAL_ERROR_3);
+ if (iTry >= 9)
+ return rc;
}
pszPath = pszPathFree;
}
diff --git a/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
index 8342fbf8..70c5e3dc 100644
--- a/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
+++ b/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
@@ -144,7 +144,8 @@ typedef struct RTR0MEMOBJLNX
/** The pages in the apPages array. */
size_t cPages;
/** Array of struct page pointers. (variable size) */
- struct page *apPages[1];
+ RT_FLEXIBLE_ARRAY_EXTENSION
+ struct page *apPages[RT_FLEXIBLE_ARRAY];
} RTR0MEMOBJLNX;
/** Pointer to the linux memory object. */
typedef RTR0MEMOBJLNX *PRTR0MEMOBJLNX;
@@ -215,9 +216,21 @@ static pgprot_t rtR0MemObjLinuxConvertProt(unsigned fProt, bool fKernel)
#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
if (fKernel)
{
+# if RTLNX_VER_MIN(6,6,0)
+ /* In kernel 6.6 mk_pte() macro was fortified with additional
+ * check which does not allow to use our custom mask anymore
+ * (see kernel commit ae1f05a617dcbc0a732fbeba0893786cd009536c).
+ * For this particular mapping case, an existing mask PAGE_KERNEL_ROX
+ * can be used instead. PAGE_KERNEL_ROX was introduced in
+ * kernel 5.8, however, lets apply it for kernels 6.6 and newer
+ * to be on a safe side.
+ */
+ return PAGE_KERNEL_ROX;
+# else
pgprot_t fPg = MY_PAGE_KERNEL_EXEC;
pgprot_val(fPg) &= ~_PAGE_RW;
return fPg;
+# endif
}
return PAGE_READONLY_EXEC;
#else
@@ -1174,7 +1187,11 @@ RTDECL(struct page *) rtR0MemObjLinuxVirtToPage(void *pv)
u.Four = *p4d_offset(&u.Global, ulAddr);
if (RT_UNLIKELY(p4d_none(u.Four)))
return NULL;
+# if RTLNX_VER_MIN(5,6,0)
+ if (p4d_leaf(u.Four))
+# else
if (p4d_large(u.Four))
+# endif
{
pPage = p4d_page(u.Four);
AssertReturn(pPage, NULL);
@@ -1190,7 +1207,11 @@ RTDECL(struct page *) rtR0MemObjLinuxVirtToPage(void *pv)
if (RT_UNLIKELY(pud_none(u.Upper)))
return NULL;
# if RTLNX_VER_MIN(2,6,25)
+# if RTLNX_VER_MIN(5,6,0)
+ if (pud_leaf(u.Upper))
+# else
if (pud_large(u.Upper))
+# endif
{
pPage = pud_page(u.Upper);
AssertReturn(pPage, NULL);
@@ -1206,7 +1227,11 @@ RTDECL(struct page *) rtR0MemObjLinuxVirtToPage(void *pv)
if (RT_UNLIKELY(pmd_none(u.Middle)))
return NULL;
#if RTLNX_VER_MIN(2,6,0)
+# if RTLNX_VER_MIN(5,6,0)
+ if (pmd_leaf(u.Middle))
+# else
if (pmd_large(u.Middle))
+# endif
{
pPage = pmd_page(u.Middle);
AssertReturn(pPage, NULL);
diff --git a/src/VBox/Runtime/r3/win/process-win.cpp b/src/VBox/Runtime/r3/win/process-win.cpp
index 18ed9ab0..8f84d231 100644
--- a/src/VBox/Runtime/r3/win/process-win.cpp
+++ b/src/VBox/Runtime/r3/win/process-win.cpp
@@ -730,7 +730,7 @@ static bool rtProcWinFindTokenByProcess(const char * const *papszNames, PSID pSi
for (size_t i = 0; papszNames[i] && !fFound; i++)
{
PROCESSENTRY32W ProcEntry;
- ProcEntry.dwSize = sizeof(PROCESSENTRY32);
+ ProcEntry.dwSize = sizeof(ProcEntry);
ProcEntry.szExeFile[0] = '\0';
if (g_pfnProcess32FirstW(hSnap, &ProcEntry))
{
diff --git a/src/VBox/Runtime/r3/xml.cpp b/src/VBox/Runtime/r3/xml.cpp
index a6661760..f96d45f5 100644
--- a/src/VBox/Runtime/r3/xml.cpp
+++ b/src/VBox/Runtime/r3/xml.cpp
@@ -1856,12 +1856,20 @@ static void xmlParserBaseGenericError(void *pCtx, const char *pszMsg, ...) RT_NO
va_end(args);
}
+#if LIBXML_VERSION >= 21206
+static void xmlStructuredErrorFunc(void *userData, const xmlError *error) RT_NOTHROW_DEF
+{
+ NOREF(userData);
+ NOREF(error);
+}
+#else
static void xmlParserBaseStructuredError(void *pCtx, xmlErrorPtr error) RT_NOTHROW_DEF
{
NOREF(pCtx);
/* we expect that there is always a trailing NL */
LogRel(("XML error at '%s' line %d: %s", error->file, error->line, error->message));
}
+#endif
XmlParserBase::XmlParserBase()
{
@@ -1870,7 +1878,11 @@ XmlParserBase::XmlParserBase()
throw std::bad_alloc();
/* per-thread so it must be here */
xmlSetGenericErrorFunc(NULL, xmlParserBaseGenericError);
+#if LIBXML_VERSION >= 21206
+ xmlSetStructuredErrorFunc(NULL, xmlStructuredErrorFunc);
+#else
xmlSetStructuredErrorFunc(NULL, xmlParserBaseStructuredError);
+#endif
}
XmlParserBase::~XmlParserBase()
@@ -1931,7 +1943,7 @@ void XmlMemParser::read(const void *pvBuf, size_t cbSize,
pcszFilename,
NULL, // encoding = auto
options)))
- throw XmlError(xmlCtxtGetLastError(m_ctxt));
+ throw XmlError((xmlErrorPtr)xmlCtxtGetLastError(m_ctxt));
doc.refreshInternals();
}
@@ -2191,7 +2203,7 @@ void XmlFileParser::read(const RTCString &strFilename,
pcszFilename,
NULL, // encoding = auto
options)))
- throw XmlError(xmlCtxtGetLastError(m_ctxt));
+ throw XmlError((xmlErrorPtr)xmlCtxtGetLastError(m_ctxt));
doc.refreshInternals();
}