login
Header Space

 
 

Re: [RFC, PATCH] fix SEM_UNDO with namespaces

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Eric W. Biederman <ebiederm@...>
Cc: Pavel Emelyanov <xemul@...>, Manfred Spraul <manfred@...>, Linux Kernel Mailing List <linux-kernel@...>, Andrew Morton <akpm@...>, Serge Hallyn <serue@...>, Sukadev Bhattiprolu <sukadev@...>
Date: Thursday, April 3, 2008 - 3:44 pm

Quoting Eric W. Biederman (ebiederm@xmission.com):

Eric, does the following patch correctly interpret your recommendation?

Pavel does it make sense to you?

thanks,
-serge

From 9c85fb3cb80cea1d888c3c253a9fb6e9bc173649 Mon Sep 17 00:00:00 2001
From: Serge E. Hallyn <serue@us.ibm.com>
Date: Thu, 3 Apr 2008 12:43:23 -0700
Subject: [PATCH 1/1] ipc namespaces: fix svsem unsharing issue

Refuse to unshare an ipcns if the semundo is shared and we
are not requesting a new SYSVSEM

Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
---
 ipc/namespace.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/ipc/namespace.c b/ipc/namespace.c
index 9171d94..9044505 100644
--- a/ipc/namespace.c
+++ b/ipc/namespace.c
@@ -48,6 +48,16 @@ struct ipc_namespace *copy_ipcs(unsigned long flags, struct ipc_namespace *ns)
 	if (!(flags & CLONE_NEWIPC))
 		return ns;
 
+	if (!(flags & CLONE_SYSVSEM)) {
+		if (!current->sysvsem.undo_list)
+			goto ok;
+		if (atomic_read(&current->sysvsem.undo_list->refcnt) == 1)
+			goto ok;
+		put_ipc_ns(ns);
+		return ERR_PTR(-EINVAL);
+	}
+
+ok:
 	new_ns = clone_ipc_ns(ns);
 
 	put_ipc_ns(ns);
-- 
1.5.3.6

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[RFC, PATCH] fix SEM_UNDO with namespaces, Manfred Spraul, (Sun Mar 30, 4:50 pm)
Re: [RFC, PATCH] fix SEM_UNDO with namespaces, Pavel Emelyanov, (Mon Mar 31, 3:12 am)
Re: [RFC, PATCH] fix SEM_UNDO with namespaces, Manfred Spraul, (Mon Mar 31, 12:14 pm)
Re: [RFC, PATCH] fix SEM_UNDO with namespaces, Pavel Emelyanov, (Tue Apr 1, 5:44 am)
Re: [RFC, PATCH] fix SEM_UNDO with namespaces, Eric W. Biederman, (Tue Apr 1, 11:25 am)
Re: [RFC, PATCH] fix SEM_UNDO with namespaces, Serge E. Hallyn, (Thu Apr 3, 3:44 pm)
Re: [RFC, PATCH] fix SEM_UNDO with namespaces, Serge E. Hallyn, (Fri Apr 4, 12:39 am)
Re: [RFC, PATCH] fix SEM_UNDO with namespaces, Manfred Spraul, (Sun Apr 6, 11:11 am)
Re: [RFC, PATCH] fix SEM_UNDO with namespaces, Serge E. Hallyn, (Mon Apr 14, 5:10 pm)
[PATCH] fix SEM_UNDO with namespaces, take 2, Manfred Spraul, (Sun Apr 6, 12:26 pm)
Re: [PATCH] fix SEM_UNDO with namespaces, take 2, Pavel Emelyanov, (Mon Apr 7, 3:21 am)
Re: [PATCH] fix SEM_UNDO with namespaces, take 2, Manfred Spraul, (Mon Apr 7, 1:03 pm)
Re: [PATCH] fix SEM_UNDO with namespaces, take 2, Pavel Emelyanov, (Tue Apr 8, 4:09 am)
Re: [RFC, PATCH] fix SEM_UNDO with namespaces, Manfred Spraul, (Thu Apr 3, 3:40 pm)
Re: [RFC, PATCH] fix SEM_UNDO with namespaces, Serge E. Hallyn, (Tue Apr 1, 10:15 am)
Re: [RFC, PATCH] fix SEM_UNDO with namespaces, Andrew Morton, (Thu Apr 3, 3:04 pm)
Re: [RFC, PATCH] fix SEM_UNDO with namespaces, Manfred Spraul, (Thu Apr 3, 3:31 pm)
speck-geostationary