Skip to content

Commit f8b3918

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

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-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

src/test/util.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,12 @@ struct open_how {
497497
#ifndef MADV_COLLAPSE
498498
#define MADV_COLLAPSE 25
499499
#endif
500+
#ifndef MADV_GUARD_INSTALL
501+
# define MADV_GUARD_INSTALL 102
502+
#endif
503+
#ifndef MADV_GUARD_REMOVE
504+
# define MADV_GUARD_REMOVE 103
505+
#endif
500506

501507
#ifndef F_OFD_GETLK
502508
#define F_OFD_GETLK 36

0 commit comments

Comments
 (0)