* [PATCH] Add MCL_ONFAULT to mlockall calls
@ 2016-01-20 19:51 Eric B Munson
2016-01-20 20:14 ` Dave Jones
0 siblings, 1 reply; 2+ messages in thread
From: Eric B Munson @ 2016-01-20 19:51 UTC (permalink / raw)
To: trinity; +Cc: Eric B Munson, Dave Jones
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@akamai.com>
Cc: Dave Jones <davej@codemonkey.org.uk>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Add MCL_ONFAULT to mlockall calls
2016-01-20 19:51 [PATCH] Add MCL_ONFAULT to mlockall calls Eric B Munson
@ 2016-01-20 20:14 ` Dave Jones
0 siblings, 0 replies; 2+ messages in thread
From: Dave Jones @ 2016-01-20 20:14 UTC (permalink / raw)
To: Eric B Munson; +Cc: trinity
On Wed, Jan 20, 2016 at 02:51:12PM -0500, Eric B Munson wrote:
> 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@akamai.com>
> Cc: Dave Jones <davej@codemonkey.org.uk>
thanks, applied and pushed.
Dave
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-01-20 20:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-20 19:51 [PATCH] Add MCL_ONFAULT to mlockall calls Eric B Munson
2016-01-20 20:14 ` Dave Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).