From: Serge E. Hallyn <se...@us.ibm.com>

Signed-off-by: Serge E. Hallyn <se...@us.ibm.com>
---
 arch/x86/kernel/checkpoint.c |    4 +++-
 checkpoint/restart.c         |   18 ++++++++++++++----
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/checkpoint.c b/arch/x86/kernel/checkpoint.c
index 961b131..7c73983 100644
--- a/arch/x86/kernel/checkpoint.c
+++ b/arch/x86/kernel/checkpoint.c
@@ -465,8 +465,10 @@ int restore_read_header_arch(struct ckpt_ctx *ctx)
        /* verify FPU capabilities */
        if (h->has_fxsr != cpu_has_fxsr ||
            h->has_xsave != cpu_has_xsave ||
-           h->xstate_size != xstate_size)
+           h->xstate_size != xstate_size) {
                ret = -EINVAL;
+               ckpt_err(ctx, ret, "incompatible FPU capabilities");
+       }
 
        ckpt_hdr_put(ctx, h);
        return ret;
diff --git a/checkpoint/restart.c b/checkpoint/restart.c
index fcd07fa..9bb17fc 100644
--- a/checkpoint/restart.c
+++ b/checkpoint/restart.c
@@ -569,12 +569,14 @@ static int check_kernel_const(struct ckpt_const *h)
                return -EINVAL;
        if (h->uts_nodename_len != sizeof(uts->nodename))
                return -EINVAL;
+#if 0
        if (h->uts_release_len != sizeof(uts->release))
                return -EINVAL;
        if (h->uts_version_len != sizeof(uts->version))
                return -EINVAL;
        if (h->uts_machine_len != sizeof(uts->machine))
                return -EINVAL;
+#endif
        if (h->uts_domainname_len != sizeof(uts->domainname))
                return -EINVAL;
        /* rlimit */
@@ -601,20 +603,28 @@ static int restore_read_header(struct ckpt_ctx *ctx)
                return PTR_ERR(h);
 
        ret = -EINVAL;
-       if (le16_to_cpu(h->arch_id) != CKPT_ARCH_ID)
+       if (le16_to_cpu(h->arch_id) != CKPT_ARCH_ID) {
+               ckpt_err(ctx, ret, "incompatible ARCH_ID");
                goto out;
+       }
        if (h->magic != CHECKPOINT_MAGIC_HEAD ||
            h->rev != CHECKPOINT_VERSION ||
            h->major != ((LINUX_VERSION_CODE >> 16) & 0xff) ||
            h->minor != ((LINUX_VERSION_CODE >> 8) & 0xff) ||
-           h->patch != ((LINUX_VERSION_CODE) & 0xff))
+           h->patch != ((LINUX_VERSION_CODE) & 0xff)) {
+               ckpt_err(ctx, ret, "incompatible VERSION");
                goto out;
-       if (h->uflags & ~CHECKPOINT_USER_FLAGS)
+       }
+       if (h->uflags & ~CHECKPOINT_USER_FLAGS) {
+               ckpt_err(ctx, ret, "bad restart user flags");
                goto out;
+       }
 
        ret = check_kernel_const(&h->constants);
-       if (ret < 0)
+       if (ret < 0) {
+               ckpt_err(ctx, ret, "incompatible kernel constants");
                goto out;
+       }
 
        ret = -ENOMEM;
        uts = kmalloc(sizeof(*uts), GFP_KERNEL);
-- 
1.6.0.4

_______________________________________________
Containers mailing list
contain...@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers

_______________________________________________
Devel mailing list
Devel@openvz.org
https://openvz.org/mailman/listinfo/devel

Reply via email to