linux-hardened/arch
Cyrill Gorcunov d97b46a646 syscalls, x86: add __NR_kcmp syscall
While doing the checkpoint-restore in the user space 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
'comparison' syscall might be the best candidate.  So here is it --
__NR_kcmp.

It takes up to 5 arguments - the pids of the two tasks (which
characteristics should be compared), the comparison type and (in case of
comparison 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.

[akpm@linux-foundation.org: fix up selftests, warnings]
[akpm@linux-foundation.org: include errno.h]
[akpm@linux-foundation.org: tweak comment text]
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Pavel Emelyanov <xemul@parallels.com>
Cc: Andrey Vagin <avagin@openvz.org>
Cc: KOSAKI Motohiro <kosaki.motohiro@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Glauber Costa <glommer@parallels.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: Matt Helsley <matthltc@us.ibm.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Vasiliy Kulikov <segoon@openwall.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Valdis.Kletnieks@vt.edu
Cc: Michal Marek <mmarek@suse.cz>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-05-31 17:49:32 -07:00
..
alpha Merge branch 'next' of git://git.kernel.org/pub/scm/virt/kvm/kvm 2012-05-24 16:17:30 -07:00
arm arm: use clear_tasks_mm_cpumask() 2012-05-31 17:49:29 -07:00
avr32 Merge branch 'next' of git://git.kernel.org/pub/scm/virt/kvm/kvm 2012-05-24 16:17:30 -07:00
blackfin blackfin: fix possible deadlock in decode_address() 2012-05-31 17:49:30 -07:00
c6x Merge branch 'next' of git://git.kernel.org/pub/scm/virt/kvm/kvm 2012-05-24 16:17:30 -07:00
cris cris: select GENERIC_ATOMIC64 2012-05-29 16:22:18 -07:00
frv Merge branch 'next' of git://git.kernel.org/pub/scm/virt/kvm/kvm 2012-05-24 16:17:30 -07:00
h8300 Merge branch 'next' of git://git.kernel.org/pub/scm/virt/kvm/kvm 2012-05-24 16:17:30 -07:00
hexagon Merge branch 'next' of git://git.kernel.org/pub/scm/virt/kvm/kvm 2012-05-24 16:17:30 -07:00
ia64 Merge branch 'next' of git://git.kernel.org/pub/scm/virt/kvm/kvm 2012-05-24 16:17:30 -07:00
m32r Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2012-05-24 13:29:46 -07:00
m68k Merge branch 'next' of git://git.kernel.org/pub/scm/virt/kvm/kvm 2012-05-24 16:17:30 -07:00
microblaze Merge branch 'next' of git://git.monstr.eu/linux-2.6-microblaze 2012-05-28 09:49:56 -07:00
mips Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild 2012-05-28 10:32:28 -07:00
mn10300 Merge branch 'next' of git://git.kernel.org/pub/scm/virt/kvm/kvm 2012-05-24 16:17:30 -07:00
openrisc openrisc: use generic strnlen_user() function 2012-05-27 21:00:32 -07:00
parisc Merge branch 'next' of git://git.kernel.org/pub/scm/virt/kvm/kvm 2012-05-24 16:17:30 -07:00
powerpc powerpc: use clear_tasks_mm_cpumask() 2012-05-31 17:49:29 -07:00
s390 avoid iput() from flusher thread 2012-05-28 09:54:45 -07:00
score Merge branch 'next' of git://git.kernel.org/pub/scm/virt/kvm/kvm 2012-05-24 16:17:30 -07:00
sh sh: use clear_tasks_mm_cpumask() 2012-05-31 17:49:30 -07:00
sparc sparc: use the new generic strnlen_user() function 2012-05-26 11:33:54 -07:00
tile Merge git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile 2012-05-25 15:59:38 -07:00
um um: properly check all process' threads for a live mm 2012-05-31 17:49:30 -07:00
unicore32 Merge branch 'next' of git://git.kernel.org/pub/scm/virt/kvm/kvm 2012-05-24 16:17:30 -07:00
x86 syscalls, x86: add __NR_kcmp syscall 2012-05-31 17:49:32 -07:00
xtensa Merge branch 'next' of git://git.kernel.org/pub/scm/virt/kvm/kvm 2012-05-24 16:17:30 -07:00
.gitignore
Kconfig Merge branch 'for-linus' of git://git.linaro.org/people/mszyprowski/linux-dma-mapping 2012-05-25 09:18:59 -07:00