From: Nathan Lynch <ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
To: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Cc: Containers
<containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>
Subject: Re: [PATCH] Save and restore the [compat_]robust_list member of the task struct.
Date: Wed, 15 Jul 2009 14:15:18 -0500 [thread overview]
Message-ID: <m3bpnliwqh.fsf@pobox.com> (raw)
In-Reply-To: <m3r5wiorye.fsf-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org> (Nathan Lynch's message of "Wed\, 15 Jul 2009 11\:02\:01 -0500")
Nathan Lynch <ntl@pobox.com> writes:
> Matt Helsley <matthltc@us.ibm.com> writes:
>> diff --git a/include/linux/futex.h b/include/linux/futex.h
>> index 4326f81..934cf98 100644
>> --- a/include/linux/futex.h
>> +++ b/include/linux/futex.h
>> @@ -185,9 +185,46 @@ union futex_key {
>> #define FUTEX_KEY_INIT (union futex_key) { .both = { .ptr = NULL } }
>>
>> #ifdef CONFIG_FUTEX
>> +extern long do_set_robust_list(struct robust_list_head __user *head, size_t len);
>> extern void exit_robust_list(struct task_struct *curr);
>> extern void exit_pi_state_list(struct task_struct *curr);
>> extern int futex_cmpxchg_enabled;
>> +
>> +#ifdef CONFIG_CHECKPOINT
>> +#include <linux/checkpoint_hdr.h>
>> +
>> +static inline void save_task_robust_futex_list(struct ckpt_hdr_task *h,
>> + struct task_struct *t)
>> +{
>> + /*
>> + * These are __user pointers and thus can be saved without
>> + * the objhash.
>> + */
>> + h->robust_futex_list = (unsigned long)t->robust_list;
>> + h->robust_futex_head_len = sizeof(*t->robust_list);
>> +#ifdef CONFIG_COMPAT
>> + h->compat_robust_futex_list = ptr_to_compat(t->compat_robust_list);
>> + h->compat_robust_futex_head_len = sizeof(*t->compat_robust_list);
>> +#endif
>> +}
>> +
>> +static inline void restore_task_robust_futex_list(struct ckpt_hdr_task *h)
>> +{
>> + /* Since we restore the memory map the address remains the same and
>> + * this is safe. This is the same as [compat_]sys_set_robust_list() */
>> + if (h->robust_futex_list) {
>> + struct robust_list_head __user *rfl = (void __user *)(unsigned long)h->robust_futex_list;
>> + do_set_robust_list(rfl, h->robust_futex_head_len);
>> + }
>> +#ifdef CONFIG_COMPAT
>> + if (h->compat_robust_futex_list) {
>> + struct compat_robust_list_head __user *crfl = compat_ptr(h->compat_robust_futex_list);
>> + do_compat_set_robust_list(crfl, h->compat_robust_futex_head_len);
>> + }
>> +#endif
>> +}
>> +#endif /* CONFIG_CHECKPOINT */
>> +
>> #else
>> static inline void exit_robust_list(struct task_struct *curr)
>> {
>> @@ -195,6 +232,15 @@ static inline void exit_robust_list(struct task_struct *curr)
>> static inline void exit_pi_state_list(struct task_struct *curr)
>> {
>> }
>> +#ifdef CONFIG_CHECKPOINT
>> +static inline void save_task_robust_futex_list(struct ckpt_hdr_task *h,
>> + struct task_struct *t)
>> +{
>> +}
>> +static inline void restore_task_robust_futex_list(struct ckpt_hdr_task *h)
>> +{
>> +}
>> +#endif /* CONFIG_CHECKPOINT */
>> #endif
>> #endif /* __KERNEL__ */
>>
>
> powerpc build with CONFIG_CHECKPOINT=y fails. I suspect any
> CONFIG_COMPAT=y build fails?
>
> In file included from kernel/fork.c:42:
> include/linux/futex.h: In function ‘save_task_robust_futex_list’:
> include/linux/futex.h:206: error: implicit declaration of function ‘ptr_to_compat’
> include/linux/futex.h:207: error: dereferencing pointer to incomplete type
> include/linux/futex.h: In function ‘restore_task_robust_futex_list’:
> include/linux/futex.h:221: error: implicit declaration of function ‘compat_ptr’
> include/linux/futex.h:221: warning: initialization makes pointer from integer without a cast
> include/linux/futex.h:222: error: implicit declaration of function ‘do_compat_set_robust_list’
>
> fix:
>
> diff --git a/include/linux/futex.h b/include/linux/futex.h
> index 934cf98..f40a9bf 100644
> --- a/include/linux/futex.h
> +++ b/include/linux/futex.h
> @@ -3,6 +3,7 @@
>
> #include <linux/compiler.h>
> #include <linux/types.h>
> +#include <linux/compat.h>
>
> struct inode;
> struct mm_struct;
Sigh... this breaks headers_check:
linux-2.6.git/usr/include/linux/futex.h:6: included file 'linux/compat.h' is not exported
I think we could sidestep this mess by putting the futex-related
checkpoint functions in futex.c instead of making them inlines in an
exported header.
_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
prev parent reply other threads:[~2009-07-15 19:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-13 12:36 [PATCH] Save and restore the [compat_]robust_list member of the task struct Matt Helsley
[not found] ` <20090713123615.GE5213-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>
2009-07-13 22:59 ` Oren Laadan
2009-07-15 16:02 ` Nathan Lynch
[not found] ` <m3r5wiorye.fsf-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
2009-07-15 19:15 ` Nathan Lynch [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=m3bpnliwqh.fsf@pobox.com \
--to=ntl-e+axbwqsrlaavxtiumwx3w@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.