From: Eric B Munson <emunson@akamai.com>
To: trinity@vger.kernel.org
Cc: Eric B Munson <emunson@akamai.com>, Dave Jones <davej@codemonkey.org.uk>
Subject: [PATCH] Add MCL_ONFAULT to mlockall calls
Date: Wed, 20 Jan 2016 14:51:12 -0500 [thread overview]
Message-ID: <1453319472-8660-1-git-send-email-emunson@akamai.com> (raw)
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
next reply other threads:[~2016-01-20 19:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-20 19:51 Eric B Munson [this message]
2016-01-20 20:14 ` [PATCH] Add MCL_ONFAULT to mlockall calls Dave Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1453319472-8660-1-git-send-email-emunson@akamai.com \
--to=emunson@akamai.com \
--cc=davej@codemonkey.org.uk \
--cc=trinity@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).