[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Signed-off-by: Eric B Munson <emunson@xxxxxxxxxx>
Cc: Dave Jones <davej@xxxxxxxxxxxxxxxxx>
---
 syscalls/mlockall.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/syscalls/mlockall.c b/syscalls/mlockall.c
index 4485aa6..9c99424 100644
--- a/syscalls/mlockall.c
+++ b/syscalls/mlockall.c
@@ -10,20 +10,23 @@
 
 #define MCL_CURRENT     1
 #define MCL_FUTURE      2
+#define MCL_ONFAULT	4
 
 static 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 = {
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe trinity" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SCSI]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux