Skip to contentSkip to conversation

build breaks when checkpoint unimplemented by arch

DISCUSSION Nathan Lynch 3 participants 12 messages Jul 6, 2009 – Jul 7, 2009 9 messages not in the archive

Subsystems (8)
Memory management x86 VFS x86 MM +4 more subsystems
lore
Share & tools
lore
#0 lore raw

Hi Oren,

With ckpt-v17-rc1 (as well as ckpt-v16-dev) the powerpc build is broken:

In file included from include/linux/checkpoint.h:28,

                 from kernel/exit.c:53:
include/linux/checkpoint_hdr.h:42:32: error: asm/checkpoint_hdr.h: No such file or directory
In file included from include/linux/checkpoint.h:28,
                 from kernel/exit.c:53:

include/linux/checkpoint_hdr.h:410: error: 'CKPT_ARCH_NSIG' undeclared here (not in a function) make[1]: *** [kernel/exit.o] Error 1

It appears that any architecture which does not supply asm/checkpoint_hdr.h is broken in the same way.

Either all architectures need to supply asm/checkpoint_hdr.h (and define CKPT_ARCH_NSIG), or there needs to be some other fix which allows as-yet-unsupported arches to build..

#2 lore raw
In reply to a message not in the archive
Quoted 13 lines · Nathan Lynch

Hi Oren,

With ckpt-v17-rc1 (as well as ckpt-v16-dev) the powerpc build is broken:

In file included from include/linux/checkpoint.h:28,

                 from kernel/exit.c:53:
include/linux/checkpoint_hdr.h:42:32: error: asm/checkpoint_hdr.h: No such file or directory
In file included from include/linux/checkpoint.h:28,
                 from kernel/exit.c:53:

include/linux/checkpoint_hdr.h:410: error: 'CKPT_ARCH_NSIG' undeclared here (not in a function) make[1]: *** [kernel/exit.o] Error 1

Quoted 7 lines

It appears that any architecture which does not supply asm/checkpoint_hdr.h is broken in the same way.

Either all architectures need to supply asm/checkpoint_hdr.h (and define CKPT_ARCH_NSIG), or there needs to be some other fix which allows as-yet-unsupported arches to build..

I see... well - maybe it's time to resend the powerpc port :p

Until then, this patch worked for me to compile without c/r

Oren.

include/linux/checkpoint.h +2 -0
index c47e796..b8f99be 100644
@@ -19,6 +19,7 @@
 #define RESTART_TASKSELF	0x1
 
 #ifdef __KERNEL__
+#ifdef CONFIG_CHECKPOINT
 
 #include <linux/sched.h>
 #include <linux/nsproxy.h>
@@ -299,6 +300,7 @@ extern unsigned long ckpt_debug_level;
 
 #endif /* CONFIG_CHECKPOINT_DEBUG */
 
+#endif /* CONFIG_CHECKPOINT */
 #endif /* __KERNEL__ */
 
 #endif /* _LINUX_CHECKPOINT_H_ */
#4 lore raw
In reply to a message not in the archive
Quoted 18 lines · Oren Laadan
Quoted 16 lines · Nathan Lynch

Hi Oren,

With ckpt-v17-rc1 (as well as ckpt-v16-dev) the powerpc build is broken:

In file included from include/linux/checkpoint.h:28,

                 from kernel/exit.c:53:
include/linux/checkpoint_hdr.h:42:32: error: asm/checkpoint_hdr.h: No such file or directory
In file included from include/linux/checkpoint.h:28,
                 from kernel/exit.c:53:

include/linux/checkpoint_hdr.h:410: error: 'CKPT_ARCH_NSIG' undeclared here (not in a function) make[1]: *** [kernel/exit.o] Error 1

It appears that any architecture which does not supply asm/checkpoint_hdr.h is broken in the same way.

Quoted 6 lines
Quoted 4 lines

Either all architectures need to supply asm/checkpoint_hdr.h (and define CKPT_ARCH_NSIG), or there needs to be some other fix which allows as-yet-unsupported arches to build..

I see... well - maybe it's time to resend the powerpc port :p

arm, sh, etc.

Quoted 1 line

Until then, this patch worked for me to compile without c/r

That isn't enough bc a lot of files are including <linux/checkpoint_hdr.h> and _types.h.

The following patch enables compilation on powerpc, and it still works on s390.

-serge

From 14eb1922d4bb3b01aa5f729022edf843b354ec97 Mon Sep 17 00:00:00 2001
From: root <root-JJi412eHaPLkOmf+N4b0O9FgqiXiwxn+0E9HWUfgJXw@public.gmane.org>
Date: Mon, 6 Jul 2009 16:22:29 -0700
Subject: [PATCH] cr: enable compile on architectures without asm/checkpoint_hdr.h

ifdef out the contents of linux/checkpoint.h if !CONFIG_CHECKPOINT. For all files which were including one of the other checkpoint*.h files, include linux/checkpoint.h instead, which will #include those.

---
 fs/pipe.c                  |    1 -
 include/linux/checkpoint.h |    2 ++
 ipc/shm.c                  |    1 -
 ipc/util.h                 |    2 +-
 kernel/capability.c        |    4 +++-
 mm/filemap.c               |    2 --
 mm/mmap.c                  |    2 --
 mm/shmem.c                 |    2 --
 8 files changed, 6 insertions(+), 10 deletions(-)
fs/pipe.c +0 -1
index 5d4c1c8..18c22eb 100644
@@ -24,7 +24,6 @@
 #include <asm/ioctls.h>
 
 #include <linux/checkpoint.h>
-#include <linux/checkpoint_hdr.h>
 
 /*
  * We use a start+len construction, which provides full use of the 
include/linux/checkpoint.h +2 -0
index c47e796..9d82082 100644
@@ -10,6 +10,7 @@
  *  distribution for more details.
  */
 
+#ifdef CONFIG_CHECKPOINT
 #define CHECKPOINT_VERSION  1
 
 /* checkpoint user flags */
@@ -301,4 +302,5 @@ extern unsigned long ckpt_debug_level;
 
 #endif /* __KERNEL__ */
 
+#endif
 #endif /* _LINUX_CHECKPOINT_H_ */
ipc/shm.c +0 -1
index 0991134..516b179 100644
@@ -40,7 +40,6 @@
 #include <linux/mount.h>
 #include <linux/ipc_namespace.h>
 #include <linux/ima.h>
-#include <linux/checkpoint_hdr.h>
 #include <linux/checkpoint.h>
 
 #include <asm/uaccess.h>
ipc/util.h +1 -1
index 48de0a9..1ddfd90 100644
@@ -12,7 +12,7 @@
 
 #include <linux/unistd.h>
 #include <linux/err.h>
-#include <linux/checkpoint_hdr.h>
+#include <linux/checkpoint.h>
 
 #define SEQ_MULTIPLIER	(IPCMNI)
 
kernel/capability.c +3 -1
index 90cc7b4..94328c9 100644
@@ -15,7 +15,7 @@
 #include <linux/syscalls.h>
 #include <linux/pid_namespace.h>
 #include <linux/securebits.h>
-#include <linux/checkpoint_hdr.h>
+#include <linux/checkpoint.h>
 #include <asm/uaccess.h>
 #include "cred-internals.h"
 
@@ -375,6 +375,7 @@ static inline int restore_cap_bset(kernel_cap_t bset, struct cred *cred)
 }
 #endif /* CONFIG_SECURITY_FILE_CAPABILITIES */
 
+#ifdef CONFIG_CHECKPOINT
 static int do_restore_caps(struct ckpt_capabilities *h, struct cred *cred)
 {
 	kernel_cap_t effective, inheritable, permitted, bset;
@@ -428,6 +429,7 @@ int restore_capabilities(struct ckpt_capabilities *h, struct cred *new)
 
 	return ret;
 }
+#endif
 
 /**
  * capable - Determine if the current task has a superior capability in effect
mm/filemap.c +0 -2
index 782664d..cd8556d 100644
@@ -36,8 +36,6 @@
 #include <linux/mm_inline.h> /* for page_is_file_cache() */
 #include "internal.h"
 
-#include <linux/checkpoint_types.h>
-#include <linux/checkpoint_hdr.h>
 #include <linux/checkpoint.h>
 
 /*
mm/mmap.c +0 -2
index e60424b..ba0b039 100644
@@ -35,8 +35,6 @@
 #include <asm/tlb.h>
 #include <asm/mmu_context.h>
 
-#include <linux/checkpoint_types.h>
-#include <linux/checkpoint_hdr.h>
 #include <linux/checkpoint.h>
 
 #include "internal.h"
mm/shmem.c +0 -2
index e123ec2..7d80ef8 100644
@@ -31,8 +31,6 @@
 #include <linux/swap.h>
 #include <linux/ima.h>
 
-#include <linux/checkpoint_types.h>
-#include <linux/checkpoint_hdr.h>
 #include <linux/checkpoint.h>
 
 static struct vfsmount *shm_mnt;
Signature · 1 line
1.6.2.3
#5 lore raw
In reply to a message not in the archive
Quoted 18 lines · Oren Laadan
Quoted 16 lines · Nathan Lynch

Hi Oren,

With ckpt-v17-rc1 (as well as ckpt-v16-dev) the powerpc build is broken:

In file included from include/linux/checkpoint.h:28,

                 from kernel/exit.c:53:
include/linux/checkpoint_hdr.h:42:32: error: asm/checkpoint_hdr.h: No such file or directory
In file included from include/linux/checkpoint.h:28,
                 from kernel/exit.c:53:

include/linux/checkpoint_hdr.h:410: error: 'CKPT_ARCH_NSIG' undeclared here (not in a function) make[1]: *** [kernel/exit.o] Error 1

It appears that any architecture which does not supply asm/checkpoint_hdr.h is broken in the same way.

Quoted 6 lines
Quoted 4 lines

Either all architectures need to supply asm/checkpoint_hdr.h (and define CKPT_ARCH_NSIG), or there needs to be some other fix which allows as-yet-unsupported arches to build..

I see... well - maybe it's time to resend the powerpc port :p

I'm working on that, but the powerpc port won't be of any help to the twenty-odd other architectures that are broken.

Quoted 15 lines

Until then, this patch worked for me to compile without c/r

include/linux/checkpoint.h +1 -0
index c47e796..b8f99be 100644
@@ -19,6 +19,7 @@
 #define RESTART_TASKSELF	0x1
 
 #ifdef __KERNEL__
+#ifdef CONFIG_CHECKPOINT
 
 #include <linux/sched.h>
 #include <linux/nsproxy.h>

include/linux/checkpoint.h extern unsigned long ckpt_debug_level; · line 304

Quoted 5 lines
include/linux/checkpoint.h +1 -0
@@ -299,6 +300,7 @@ extern unsigned long ckpt_debug_level;
 
 #endif /* CONFIG_CHECKPOINT_DEBUG */
 
+#endif /* CONFIG_CHECKPOINT */
 #endif /* __KERNEL__ */

I think something like the following could be a better approach.

It needs to be split into separate patches with good commit messages, but the gist is that asm/checkpoint_hdr.h should be included only by files built when CONFIG_CHECKPOINT=y.

And linux/checkpoint_hdr.h doesn't really need it: all architectures provide a sigset_t definition.

 arch/x86/mm/checkpoint.c       |    1 +
 checkpoint/checkpoint.c        |    1 +
 checkpoint/restart.c           |    1 +
 include/linux/checkpoint_hdr.h |    6 ++----
 4 files changed, 5 insertions(+), 4 deletions(-)
arch/x86/mm/checkpoint.c +1 -0
index 68432c8..3d21989 100644
@@ -17,6 +17,7 @@
 
 #include <linux/checkpoint.h>
 #include <linux/checkpoint_hdr.h>
+#include <asm/checkpoint_hdr.h>
 
 /*
  * helpers to encode/decode/validate registers/segments/eflags
checkpoint/checkpoint.c +1 -0
index 2d4923c..6e90755 100644
@@ -26,6 +26,7 @@
 #include <linux/hrtimer.h>
 #include <linux/checkpoint.h>
 #include <linux/checkpoint_hdr.h>
+#include <asm/checkpoint_hdr.h>
 
 /* unique checkpoint identifier (FIXME: should be per-container ?) */
 static atomic_t ctx_count = ATOMIC_INIT(0);
checkpoint/restart.c +1 -0
index 7982a03..afe2e1c 100644
@@ -22,6 +22,7 @@
 #include <linux/elf.h>
 #include <linux/checkpoint.h>
 #include <linux/checkpoint_hdr.h>
+#include <asm/checkpoint_hdr.h>
 
 /**
  * _ckpt_read_objref - dispatch handling of a shared object
include/linux/checkpoint_hdr.h +2 -4
index b5243e1..a2872a4 100644
@@ -12,6 +12,7 @@
 
 #include <linux/types.h>
 #include <linux/utsname.h>
+#include <asm/signal.h>
 
 /*
  * To maintain compatibility between 32-bit and 64-bit architecture flavors,
@@ -39,9 +40,6 @@ struct ckpt_hdr {
 } __attribute__((aligned(8)));
 
 
-#include <asm/checkpoint_hdr.h>
-
-
 /* header types */
 enum {
 	CKPT_HDR_HEADER = 1,
@@ -407,7 +405,7 @@ struct ckpt_hdr_pgarr {
 
 /* signals */
 struct ckpt_hdr_sigset {
-	__u8 sigset[CKPT_ARCH_NSIG / 8];
+	sigset_t sigset;
 } __attribute__((aligned(8)));
 
 struct ckpt_hdr_sigaction {
#7 lore raw
In reply to a message not in the archive
Quoted 25 lines · Nathan Lynch
Quoted 23 lines · Oren Laadan
Quoted 20 lines · Nathan Lynch

Hi Oren,

With ckpt-v17-rc1 (as well as ckpt-v16-dev) the powerpc build is broken:

In file included from include/linux/checkpoint.h:28,

                 from kernel/exit.c:53:
include/linux/checkpoint_hdr.h:42:32: error: asm/checkpoint_hdr.h: No such file or directory
In file included from include/linux/checkpoint.h:28,
                 from kernel/exit.c:53:

include/linux/checkpoint_hdr.h:410: error: 'CKPT_ARCH_NSIG' undeclared here (not in a function) make[1]: *** [kernel/exit.o] Error 1

It appears that any architecture which does not supply asm/checkpoint_hdr.h is broken in the same way.

Either all architectures need to supply asm/checkpoint_hdr.h (and define CKPT_ARCH_NSIG), or there needs to be some other fix which allows as-yet-unsupported arches to build..

Quoted 5 lines
Quoted 1 line

I see... well - maybe it's time to resend the powerpc port :p

I'm working on that, but the powerpc port won't be of any help to the twenty-odd other architectures that are broken.

[...]

That's what I tried initially, but the problem is that sigset_t may be defined differently for userspace - see /usr/include/asm/sigset_t.h. In fact, for x86_32, it it is different, defined as 'unsigned long' (and NSIG defined as 32, so only 32 bits).

Moreover, if you include <asm/sigset.h> in checkpoint_hdr.h, which is also included by userspace, you get lots of compilations warnings, because of other stuff included from the kernel's asm/sigset.h that isn't supposed to be included by userspace.

So the introduction of CKPT_ARCH_NSIG is a workaround that.

And back to the other problem - I agree, kernel should only include <linux/checkpoint.h>, which in turn will include <checkpoint_hdr.h> if defined CONFIG_CHECKPOINT.

Can you try this patch:

(Hallyn: note that there is some checkpoint-related code within kerbel/capability.c that should be inside #ifdef CONFIG_CHECKPOINT).

Oren.

fs/pipe.c +1 -2
index 5d4c1c8..68fdab4 100644
@@ -19,12 +19,11 @@
 #include <linux/pagemap.h>
 #include <linux/audit.h>
 #include <linux/syscalls.h>
+#include <linux/checkpoint.h>
 
 #include <asm/uaccess.h>
 #include <asm/ioctls.h>
 
-#include <linux/checkpoint.h>
-#include <linux/checkpoint_hdr.h>
 
 /*
  * We use a start+len construction, which provides full use of the 
include/linux/checkpoint.h +2 -0
index c47e796..b8f99be 100644
@@ -19,6 +19,7 @@
 #define RESTART_TASKSELF	0x1
 
 #ifdef __KERNEL__
+#ifdef CONFIG_CHECKPOINT
 
 #include <linux/sched.h>
 #include <linux/nsproxy.h>
@@ -299,6 +300,7 @@ extern unsigned long ckpt_debug_level;
 
 #endif /* CONFIG_CHECKPOINT_DEBUG */
 
+#endif /* CONFIG_CHECKPOINT */
 #endif /* __KERNEL__ */
 
 #endif /* _LINUX_CHECKPOINT_H_ */
ipc/shm.c +0 -1
index 0991134..516b179 100644
@@ -40,7 +40,6 @@
 #include <linux/mount.h>
 #include <linux/ipc_namespace.h>
 #include <linux/ima.h>
-#include <linux/checkpoint_hdr.h>
 #include <linux/checkpoint.h>
 
 #include <asm/uaccess.h>
kernel/capability.c +3 -1
index 90cc7b4..4f58454 100644
@@ -15,7 +15,7 @@
 #include <linux/syscalls.h>
 #include <linux/pid_namespace.h>
 #include <linux/securebits.h>
-#include <linux/checkpoint_hdr.h>
+#include <linux/checkpoint.h>
 #include <asm/uaccess.h>
 #include "cred-internals.h"
 
@@ -375,6 +375,7 @@ static inline int restore_cap_bset(kernel_cap_t bset, struct cred *cred)
 }
 #endif /* CONFIG_SECURITY_FILE_CAPABILITIES */
 
+#ifdef CONFIG_CHECKPOINT
 static int do_restore_caps(struct ckpt_capabilities *h, struct cred *cred)
 {
 	kernel_cap_t effective, inheritable, permitted, bset;
@@ -428,6 +429,7 @@ int restore_capabilities(struct ckpt_capabilities *h, struct cred *new)
 
 	return ret;
 }
+#endif /* CONFIG_CHECKPOINT */
 
 /**
  * capable - Determine if the current task has a superior capability in effect
mm/filemap.c +1 -3
index 782664d..202bd74 100644
@@ -34,11 +34,9 @@
 #include <linux/hardirq.h> /* for BUG_ON(!in_atomic()) only */
 #include <linux/memcontrol.h>
 #include <linux/mm_inline.h> /* for page_is_file_cache() */
+#include <linux/checkpoint.h>
 #include "internal.h"
 
-#include <linux/checkpoint_types.h>
-#include <linux/checkpoint_hdr.h>
-#include <linux/checkpoint.h>
 
 /*
  * FIXME: remove all knowledge of the buffer layer from the core VM
mm/mmap.c +1 -4
index e60424b..4c01a90 100644
@@ -29,16 +29,13 @@
 #include <linux/rmap.h>
 #include <linux/mmu_notifier.h>
 #include <linux/perf_counter.h>
+#include <linux/checkpoint.h>
 
 #include <asm/uaccess.h>
 #include <asm/cacheflush.h>
 #include <asm/tlb.h>
 #include <asm/mmu_context.h>
 
-#include <linux/checkpoint_types.h>
-#include <linux/checkpoint_hdr.h>
-#include <linux/checkpoint.h>
-
 #include "internal.h"
 
 #ifndef arch_mmap_check
mm/shmem.c +0 -3
index e123ec2..9334810 100644
@@ -30,9 +30,6 @@
 #include <linux/module.h>
 #include <linux/swap.h>
 #include <linux/ima.h>
-
-#include <linux/checkpoint_types.h>
-#include <linux/checkpoint_hdr.h>
 #include <linux/checkpoint.h>
 
 static struct vfsmount *shm_mnt;
#9 lore raw
In reply to a message not in the archive
Quoted 4 lines · Oren Laadan

That's what I tried initially, but the problem is that sigset_t may be defined differently for userspace - see /usr/include/asm/sigset_t.h. In fact, for x86_32, it it is different, defined as 'unsigned long' (and NSIG defined as 32, so only 32 bits).

I noticed this, but I figured only the kernel definition was salient. Apart from debugging checkpoint/restart, why would userspace need the definition of struct ckpt_hdr_sigset?

For that matter, why would userspace need the definitions of most of the structures in checkpoint_hdr.h? (Again, debugging purposes don't count:
ckptinfo or similar developer utilities can be included with the kernel.)

Quoted 4 lines

Moreover, if you include <asm/sigset.h> in checkpoint_hdr.h, which is also included by userspace, you get lots of compilations warnings, because of other stuff included from the kernel's asm/sigset.h that isn't supposed to be included by userspace.

Can you provide examples of such warnings? Are you building against "sanitized" kernel headers (make headers_install) or using them in place?

#16 lore raw
In reply to a message not in the archive
Quoted 45 lines · Oren Laadan
Quoted 25 lines · Nathan Lynch
Quoted 23 lines · Oren Laadan
Quoted 20 lines · Nathan Lynch

Hi Oren,

With ckpt-v17-rc1 (as well as ckpt-v16-dev) the powerpc build is broken:

In file included from include/linux/checkpoint.h:28,

                 from kernel/exit.c:53:
include/linux/checkpoint_hdr.h:42:32: error: asm/checkpoint_hdr.h: No such file or directory
In file included from include/linux/checkpoint.h:28,
                 from kernel/exit.c:53:

include/linux/checkpoint_hdr.h:410: error: 'CKPT_ARCH_NSIG' undeclared here (not in a function) make[1]: *** [kernel/exit.o] Error 1

It appears that any architecture which does not supply asm/checkpoint_hdr.h is broken in the same way.

Either all architectures need to supply asm/checkpoint_hdr.h (and define CKPT_ARCH_NSIG), or there needs to be some other fix which allows as-yet-unsupported arches to build..

Quoted 5 lines
Quoted 1 line

I see... well - maybe it's time to resend the powerpc port :p

I'm working on that, but the powerpc port won't be of any help to the twenty-odd other architectures that are broken.

[...]

That's what I tried initially, but the problem is that sigset_t may be defined differently for userspace - see /usr/include/asm/sigset_t.h. In fact, for x86_32, it it is different, defined as 'unsigned long' (and NSIG defined as 32, so only 32 bits).

Moreover, if you include <asm/sigset.h> in checkpoint_hdr.h, which is also included by userspace, you get lots of compilations warnings, because of other stuff included from the kernel's asm/sigset.h that isn't supposed to be included by userspace.

Quoted 7 lines

So the introduction of CKPT_ARCH_NSIG is a workaround that.

And back to the other problem - I agree, kernel should only include <linux/checkpoint.h>, which in turn will include <checkpoint_hdr.h> if defined CONFIG_CHECKPOINT.

Can you try this patch:

(Which looks exactly like my patch from yesterday.)

Quoted 2 lines

(Hallyn: note that there is some checkpoint-related code within kerbel/capability.c that should be inside #ifdef CONFIG_CHECKPOINT).

Yup, the patch i sent yesterday took care of that.

So if that's the route we want to take, then again I can confirm it did compile on ppc, and compile and boot on s390.

Quoted 139 lines

Oren.

fs/pipe.c +1 -2
index 5d4c1c8..68fdab4 100644
@@ -19,12 +19,11 @@
 #include <linux/pagemap.h>
 #include <linux/audit.h>
 #include <linux/syscalls.h>
+#include <linux/checkpoint.h>
 
 #include <asm/uaccess.h>
 #include <asm/ioctls.h>
 
-#include <linux/checkpoint.h>
-#include <linux/checkpoint_hdr.h>
 
 /*
  * We use a start+len construction, which provides full use of the 
include/linux/checkpoint.h +2 -0
index c47e796..b8f99be 100644
@@ -19,6 +19,7 @@
 #define RESTART_TASKSELF	0x1
 
 #ifdef __KERNEL__
+#ifdef CONFIG_CHECKPOINT
 
 #include <linux/sched.h>
 #include <linux/nsproxy.h>
@@ -299,6 +300,7 @@ extern unsigned long ckpt_debug_level;
 
 #endif /* CONFIG_CHECKPOINT_DEBUG */
 
+#endif /* CONFIG_CHECKPOINT */
 #endif /* __KERNEL__ */
 
 #endif /* _LINUX_CHECKPOINT_H_ */
ipc/shm.c +0 -1
index 0991134..516b179 100644
@@ -40,7 +40,6 @@
 #include <linux/mount.h>
 #include <linux/ipc_namespace.h>
 #include <linux/ima.h>
-#include <linux/checkpoint_hdr.h>
 #include <linux/checkpoint.h>
 
 #include <asm/uaccess.h>
kernel/capability.c +3 -1
index 90cc7b4..4f58454 100644
@@ -15,7 +15,7 @@
 #include <linux/syscalls.h>
 #include <linux/pid_namespace.h>
 #include <linux/securebits.h>
-#include <linux/checkpoint_hdr.h>
+#include <linux/checkpoint.h>
 #include <asm/uaccess.h>
 #include "cred-internals.h"
 
@@ -375,6 +375,7 @@ static inline int restore_cap_bset(kernel_cap_t bset, struct cred *cred)
 }
 #endif /* CONFIG_SECURITY_FILE_CAPABILITIES */
 
+#ifdef CONFIG_CHECKPOINT
 static int do_restore_caps(struct ckpt_capabilities *h, struct cred *cred)
 {
 	kernel_cap_t effective, inheritable, permitted, bset;
@@ -428,6 +429,7 @@ int restore_capabilities(struct ckpt_capabilities *h, struct cred *new)
 
 	return ret;
 }
+#endif /* CONFIG_CHECKPOINT */
 
 /**
  * capable - Determine if the current task has a superior capability in effect
mm/filemap.c +1 -3
index 782664d..202bd74 100644
@@ -34,11 +34,9 @@
 #include <linux/hardirq.h> /* for BUG_ON(!in_atomic()) only */
 #include <linux/memcontrol.h>
 #include <linux/mm_inline.h> /* for page_is_file_cache() */
+#include <linux/checkpoint.h>
 #include "internal.h"
 
-#include <linux/checkpoint_types.h>
-#include <linux/checkpoint_hdr.h>
-#include <linux/checkpoint.h>
 
 /*
  * FIXME: remove all knowledge of the buffer layer from the core VM
mm/mmap.c +1 -4
index e60424b..4c01a90 100644
@@ -29,16 +29,13 @@
 #include <linux/rmap.h>
 #include <linux/mmu_notifier.h>
 #include <linux/perf_counter.h>
+#include <linux/checkpoint.h>
 
 #include <asm/uaccess.h>
 #include <asm/cacheflush.h>
 #include <asm/tlb.h>
 #include <asm/mmu_context.h>
 
-#include <linux/checkpoint_types.h>
-#include <linux/checkpoint_hdr.h>
-#include <linux/checkpoint.h>
-
 #include "internal.h"
 
 #ifndef arch_mmap_check
mm/shmem.c +0 -3
index e123ec2..9334810 100644
@@ -30,9 +30,6 @@
 #include <linux/module.h>
 #include <linux/swap.h>
 #include <linux/ima.h>
-
-#include <linux/checkpoint_types.h>
-#include <linux/checkpoint_hdr.h>
 #include <linux/checkpoint.h>
 
 static struct vfsmount *shm_mnt;

_______________________________________________
Containers mailing list Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
https://lists.linux-foundation.org/mailman/listinfo/containers

#11 lore raw
In reply to a message not in the archive
Quoted 9 lines · Nathan Lynch
Quoted 4 lines · Oren Laadan

That's what I tried initially, but the problem is that sigset_t may be defined differently for userspace - see /usr/include/asm/sigset_t.h. In fact, for x86_32, it it is different, defined as 'unsigned long' (and NSIG defined as 32, so only 32 bits).

I noticed this, but I figured only the kernel definition was salient. Apart from debugging checkpoint/restart, why would userspace need the definition of struct ckpt_hdr_sigset?

I expect user space tools to at least:

- Assist in debugging c/r

- Assist users in reporting problems with c/r (especially since they themselves do not debug or hack)

- Convert checkpoint images from one kernel version to another

- Provide information about a checkpoint image, and even allow its manipulation. This can assist developers in debugging their programs (e.g. to debug a crash you need to run a program for 30 minutes so it ets up its state; instead of repeatedly running it, you run it once, checkpoint, and then debug from a restarted version. A tool could allow you to peek/poke inside the checkpoint and even modify data in it).

- Or a tool that converts a checkpoint image to a core dump so it can be inspected with gdb.

I'm pretty sure others will find other uses to it...

Quoted 5 lines

For that matter, why would userspace need the definitions of most of the structures in checkpoint_hdr.h? (Again, debugging purposes don't count:
ckptinfo or similar developer utilities can be included with the kernel.)

Keeping the checkpoint header format understandable by user space (and immune to 32-64 variations) has been a requirement since day 1.

Quoted 4 lines
Quoted 4 lines

Moreover, if you include <asm/sigset.h> in checkpoint_hdr.h, which is also included by userspace, you get lots of compilations warnings, because of other stuff included from the kernel's asm/sigset.h that

						      ^^^^^^^^^^^^^
					I meant:      asm/siginfo.h
Quoted 6 lines
Quoted 1 line

isn't supposed to be included by userspace.

Can you provide examples of such warnings? Are you building against "sanitized" kernel headers (make headers_install) or using them in place?

Both.

Oren.

#18 lore raw
In reply to a message not in the archive
Quoted 48 lines · Serge E. Hallyn
Quoted 47 lines · Oren Laadan
Quoted 25 lines · Nathan Lynch
Quoted 23 lines · Oren Laadan
Quoted 20 lines · Nathan Lynch

Hi Oren,

With ckpt-v17-rc1 (as well as ckpt-v16-dev) the powerpc build is broken:

In file included from include/linux/checkpoint.h:28,

                 from kernel/exit.c:53:
include/linux/checkpoint_hdr.h:42:32: error: asm/checkpoint_hdr.h: No such file or directory
In file included from include/linux/checkpoint.h:28,
                 from kernel/exit.c:53:

include/linux/checkpoint_hdr.h:410: error: 'CKPT_ARCH_NSIG' undeclared here (not in a function) make[1]: *** [kernel/exit.o] Error 1

It appears that any architecture which does not supply asm/checkpoint_hdr.h is broken in the same way.

Either all architectures need to supply asm/checkpoint_hdr.h (and define CKPT_ARCH_NSIG), or there needs to be some other fix which allows as-yet-unsupported arches to build..

Quoted 5 lines
Quoted 1 line

I see... well - maybe it's time to resend the powerpc port :p

I'm working on that, but the powerpc port won't be of any help to the twenty-odd other architectures that are broken.

[...]

That's what I tried initially, but the problem is that sigset_t may be defined differently for userspace - see /usr/include/asm/sigset_t.h. In fact, for x86_32, it it is different, defined as 'unsigned long' (and NSIG defined as 32, so only 32 bits).

Moreover, if you include <asm/sigset.h> in checkpoint_hdr.h, which is also included by userspace, you get lots of compilations warnings, because of other stuff included from the kernel's asm/sigset.h that isn't supposed to be included by userspace.

So the introduction of CKPT_ARCH_NSIG is a workaround that.

Quoted 7 lines
Quoted 5 lines

And back to the other problem - I agree, kernel should only include <linux/checkpoint.h>, which in turn will include <checkpoint_hdr.h> if defined CONFIG_CHECKPOINT.

Can you try this patch:

(Which looks exactly like my patch from yesterday.)

... great minds, eh ? (and one was really tired ;)

Quoted 10 lines
Quoted 3 lines

(Hallyn: note that there is some checkpoint-related code within kerbel/capability.c that should be inside #ifdef CONFIG_CHECKPOINT).

Yup, the patch i sent yesterday took care of that.

So if that's the route we want to take, then again I can confirm it did compile on ppc, and compile and boot on s390.

Sound good.

Oren.

[...]

#20 lore raw
In reply to a message not in the archive
Quoted 6 lines · Oren Laadan
Quoted 4 lines

So if that's the route we want to take, then again I can confirm it did compile on ppc, and compile and boot on s390.

Sound good.

Cool, so feel free to add my Signed-off-by to your patch.

Nathan, this doesn't mean that I don't think it's worthwhile to try and get rid of the #include where it's not needed, so if you want to keep looking into any which can be replaced by a function or struct prototype, all the better.

thanks,
-serge

#13 lore raw
In reply to a message not in the archive
Quoted 29 lines · Oren Laadan
Quoted 9 lines · Nathan Lynch
Quoted 4 lines · Oren Laadan

That's what I tried initially, but the problem is that sigset_t may be defined differently for userspace - see /usr/include/asm/sigset_t.h. In fact, for x86_32, it it is different, defined as 'unsigned long' (and NSIG defined as 32, so only 32 bits).

I noticed this, but I figured only the kernel definition was salient. Apart from debugging checkpoint/restart, why would userspace need the definition of struct ckpt_hdr_sigset?

I expect user space tools to at least:

- Assist in debugging c/r

- Assist users in reporting problems with c/r (especially since they themselves do not debug or hack)

- Convert checkpoint images from one kernel version to another

- Provide information about a checkpoint image, and even allow its manipulation. This can assist developers in debugging their programs (e.g. to debug a crash you need to run a program for 30 minutes so it ets up its state; instead of repeatedly running it, you run it once, checkpoint, and then debug from a restarted version. A tool could allow you to peek/poke inside the checkpoint and even modify data in it).

Quoted 4 lines

- Or a tool that converts a checkpoint image to a core dump so it can be inspected with gdb.

I'm pretty sure others will find other uses to it...

But I asked specifically about ckpt_hdr_sigset.

Quoted 7 lines
Quoted 4 lines

For that matter, why would userspace need the definitions of most of the structures in checkpoint_hdr.h? (Again, debugging purposes don't count:
ckptinfo or similar developer utilities can be included with the kernel.)

Keeping the checkpoint header format understandable by user space (and immune to 32-64 variations) has been a requirement since day 1.

I guess I wasn't around that day. It seems backwards to expose the format of every checkpoint record in the ABI regardless of whether plausible use cases exist. Linux has a well-established pattern of introducing interfaces without sufficient testing or documentation[1], and I expect C/R will adhere to tradition. Making the ABI obese in the hope of anticipating every conceivable use will just provide more opportunities to screw up.

[1] http://userweb.kernel.org/~mtk/papers/lce2007/What_we_lose_without_words.pdf

#15 lore raw
In reply to a message not in the archive
Quoted 51 lines · Nathan Lynch
Quoted 27 lines · Oren Laadan
Quoted 8 lines · Nathan Lynch
Quoted 4 lines · Oren Laadan

That's what I tried initially, but the problem is that sigset_t may be defined differently for userspace - see /usr/include/asm/sigset_t.h. In fact, for x86_32, it it is different, defined as 'unsigned long' (and NSIG defined as 32, so only 32 bits).

I noticed this, but I figured only the kernel definition was salient. Apart from debugging checkpoint/restart, why would userspace need the definition of struct ckpt_hdr_sigset?

I expect user space tools to at least:

- Assist in debugging c/r

- Assist users in reporting problems with c/r (especially since they themselves do not debug or hack)

- Convert checkpoint images from one kernel version to another

- Provide information about a checkpoint image, and even allow its manipulation. This can assist developers in debugging their programs (e.g. to debug a crash you need to run a program for 30 minutes so it ets up its state; instead of repeatedly running it, you run it once, checkpoint, and then debug from a restarted version. A tool could allow you to peek/poke inside the checkpoint and even modify data in it).

Quoted 4 lines

- Or a tool that converts a checkpoint image to a core dump so it can be inspected with gdb.

I'm pretty sure others will find other uses to it...

But I asked specifically about ckpt_hdr_sigset.

Quoted 6 lines
Quoted 4 lines

For that matter, why would userspace need the definitions of most of the structures in checkpoint_hdr.h? (Again, debugging purposes don't count:
ckptinfo or similar developer utilities can be included with the kernel.)

Keeping the checkpoint header format understandable by user space (and immune to 32-64 variations) has been a requirement since day 1.

I guess I wasn't around that day. It seems backwards to expose the format of every checkpoint record in the ABI regardless of whether plausible use cases exist. Linux has a well-established pattern of introducing interfaces without sufficient testing or documentation[1], and I expect C/R will adhere to tradition. Making the ABI obese in the hope of anticipating every conceivable use will just provide more opportunities to screw up.

Quoted 1 line

[1] http://userweb.kernel.org/~mtk/papers/lce2007/What_we_lose_without_words.pdf

I could not agree more !

The intent of exposure to userspace is not to establish an ABI, but solely to allow *specialized* c/r-related user tools to understand such data, per kernel version.

On the contrary: it is expected to change between kernel versions and break compatibility with older version, on a regular basis. That is why we plan to do conversion of checkpoint images between kernel version in userspace.

I view it as a "window" for userspace to glance at how checkpoint image for a specific kernel version is defined. And it comes as is, no-strings-attached, with nothing but a promise to likely break it on the next release.

This begs the question: how to make sure that this message is clear
and is not misinterpreted ? Or (and I'm no API expert) - perhaps
there is a better way...

Oren.