OpenVZ Forum - RDF feed
type: channel
items: [RFC PATCH 6/6] IPC/sem: .write operation for /proc/<self>/semundo
items: Re: [RFC PATCH 6/6] IPC/sem: .write operation for /proc/<self>/semundo

[RFC PATCH 6/6] IPC/sem: .write operation for /proc/<self>/semundo
type: item
description: PATCH [06/06] This patch introduces the .write seq operation for /proc/pid/semundo. In order to simplify the locking strategy, the write operation is only allowed to 'current'. Signed-off-by: Nadia Derbey <Nadia.Derbey@bull.net> --- fs/proc/base.c | 2 ipc/sem.c | 250 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 250 insertions(+), 2 deletions(-) Index: linux-2.6.26-rc5-mm3/fs/proc/base.c =================================================================== --- linux-2.6.26-rc5-mm3.orig/fs/proc/base.c 2008-06-24 10:03:33.000000000 +0200 +++ linux-2.6.26-rc5-mm3/fs/proc/base.c 2008-06-24 13:21:44.000000000 +0200 @@ -2526,7 +2526,7 @@ static const struct pid_entry tgid_base_ INF("io", S_IRUGO, tgid_io_accounting), #endif #ifdef CONFIG_SYSVIPC - REG("semundo", S_IRUGO, semundo), + REG("semundo", S_IWUSR|S_IRUGO, semundo), #endif }; Index: linux-2.6.26-rc5-mm3/ipc/sem.c =================================================================== --- linux-2.6.26-rc5-mm3.orig/ipc/sem.c 2008-06-24 12:59:15.000000000 +0200 +++ linux-2.6.26-rc5-mm3/ipc/sem.c 2008-06-25 08:56:07.000000000 +0200 @@ -1554,7 +1554,27 @@ static int semundo_open(struct inode *in goto out_err; } - ulp = get_proc_ulp(task); + if (file->f_flags & O_WRONLY || file->f_flags & O_RDWR) { + /* + * Writing is only allowed to current + */ + if (task != current) { + put_task_struct(task); + ret = -EPERM; + goto out_err; + } + /* + * No need to increment the undo_list's refcnt: only current + * can be freeing it through exit, and we are current. + * Only signal through the ulp NULL pointer that it won't be + * necessary to decrement the refcnt during release. + * Actually, in this path the undo_list will be gotten during + * the write operation. + */ + ulp = NULL; + } else + ulp = get_proc_ulp(task); + ns = get_ipc_ns(task->nsproxy->ipc_ns); put_task_struct(task); @@ -1574,6 +1594,233 @@ out_err: return ret; } +/* Skip all spaces at the beginning of the buffer */ +static inline int skip_spac…
creator: Nadia Derbey
date: 2008-06-25T13:49:16-00:00

Re: [RFC PATCH 6/6] IPC/sem: .write operation for /proc/<self>/semundo
type: item
description: Quoting Nadia.Derbey@bull.net (Nadia.Derbey@bull.net): > PATCH [06/06] > > This patch introduces the .write seq operation for /proc/pid/semundo. > > In order to simplify the locking strategy, the write operation is only allowed > to 'current'. There should also be a patch against Documentation/filesystems/proc.txt > Signed-off-by: Nadia Derbey <Nadia.Derbey@bull.net> > > --- > fs/proc/base.c | 2 > ipc/sem.c | 250 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- > 2 files changed, 250 insertions(+), 2 deletions(-) > > Index: linux-2.6.26-rc5-mm3/fs/proc/base.c > =================================================================== > --- linux-2.6.26-rc5-mm3.orig/fs/proc/base.c 2008-06-24 10:03:33.000000000 +0200 > +++ linux-2.6.26-rc5-mm3/fs/proc/base.c 2008-06-24 13:21:44.000000000 +0200 > @@ -2526,7 +2526,7 @@ static const struct pid_entry tgid_base_ > INF("io", S_IRUGO, tgid_io_accounting), > #endif > #ifdef CONFIG_SYSVIPC > - REG("semundo", S_IRUGO, semundo), > + REG("semundo", S_IWUSR|S_IRUGO, semundo), > #endif > }; > > Index: linux-2.6.26-rc5-mm3/ipc/sem.c > =================================================================== > --- linux-2.6.26-rc5-mm3.orig/ipc/sem.c 2008-06-24 12:59:15.000000000 +0200 > +++ linux-2.6.26-rc5-mm3/ipc/sem.c 2008-06-25 08:56:07.000000000 +0200 > @@ -1554,7 +1554,27 @@ static int semundo_open(struct inode *in > goto out_err; > } > > - ulp = get_proc_ulp(task); > + if (file->f_flags & O_WRONLY || file->f_flags & O_RDWR) { > + /* > + * Writing is only allowed to current > + */ > + if (task != current) { > + put_task_struct(task); > + ret = -EPERM; > + goto out_err; > + } > + /* > + * No need to increment the undo_list's refcnt: only current > + * can be freeing it through exit, and we are current. > + * Only signal through the ulp NULL pointer that it won't be > + * necessary to decrement the refcnt during release. > + * Actually, in this path the undo_list will be gotten during > + * the write operation. > + */ (I'll probably…
creator: serue
date: 2008-06-25T21:09:37-00:00

Re: [RFC PATCH 6/6] IPC/sem: .write operation for /proc/<self>/semundo
type: item
description: Serge E. Hallyn wrote: > Quoting Nadia.Derbey@bull.net (Nadia.Derbey@bull.net): > >>PATCH [06/06] >> >>This patch introduces the .write seq operation for /proc/pid/semundo. >> >>In order to simplify the locking strategy, the write operation is only allowed >>to 'current'. > > > There should also be a patch against Documentation/filesystems/proc.txt > Ok, will do that. > >>Signed-off-by: Nadia Derbey <Nadia.Derbey@bull.net> >> >>--- >> fs/proc/base.c | 2 >> ipc/sem.c | 250 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- >> 2 files changed, 250 insertions(+), 2 deletions(-) >> >>Index: linux-2.6.26-rc5-mm3/fs/proc/base.c >>=================================================================== >>--- linux-2.6.26-rc5-mm3.orig/fs/proc/base.c 2008-06-24 10:03:33.000000000 +0200 >>+++ linux-2.6.26-rc5-mm3/fs/proc/base.c 2008-06-24 13:21:44.000000000 +0200 >>@@ -2526,7 +2526,7 @@ static const struct pid_entry tgid_base_ >> INF("io", S_IRUGO, tgid_io_accounting), >> #endif >> #ifdef CONFIG_SYSVIPC >>- REG("semundo", S_IRUGO, semundo), >>+ REG("semundo", S_IWUSR|S_IRUGO, semundo), >> #endif >> }; >> >>Index: linux-2.6.26-rc5-mm3/ipc/sem.c >>=================================================================== >>--- linux-2.6.26-rc5-mm3.orig/ipc/sem.c 2008-06-24 12:59:15.000000000 +0200 >>+++ linux-2.6.26-rc5-mm3/ipc/sem.c 2008-06-25 08:56:07.000000000 +0200 >>@@ -1554,7 +1554,27 @@ static int semundo_open(struct inode *in >> goto out_err; >> } >> >>- ulp = get_proc_ulp(task); >>+ if (file->f_flags & O_WRONLY || file->f_flags & O_RDWR) { >>+ /* >>+ * Writing is only allowed to current >>+ */ >>+ if (task != current) { >>+ put_task_struct(task); >>+ ret = -EPERM; >>+ goto out_err; >>+ } >>+ /* >>+ * No need to increment the undo_list's refcnt: only current >>+ * can be freeing it through exit, and we are current. >>+ * Only signal through the ulp NULL pointer that it won't be >>+ * necessary to decrement the refcnt during release. >>+ * Actually, in this path the undo_list…
creator: Nadia Derbey
date: 2008-06-26T05:44:25-00:00

Re: [RFC PATCH 6/6] IPC/sem: .write operation for /proc/<self>/semundo
type: item
description: Quoting Nadia.Derbey@bull.net (Nadia.Derbey@bull.net): > PATCH [06/06] > > This patch introduces the .write seq operation for /proc/pid/semundo. > > In order to simplify the locking strategy, the write operation is only allowed > to 'current'. > > > Signed-off-by: Nadia Derbey <Nadia.Derbey@bull.net> Acked-by: Serge Hallyn <serue@us.ibm.com> Have you written a patch to cryo in light of the new (target==current) restriction? thanks, -serge > > --- > fs/proc/base.c | 2 > ipc/sem.c | 250 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- > 2 files changed, 250 insertions(+), 2 deletions(-) > > Index: linux-2.6.26-rc5-mm3/fs/proc/base.c > =================================================================== > --- linux-2.6.26-rc5-mm3.orig/fs/proc/base.c 2008-06-24 10:03:33.000000000 +0200 > +++ linux-2.6.26-rc5-mm3/fs/proc/base.c 2008-06-24 13:21:44.000000000 +0200 > @@ -2526,7 +2526,7 @@ static const struct pid_entry tgid_base_ > INF("io", S_IRUGO, tgid_io_accounting), > #endif > #ifdef CONFIG_SYSVIPC > - REG("semundo", S_IRUGO, semundo), > + REG("semundo", S_IWUSR|S_IRUGO, semundo), > #endif > }; > > Index: linux-2.6.26-rc5-mm3/ipc/sem.c > =================================================================== > --- linux-2.6.26-rc5-mm3.orig/ipc/sem.c 2008-06-24 12:59:15.000000000 +0200 > +++ linux-2.6.26-rc5-mm3/ipc/sem.c 2008-06-25 08:56:07.000000000 +0200 > @@ -1554,7 +1554,27 @@ static int semundo_open(struct inode *in > goto out_err; > } > > - ulp = get_proc_ulp(task); > + if (file->f_flags & O_WRONLY || file->f_flags & O_RDWR) { > + /* > + * Writing is only allowed to current > + */ > + if (task != current) { > + put_task_struct(task); > + ret = -EPERM; > + goto out_err; > + } > + /* > + * No need to increment the undo_list's refcnt: only current > + * can be freeing it through exit, and we are current. > + * Only signal through the ulp NULL pointer that it won't be > + * necessary to decrement the refcnt during release. > + * Actually, in this path the undo_li…
creator: serue
date: 2008-06-27T14:06:07-00:00

Re: [RFC PATCH 6/6] IPC/sem: .write operation for /proc/<self>/semundo
type: item
description: Serge E. Hallyn wrote: > Quoting Nadia.Derbey@bull.net (Nadia.Derbey@bull.net): > >>PATCH [06/06] >> >>This patch introduces the .write seq operation for /proc/pid/semundo. >> >>In order to simplify the locking strategy, the write operation is only allowed >>to 'current'. >> >> >>Signed-off-by: Nadia Derbey <Nadia.Derbey@bull.net> > > > Acked-by: Serge Hallyn <serue@us.ibm.com> > > Have you written a patch to cryo in light of the new (target==current) > restriction? Nop, will do that. Regards, Nadia > > thanks, > -serge > > >>--- >> fs/proc/base.c | 2 >> ipc/sem.c | 250 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- >> 2 files changed, 250 insertions(+), 2 deletions(-) >> >>Index: linux-2.6.26-rc5-mm3/fs/proc/base.c >>=================================================================== >>--- linux-2.6.26-rc5-mm3.orig/fs/proc/base.c 2008-06-24 10:03:33.000000000 +0200 >>+++ linux-2.6.26-rc5-mm3/fs/proc/base.c 2008-06-24 13:21:44.000000000 +0200 >>@@ -2526,7 +2526,7 @@ static const struct pid_entry tgid_base_ >> INF("io", S_IRUGO, tgid_io_accounting), >> #endif >> #ifdef CONFIG_SYSVIPC >>- REG("semundo", S_IRUGO, semundo), >>+ REG("semundo", S_IWUSR|S_IRUGO, semundo), >> #endif >> }; >> >>Index: linux-2.6.26-rc5-mm3/ipc/sem.c >>=================================================================== >>--- linux-2.6.26-rc5-mm3.orig/ipc/sem.c 2008-06-24 12:59:15.000000000 +0200 >>+++ linux-2.6.26-rc5-mm3/ipc/sem.c 2008-06-25 08:56:07.000000000 +0200 >>@@ -1554,7 +1554,27 @@ static int semundo_open(struct inode *in >> goto out_err; >> } >> >>- ulp = get_proc_ulp(task); >>+ if (file->f_flags & O_WRONLY || file->f_flags & O_RDWR) { >>+ /* >>+ * Writing is only allowed to current >>+ */ >>+ if (task != current) { >>+ put_task_struct(task); >>+ ret = -EPERM; >>+ goto out_err; >>+ } >>+ /* >>+ * No need to increment the undo_list's refcnt: only current >>+ * can be freeing it through exit, and we are current. >>+ * Only signal through the ulp NULL pointer that it won't b…
creator: Nadia Derbey
date: 2008-06-27T14:12:43-00:00

Re: [RFC PATCH 6/6] IPC/sem: .write operation for /proc/<self>/semundo
type: item
description: Serge E. Hallyn wrote: > Quoting Nadia.Derbey@bull.net (Nadia.Derbey@bull.net): > >>PATCH [06/06] >> >>This patch introduces the .write seq operation for /proc/pid/semundo. >> >>In order to simplify the locking strategy, the write operation is only allowed >>to 'current'. >> >> >>Signed-off-by: Nadia Derbey <Nadia.Derbey@bull.net> > > > Acked-by: Serge Hallyn <serue@us.ibm.com> > > Have you written a patch to cryo in light of the new (target==current) > restriction? > Serge, Finally, after having a look at cryo code, it appeared that the semundo proc file was already recreated in "injection mode" for current task. So, nothing to be changed... except that I found a bug at the end of the undo list restoring phase. Sending the patch right now. Regards, Nadia _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: Nadia Derbey
date: 2008-06-30T08:37:24-00:00