Linux Container Development
 help / color / mirror / Atom feed
From: Oren Laadan <orenl-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org>
To: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Cc: Containers
	<containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>
Subject: Re: [RFC][PATCH] user-cr: Extract kernel headers
Date: Mon, 17 Aug 2009 16:55:37 -0400	[thread overview]
Message-ID: <4A89C3C9.8080905@librato.com> (raw)
In-Reply-To: <20090817152403.GA11415-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>



Matt Helsley wrote:
> Using kernel headers directly from userspace is strongly discouraged.
> This patch attempts to sanitize kernel headers for userspace by
> extracting non-__KERNEL__ portions of the various checkpoint headers
> and placing them in a similar organization of userspace headers.
> 
> The script is run from the top level of the user-cr source tree like:
> 
> 	./scripts/extract-headers.sh -s <path-to-kern-source> -o ./include
> 
> 
> The patch includes a copy of the auto-generated headers and adjusts
> the user-cr programs to use them.
> 
> Signed-off-by: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> 
> TODO: Builds on i386. Probably needs more testing, especially on
> 	other non-i386, non-32-bit platforms.
> 
> 	Look at mergiing checkpoint_syscalls.h with checkpoint.h
> 	Or at least find a better, shorter name for checkpoint_syscalls.h

I suppose this will go away once the syscall numbers are accepted to
mainline and make it to the official (user space) headers ?

> 
> NOTES: The script is much larger (2.5x) than for cr_tests because cr_tests
> 	only required the syscall numbers and a few flags for the syscalls.
> 
> 	The headers have a similar organization to the kernel headers
> 	because struct ckpt_hdr must be defined before the arch hdrs and 
> 	yet CKPT_ARCH_NSIG must be defined before the generic signal hdrs.
> 	Plus it's easier to avoid rewriting the paths within the include
> 	directories...
> 
> 	checkpoint_syscalls.h is a multi-arch file with all the syscall
> 	numbers normally found in the arch's unistd.h. I chose to use a
> 	different name to avoid clashes with /usr/include headers.
> ---

[...]

> +CKPT_INCLUDE = -I./include
> +CKPT_HEADERS = $(shell find ./include -name '*.h')
>  
>  # compile with debug ?
>  DEBUG = -DCHECKPOINT_DEBUG
> @@ -39,6 +20,8 @@ OTHER = ckptinfo_types.c
>  
>  LDLIBS = -lm
>  
> +.PHONY: all distclean clean headers install
> +
>  all: $(PROGS)
>  	@make -C test
>  
> @@ -56,10 +39,16 @@ ckptinfo_types.c: $(CKPT_HEADERS) ckptinfo.py
>  
>  %.o:	%.c
>  
> +headers:
> +	./scripts/extract-headers.sh -s ../linux-2.6.git

Would be nice if this isn't hard-coded (perhaps an env-var ?)

> +
>  install:
>  	@echo /usr/bin/install -m 755 mktree ckpt rstr ckptinfo $(INSTALL_DIR)
>  	@/usr/bin/install -m 755 mktree ckpt rstr ckptinfo $(INSTALL_DIR)
>  
> +distclean: clean
> +	@rm -f $(CKPT_HEADERS)

Would 'make headers' be automagically called on the next 'make'
after the user does 'make distclean' ?

If not, then $(CKPT_HEADERS) will be empty and this will break the
dependencies of ckptinfo_types.c.

Oren.

      parent reply	other threads:[~2009-08-17 20:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-17 15:24 [RFC][PATCH] user-cr: Extract kernel headers Matt Helsley
     [not found] ` <20090817152403.GA11415-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>
2009-08-17 16:33   ` Matt Helsley
     [not found]     ` <20090817163356.GB11415-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>
2009-08-17 21:00       ` Oren Laadan
2009-08-17 20:55   ` Oren Laadan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A89C3C9.8080905@librato.com \
    --to=orenl-rdfvbdnroixbdgjk7y7tuq@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox