Skip to content

Commit dc4a31a

Browse files
author
GitHub Copilot
committed
Add PR_GET_MDWE support (Fixes #4043)
1 parent 03c47a7 commit dc4a31a

File tree

5 files changed

+25
-0
lines changed

5 files changed

+25
-0
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,6 +1273,7 @@ set(BASIC_TESTS
12731273
prctl_auxv
12741274
prctl_caps
12751275
prctl_deathsig
1276+
prctl_mdwe
12761277
prctl_name
12771278
prctl_short_name
12781279
prctl_speculation_ctrl

src/kernel_supplement.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,11 @@ enum {
570570
#define MEMREAD _IOWR('M', 26, typename Arch::mtd_read_req)
571571
#endif
572572

573+
// New in the 6.3 kernel
574+
#ifndef PR_GET_MDWE
575+
#define PR_GET_MDWE 66
576+
#endif
577+
573578
// New in the 6.4 kernel
574579
#ifndef PR_GET_AUXV
575580
#define PR_GET_AUXV 0x41555856

src/record_syscall.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4791,6 +4791,7 @@ static Switchable rec_prepare_syscall_arch(RecordTask* t,
47914791
case PR_SET_SECUREBITS:
47924792
case PR_GET_SECUREBITS:
47934793
case PR_GET_TAGGED_ADDR_CTRL:
4794+
case PR_GET_MDWE:
47944795
break;
47954796

47964797
case PR_SET_TAGGED_ADDR_CTRL:

src/test/prctl_mdwe.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/* -*- Mode: C; tab-width: 8; c-basic-offset: 2; indent-tabs-mode: nil; -*- */
2+
3+
#include "util.h"
4+
5+
int main(void) {
6+
int ret = prctl(PR_GET_MDWE, 0, 0, 0, 0);
7+
if (ret == -1 && errno == EINVAL) {
8+
atomic_puts("PR_GET_MDWE not supported, skipping test");
9+
atomic_puts("EXIT-SUCCESS");
10+
return 0;
11+
}
12+
test_assert(ret >= 0);
13+
atomic_puts("EXIT-SUCCESS");
14+
return 0;
15+
}

src/test/util.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,9 @@ struct rr_open_how {
557557
#ifndef PR_SET_VMA_ANON_NAME
558558
#define PR_SET_VMA_ANON_NAME 0
559559
#endif
560+
#ifndef PR_GET_MDWE
561+
#define PR_GET_MDWE 66
562+
#endif
560563
#ifndef PR_GET_AUXV
561564
#define PR_GET_AUXV 0x41555856
562565
#endif

0 commit comments

Comments
 (0)