Skip to content

Commit 350eac1

Browse files
committed
IPRT/r0drv/linux: We only need init_mm for 5.10 and later at the moment. bugreg:10963 bugref:11038
svn:sync-xref-src-repo-rev: r173373
1 parent 29fa63f commit 350eac1

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

src/VBox/Runtime/r0drv/linux/initterm-r0drv-linux.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Id: initterm-r0drv-linux.c 113547 2026-03-24 23:42:47Z knut.osmundsen@oracle.com $ */
1+
/* $Id: initterm-r0drv-linux.c 113603 2026-03-26 23:37:08Z knut.osmundsen@oracle.com $ */
22
/** @file
33
* IPRT - Initialization & Termination, R0 Driver, Linux.
44
*/
@@ -130,10 +130,15 @@ DECLHIDDEN(int) rtR0InitNative(void)
130130

131131
/*
132132
* There are some unexported symbols we want, try get them:
133-
* - 'init_mm' so we can protect kernel memory (esp on arm64).
133+
*
134+
* - 'init_mm' so we can protect kernel memory (esp on arm64) in
135+
* memobj-r0drv-linux.c (IPRT_USE_APPLY_TO_PAGE_RANGE_FOR_EXEC).
136+
* Which means it's needed for 5.10. The symbol was exported
137+
* before 2.6.25.
138+
*
134139
* - __flush_tlb_all is restricted since 6.19 (x86 & amd64).
135140
*/
136-
#if RTLNX_VER_MIN(3,16,0) /** @todo support this for older kernels (see also dbgkrnlinfo-r0drv-linux.c and fileio-r0drv-linux.c) */
141+
#if RTLNX_VER_MIN(5,10,0) /* (this works back to 2.30 in theory) */
137142
{
138143
RTDBGKRNLINFO hKrnlInfo;
139144
int rc2 = RTR0DbgKrnlInfoOpen(&hKrnlInfo, 0);
@@ -149,7 +154,7 @@ DECLHIDDEN(int) rtR0InitNative(void)
149154
RTR0DbgKrnlInfoRelease(hKrnlInfo);
150155
}
151156
else
152-
printk(KERN_WARNING "rtR0InitNative: RTR0DbgKrnlInfoOpen failed: %d\n", rc);
157+
printk(KERN_WARNING "rtR0InitNative: RTR0DbgKrnlInfoOpen failed: %d\n", rc2);
153158

154159
# if RTLNX_VER_MIN(6,19,0) && (defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86))
155160
if (!RT_VALID_PTR(g_pfnLinuxFlushTlbAll))

src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Id: memobj-r0drv-linux.c 113547 2026-03-24 23:42:47Z knut.osmundsen@oracle.com $ */
1+
/* $Id: memobj-r0drv-linux.c 113603 2026-03-26 23:37:08Z knut.osmundsen@oracle.com $ */
22
/** @file
33
* IPRT - Ring-0 Memory Objects, Linux.
44
*/
@@ -95,6 +95,7 @@
9595
* It would be possible to remove IPRT_USE_ALLOC_VM_AREA_FOR_EXEC and use
9696
* this path execlusively for 3.2+ but no time to test it really works on every
9797
* supported kernel, so better play safe for now.
98+
* @note Adjust init_mm resolving in rtR0InitNative() if changing version here.
9899
*/
99100
#if RTLNX_VER_MIN(5,10,0) || defined(DOXYGEN_RUNNING)
100101
# define IPRT_USE_APPLY_TO_PAGE_RANGE_FOR_EXEC

0 commit comments

Comments
 (0)