OpenVZ Forum - RDF feed
type: channel
items: [PATCH v6 03/10] ipc: segment key change helper introduced
items: Re: [PATCH v6 03/10] ipc: segment key change helper introduced

[PATCH v6 03/10] ipc: segment key change helper introduced
type: item
description: This patch introduces existent segment key changing infrastructure. New function ipc_update_key() can be used change segment key, cuid, cgid values. It checks for that new key is not used (except IPC_PRIVATE) prior to set it on existent. To make this possible, added copying of this fields from user-space in __get_compat_ipc_perm() and __get_compat_ipc64_perm() functions. Also segment search by key and lock were splitted into different functions, because ipc_update_key() doesn't need to lock the segment during check that new key is not used. Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> --- ipc/compat.c | 6 ++++++ ipc/util.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++--- ipc/util.h | 2 ++ 3 files changed, 56 insertions(+), 3 deletions(-) diff --git a/ipc/compat.c b/ipc/compat.c index ad9518e..af30d13 100644 --- a/ipc/compat.c +++ b/ipc/compat.c @@ -144,6 +144,9 @@ static inline int __get_compat_ipc64_perm(struct ipc64_perm *p64, err = __get_user(p64->uid, &up64->uid); err |= __get_user(p64->gid, &up64->gid); err |= __get_user(p64->mode, &up64->mode); + err |= __get_user(p64->cuid, &up64->cuid); + err |= __get_user(p64->cgid, &up64->cgid); + err |= __get_user(p64->key, &up64->key); return err; } @@ -155,6 +158,9 @@ static inline int __get_compat_ipc_perm(struct ipc64_perm *p, err = __get_user(p->uid, &up->uid); err |= __get_user(p->gid, &up->gid); err |= __get_user(p->mode, &up->mode); + err |= __get_user(p->cuid, &up->cuid); + err |= __get_user(p->cgid, &up->cgid); + err |= __get_user(p->key, &up->key); return err; } diff --git a/ipc/util.c b/ipc/util.c index 503946e..faae296 100644 --- a/ipc/util.c +++ b/ipc/util.c @@ -173,7 +173,7 @@ void __init ipc_init_proc_interface(const char *path, const char *header, * @key: The key to find * * Requires ipc_ids.rw_mutex locked. - * Returns the LOCKED pointer to the ipc structure if found or NULL + * Returns the UNLOCKED pointer to the ipc structure if found or NULL * if not. * If key is found ipc p…
creator: Stanislav Kinsbursky
date: 2012-10-15T15:59:51-00:00

Re: [PATCH v6 03/10] ipc: segment key change helper introduced
type: item
description: Quoting Stanislav Kinsbursky (skinsbursky@parallels.com): > This patch introduces existent segment key changing infrastructure. > New function ipc_update_key() can be used change segment key, cuid, cgid > values. It checks for that new key is not used (except IPC_PRIVATE) prior to > set it on existent. > To make this possible, added copying of this fields from user-space in > __get_compat_ipc_perm() and __get_compat_ipc64_perm() functions. Also segment > search by key and lock were splitted into different functions, because > ipc_update_key() doesn't need to lock the segment during check that new key is > not used. > > Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com> > --- > ipc/compat.c | 6 ++++++ > ipc/util.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++--- > ipc/util.h | 2 ++ > 3 files changed, 56 insertions(+), 3 deletions(-) > > diff --git a/ipc/compat.c b/ipc/compat.c > index ad9518e..af30d13 100644 > --- a/ipc/compat.c > +++ b/ipc/compat.c > @@ -144,6 +144,9 @@ static inline int __get_compat_ipc64_perm(struct ipc64_perm *p64, > err = __get_user(p64->uid, &up64->uid); > err |= __get_user(p64->gid, &up64->gid); > err |= __get_user(p64->mode, &up64->mode); > + err |= __get_user(p64->cuid, &up64->cuid); > + err |= __get_user(p64->cgid, &up64->cgid); > + err |= __get_user(p64->key, &up64->key); > return err; > } > > @@ -155,6 +158,9 @@ static inline int __get_compat_ipc_perm(struct ipc64_perm *p, > err = __get_user(p->uid, &up->uid); > err |= __get_user(p->gid, &up->gid); > err |= __get_user(p->mode, &up->mode); > + err |= __get_user(p->cuid, &up->cuid); > + err |= __get_user(p->cgid, &up->cgid); > + err |= __get_user(p->key, &up->key); > return err; > } > > diff --git a/ipc/util.c b/ipc/util.c > index 503946e..faae296 100644 > --- a/ipc/util.c > +++ b/ipc/util.c > @@ -173,7 +173,7 @@ void __init ipc_init_proc_interface(const char *path, const char *header, > * @key: The key to find > * > *…
creator: Serge E. Hallyn
date: 2012-10-23T16:19:58-00:00