Checkpoint and restore task->fs->umask
PATCH 1/1 Checkpoint and restore task->fs->umask
Without this, a task's umask will likely be different before and after a c/r cycle. Since the user is able to set their umask to anything (within reason) this is a rather trivial addition.
--- fs/checkpoint.c | 18 +++++++++++++----- include/linux/checkpoint_hdr.h | 1 + 2 files changed, 14 insertions(+), 5 deletions(-)
fs/checkpoint.c +13 -5
@@ -418,6 +418,9 @@ static int checkpoint_fs(struct ckpt_ctx *ctx, void *ptr) h =ckpt_hdr_get_type (ctx,sizeof (*h),CKPT_HDR_FS );if (!h)return -ENOMEM ; + + h->umask = fs->umask; + ret =ckpt_write_obj (ctx, &h->h);ckpt_hdr_put (ctx, h);if (ret)
@@ -984,18 +987,21 @@ static int restore_cwd(struct ckpt_ctx *ctx, struct fs_struct *fs, char *name)static void *restore_fs (struct ckpt_ctx *ctx) {struct ckpt_hdr_fs *h; -struct fs_struct *fs; +struct fs_struct *fs =NULL ;char *path;int ret =0 ; h =ckpt_read_obj_type (ctx,sizeof (*h),CKPT_HDR_FS );if (IS_ERR (h))return ERR_PTR (PTR_ERR (h)); -ckpt_hdr_put (ctx, h); fs =copy_fs_struct (current->fs); -if (!fs) -return ERR_PTR (-ENOMEM ); +if (!fs) { + ret = -ENOMEM ; + goto out; + } + + fs->umask = h->umask &S_IRWXUGO ; ret =ckpt_read_fname (ctx, &path);if (ret <0 )
@@ -1012,8 +1018,10 @@ static void *restore_fs(struct ckpt_ctx *ctx)kfree (path); out: +ckpt_hdr_put (ctx, h);if (ret) { -free_fs_struct (fs); +if (fs) +free_fs_struct (fs);return ERR_PTR (ret); }return fs;
include/linux/checkpoint_hdr.h +1 -0
@@ -524,6 +524,7 @@ enum restart_block_type {/* file system */ struct ckpt_hdr_fs {struct ckpt_hdr h; +__u32 umask;/* char *fs_root */ /* char *fs_pwd */ } __attribute__((aligned (8 )));
Signature · 1 line
1.7.1.1
Serge E. Hallyn
Acked-byQuoted 5 lines · Dan Smith
Without this, a task's umask will likely be different before and after a c/r cycle. Since the user is able to set their umask to anything (within reason) this is a rather trivial addition.
Signed-off-by Dan Smith <danms-r/[email protected]>
Quoted 76 lines
--- fs/checkpoint.c | 18 +++++++++++++----- include/linux/checkpoint_hdr.h | 1 + 2 files changed, 14 insertions(+), 5 deletions(-)fs/checkpoint.c +13
-5@@ -418,6 +418,9 @@ static int checkpoint_fs(struct ckpt_ctx *ctx, void *ptr) h =ckpt_hdr_get_type (ctx,sizeof (*h),CKPT_HDR_FS );if (!h)return -ENOMEM ; + + h->umask = fs->umask; + ret =ckpt_write_obj (ctx, &h->h);ckpt_hdr_put (ctx, h);if (ret)@@ -984,18 +987,21 @@ static int restore_cwd(struct ckpt_ctx *ctx, struct fs_struct *fs, char *name)static void *restore_fs (struct ckpt_ctx *ctx) {struct ckpt_hdr_fs *h; -struct fs_struct *fs; +struct fs_struct *fs =NULL ;char *path;int ret =0 ; h =ckpt_read_obj_type (ctx,sizeof (*h),CKPT_HDR_FS );if (IS_ERR (h))return ERR_PTR (PTR_ERR (h)); -ckpt_hdr_put (ctx, h); fs =copy_fs_struct (current->fs); -if (!fs) -return ERR_PTR (-ENOMEM ); +if (!fs) { + ret = -ENOMEM ; + goto out; + } + + fs->umask = h->umask &S_IRWXUGO ; ret =ckpt_read_fname (ctx, &path);if (ret <0 )@@ -1012,8 +1018,10 @@ static void *restore_fs(struct ckpt_ctx *ctx)kfree (path); out: +ckpt_hdr_put (ctx, h);if (ret) { -free_fs_struct (fs); +if (fs) +free_fs_struct (fs);return ERR_PTR (ret); }return fs;include/linux/checkpoint_hdr.h +1
-0@@ -524,6 +524,7 @@ enum restart_block_type {/* file system */ struct ckpt_hdr_fs {struct ckpt_hdr h; +__u32 umask;/* char *fs_root */ /* char *fs_pwd */ } __attribute__((aligned (8 )));Signature · 6 lines
1.7.1.1 _______________________________________________ Containers mailing list Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org https://lists.linux-foundation.org/mailman/listinfo/containers
Acked and pulled into v22-dev, thanks.
Oren.
Quoted 90 lines · Serge E. Hallyn
Quoted 5 lines · Dan Smith
Without this, a task's umask will likely be different before and after a c/r cycle. Since the user is able to set their umask to anything (within reason) this is a rather trivial addition.
Signed-off-by Dan Smith <danms-r/[email protected]>Acked-by Serge E. Hallyn <[email protected]>Quoted 76 lines
--- fs/checkpoint.c | 18 +++++++++++++----- include/linux/checkpoint_hdr.h | 1 + 2 files changed, 14 insertions(+), 5 deletions(-)fs/checkpoint.c +13
-5@@ -418,6 +418,9 @@ static int checkpoint_fs(struct ckpt_ctx *ctx, void *ptr) h =ckpt_hdr_get_type (ctx,sizeof (*h),CKPT_HDR_FS );if (!h)return -ENOMEM ; + + h->umask = fs->umask; + ret =ckpt_write_obj (ctx, &h->h);ckpt_hdr_put (ctx, h);if (ret)@@ -984,18 +987,21 @@ static int restore_cwd(struct ckpt_ctx *ctx, struct fs_struct *fs, char *name)static void *restore_fs (struct ckpt_ctx *ctx) {struct ckpt_hdr_fs *h; -struct fs_struct *fs; +struct fs_struct *fs =NULL ;char *path;int ret =0 ; h =ckpt_read_obj_type (ctx,sizeof (*h),CKPT_HDR_FS );if (IS_ERR (h))return ERR_PTR (PTR_ERR (h)); -ckpt_hdr_put (ctx, h); fs =copy_fs_struct (current->fs); -if (!fs) -return ERR_PTR (-ENOMEM ); +if (!fs) { + ret = -ENOMEM ; + goto out; + } + + fs->umask = h->umask &S_IRWXUGO ; ret =ckpt_read_fname (ctx, &path);if (ret <0 )@@ -1012,8 +1018,10 @@ static void *restore_fs(struct ckpt_ctx *ctx)kfree (path); out: +ckpt_hdr_put (ctx, h);if (ret) { -free_fs_struct (fs); +if (fs) +free_fs_struct (fs);return ERR_PTR (ret); }return fs;include/linux/checkpoint_hdr.h +1
-0@@ -524,6 +524,7 @@ enum restart_block_type {/* file system */ struct ckpt_hdr_fs {struct ckpt_hdr h; +__u32 umask;/* char *fs_root */ /* char *fs_pwd */ } __attribute__((aligned (8 )));Signature · 6 lines
1.7.1.1 _______________________________________________ Containers mailing list Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org https://lists.linux-foundation.org/mailman/listinfo/containers_______________________________________________
Containers mailing list Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
https://lists.linux-foundation.org/mailman/listinfo/containers