Skip to content

Commit b3f37e0

Browse files
committed
没有只读 XN 时,不退化成用户可写
1 parent ed1b1f2 commit b3f37e0

1 file changed

Lines changed: 6 additions & 14 deletions

File tree

components/lwp/arch/common/vdso_kernel.c

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Date Author Notes
88
* 2024-07-04 rcitach init ver.
99
* 2025-04-22 ScuDays Add VDSO functionality under the riscv64 architecture.
10-
* 2026-04-21 rcitach Refactor vDSO runtime around the clock data page.
10+
* 2026-04-21 rcitach Refactor vDSO runtime around the clock data page.
1111
*/
1212

1313
#include <rtthread.h>
@@ -59,23 +59,15 @@ static int rt_vdso_runtime_status = RT_EOK;
5959
static struct timespec rt_vdso_realtime_offset;
6060
static rt_bool_t rt_vdso_realtime_offset_ready;
6161

62-
#ifndef MMU_MAP_U_ROCB
63-
#define MMU_MAP_U_ROCB MMU_MAP_U_RWCB
64-
#endif
65-
66-
#ifndef MMU_MAP_U_RWCB_XN
67-
#define MMU_MAP_U_RWCB_XN MMU_MAP_U_RWCB
68-
#endif
69-
7062
#ifdef MMU_MAP_U_ROCB_XN
7163
#define RT_VDSO_DATA_PAGE_ATTR MMU_MAP_U_ROCB_XN
72-
#elif defined(MMU_MAP_U_RWCB_XN)
73-
#define RT_VDSO_DATA_PAGE_ATTR MMU_MAP_U_RWCB_XN
74-
#else
64+
65+
#elif defined(MMU_MAP_U_ROCB)
7566
#define RT_VDSO_DATA_PAGE_ATTR MMU_MAP_U_ROCB
76-
#endif
7767

78-
#define RT_VDSO_IMAGE_PAGE_ATTR MMU_MAP_U_ROCB
68+
#else
69+
#error "No user-read-only mapping available for vDSO data page!"
70+
#endif
7971

8072
static void rt_vdso_normalize_timespec(struct timespec *ts)
8173
{

0 commit comments

Comments
 (0)