Add MCL_ONFAULT to mlockall calls
PATCH 1/1 Add MCL_ONFAULT to mlockall calls
The new mlock2 system call was added, but it looks like the MCL_ONFAULT flag was missed. This is now a valid flag to pass to mlockall(), but it must be used in conjunction with either MCL_CURRENT or MCL_FUTURE (or both). Also rework the way that the flags value for mlockall() is caclulated. It is valid to pass any combination of the MCL_* flags except for MCL_ONFAULT alone.
--- syscalls/mlockall.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
syscalls/mlockall.c +8 -5
@@ -10,20 +10,23 @@#define MCL_CURRENT 1#define MCL_FUTURE 2 +#define MCL_ONFAULT 4static void sanitise_mlockall (struct syscallrecord *rec) {if (rec->a1 !=0 )return ; -if (RAND_BOOL ()) - rec->a1 =MCL_CURRENT ; -else - rec->a1 =MCL_FUTURE ; +/* +* There are two invalid bit patterns for MCL flags, 0, and MCL_ONFAULT +* alone. All other combinations should be valid. +*/ +while (rec->a1 ==0 || rec->a1 ==MCL_ONFAULT ) + rec->a1 = (RAND_BYTE () &0x07 ); }static unsigned long mlockall_flags[] = { -MCL_CURRENT ,MCL_FUTURE , +MCL_CURRENT ,MCL_FUTURE ,MCL_ONFAULT , };struct syscallentry syscall_mlockall = {
Signature · 1 line
1.9.1
Dave Jones
AppliedQuoted 9 lines · Eric B Munson
The new mlock2 system call was added, but it looks like the
MCL_ONFAULTflag was missed. This is now a valid flag to pass tomlockall(), but it must be used in conjunction with eitherMCL_CURRENTorMCL_FUTURE(or both). Also rework the way that the flags value formlockall()is caclulated. It is valid to pass any combination of the MCL_* flags except forMCL_ONFAULTalone.Signed-off-by Eric B Munson <[email protected]>Cc Dave Jones <[email protected]>
thanks, applied and pushed.
Dave