2012-02-02 23:26:47

by Andrew Morton

[permalink] [raw]
Subject: Re: [patch cr 2/4] [RFC] syscalls, x86: Add __NR_kcmp syscall v7

On Mon, 30 Jan 2012 18:09:07 +0400
Cyrill Gorcunov <[email protected]> wrote:

> While doing the checkpoint-restore in the userspace one need to determine
> whether various kernel objects (like mm_struct-s of file_struct-s) are shared
> between tasks and restore this state.
>
> The 2nd step can be solved by using appropriate CLONE_ flags and the unshare
> syscall, while there's currently no ways for solving the 1st one.
>
> One of the ways for checking whether two tasks share e.g. mm_struct is to
> provide some mm_struct ID of a task to its proc file, but showing such
> info considered to be not that good for security reasons.
>
> Thus after some debates we end up in conclusion that using that named
> 'comparision' syscall might be the best candidate. So here is it --
> __NR_kcmp.
>
> It takes up to 5 agruments - the pids of the two tasks (which
> characteristics should be compared), the comparision type and
> (in case of comparision of files) two file descriptors.
>
> Lookups for pids are done in the caller's PID namespace only.
>
> At moment only x86 is supported and tested.
>
> ...
>
> --- linux-2.6.git.orig/kernel/Makefile
> +++ linux-2.6.git/kernel/Makefile
> @@ -25,6 +25,7 @@ endif
> obj-y += sched/
> obj-y += power/
>
> +obj-$(CONFIG_X86) += kcmp.o

Can we turn this into obj-$(CONFIG_CHECKPOINT_RESTART) and add the
cond_syscall to sys_ni.c?

I keep saying this, because "hey, we can delete it all again" figures
largely in my rationale for merging your code ;)

>
> ...
>


2012-02-03 02:28:27

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [patch cr 2/4] [RFC] syscalls, x86: Add __NR_kcmp syscall v7

On 02/02/2012 03:26 PM, Andrew Morton wrote:
>>
>> --- linux-2.6.git.orig/kernel/Makefile
>> +++ linux-2.6.git/kernel/Makefile
>> @@ -25,6 +25,7 @@ endif
>> obj-y += sched/
>> obj-y += power/
>>
>> +obj-$(CONFIG_X86) += kcmp.o
>
> Can we turn this into obj-$(CONFIG_CHECKPOINT_RESTART) and add the
> cond_syscall to sys_ni.c?
>
> I keep saying this, because "hey, we can delete it all again" figures
> largely in my rationale for merging your code ;)
>

Ah, yes please.

-hpa

2012-02-03 07:09:14

by Cyrill Gorcunov

[permalink] [raw]
Subject: Re: [patch cr 2/4] [RFC] syscalls, x86: Add __NR_kcmp syscall v7

On Thu, Feb 02, 2012 at 06:27:02PM -0800, H. Peter Anvin wrote:
> On 02/02/2012 03:26 PM, Andrew Morton wrote:
> >>
> >>--- linux-2.6.git.orig/kernel/Makefile
> >>+++ linux-2.6.git/kernel/Makefile
> >>@@ -25,6 +25,7 @@ endif
> >> obj-y += sched/
> >> obj-y += power/
> >>
> >>+obj-$(CONFIG_X86) += kcmp.o
> >
> >Can we turn this into obj-$(CONFIG_CHECKPOINT_RESTART) and add the
> >cond_syscall to sys_ni.c?
> >
> >I keep saying this, because "hey, we can delete it all again" figures
> >largely in my rationale for merging your code ;)
> >
>
> Ah, yes please.
>

Sure, will update, thanks!

Cyrill