[CRIU] [PATCH 3/4] ipc: handle MSG_PEEK_ALL flag if CONFIG_CHECKPOINT_RESTORE is dropped

Stanislav Kinsbursky skinsbursky at parallels.com
Mon Apr 9 13:54:12 EDT 2012


Return -ENOSYS, if user called sys_msgrcv() with MSG_PEEK_ALL flag set and
checkpoint/restore code wasn't compiled.

---
 ipc/compat.c |    5 ++++-
 ipc/msg.c    |    4 ++++
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/ipc/compat.c b/ipc/compat.c
index bb9350d..0163aa1 100644
--- a/ipc/compat.c
+++ b/ipc/compat.c
@@ -377,7 +377,10 @@ long compat_sys_msgrcv(int first, int second, int msgtyp, int third,
 		return -EINVAL;
 	if (second < 0)
 		return -EINVAL;
-
+#ifndef CONFIG_CHECKPOINT_RESTORE
+	if (third & MSG_PEEK_ALL)
+		return -ENOSYS;
+#endif
 	if (!version) {
 		struct compat_ipc_kludge ipck;
 		if (!uptr)
diff --git a/ipc/msg.c b/ipc/msg.c
index 8d63cc7..9d8f249 100644
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -819,6 +819,10 @@ long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp,
 
 	if (msqid < 0 || (long) bufsz < 0)
 		return -EINVAL;
+#ifndef CONFIG_CHECKPOINT_RESTORE
+	if (msgflg & MSG_PEEK_ALL)
+		return -ENOSYS;
+#endif
 	mode = convert_mode(&msgtyp, msgflg);
 	ns = current->nsproxy->ipc_ns;
 



More information about the CRIU mailing list