Skip to content

Commit cfaf237

Browse files
committed
Add support for MADV_GUARD_{INSTALL,REMOVE}.
Fixes #3997
1 parent 0b91a14 commit cfaf237

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

src/kernel_supplement.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,12 @@ struct rr_input_mask {
281281
#ifndef MADV_COLLAPSE
282282
#define MADV_COLLAPSE 25
283283
#endif
284+
#ifndef MADV_GUARD_INSTALL
285+
# define MADV_GUARD_INSTALL 102
286+
#endif
287+
#ifndef MADV_GUARD_REMOVE
288+
# define MADV_GUARD_REMOVE 103
289+
#endif
284290

285291
#ifndef BUS_MCEERR_AR
286292
#define BUS_MCEERR_AR 4

src/record_syscall.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5236,6 +5236,8 @@ static Switchable rec_prepare_syscall_arch(RecordTask* t,
52365236
case MADV_POPULATE_WRITE:
52375237
case MADV_DONTNEED_LOCKED:
52385238
case MADV_COLLAPSE:
5239+
case MADV_GUARD_INSTALL:
5240+
case MADV_GUARD_REMOVE:
52395241
break;
52405242
case MADV_FREE: {
52415243
// MADV_FREE introduces nondeterminism --- the kernel zeroes the

src/test/madvise_misc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ int main(void) {
2929
DO_MADVISE(MADV_POPULATE_READ);
3030
DO_MADVISE(MADV_POPULATE_WRITE);
3131
DO_MADVISE(MADV_COLLAPSE);
32+
DO_MADVISE(MADV_GUARD_INSTALL);
33+
DO_MADVISE(MADV_GUARD_REMOVE);
3234

3335
atomic_puts("EXIT-SUCCESS");
3436

0 commit comments

Comments
 (0)