fcntl: Add F_GETOWNER_UIDS option v2

When we restore file descriptors we would like
them to look exactly as they were at dumping time.

With help of fcntl it's almost possible, the missing
snippet is file owners UIDs.

To be able to read their values the F_GETOWNER_UIDS
is introduced.

This option is valid iif CONFIG_CHECKPOINT_RESTORE
is turned on, otherwise returning -EINVAL.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
c/r: prctl: Drop VMA flags test on PR_SET_MM_ stack data assignment

With the

 | commit b76437579d1344b612cf1851ae610c636cec7db0
 | Author: Siddhesh Poyarekar <siddhesh.poyarekar@gmail.com>
 | Date:   Wed Mar 21 16:34:04 2012 -0700
 |
 | procfs: mark thread stack correctly in proc/<pid>/maps

the stack allocated via clone() is marked in /proc/<pid>/maps as
[stack:%d] thus it might be out of the former mm->start_stack/end_stack
values (and even has some custom VMA flags set). So to be able to
restore mm->start_stack/end_stack drop vma flags test, but still
require the undrlied VMA to exist.

As always note this feature is under CONFIG_CHECKPOINT_RESTORE
and requires CAP_SYS_RESOURCE to be granted.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Pavel Emelyanov <xemul@parallels.com>
Cc: Serge Hallyn <serge.hallyn@canonical.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
fs, nofity: Add FS_INOTIFY_GET_MARK ioctl

In checkpoint/restore we need to dump the marks
a process has to be able to recreate them at
restore time.

For this purpose FS_INOTIFY_GET_MARK ioctl code
is introduced. The caller provides index of a
mark to retrieve and buffer to store the file
handle being watched.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
c/r: prctl: add ability to get clear_tid_address

Zero is written at clear_tid_address when the process exits.  This
functionality is used by pthread_join().

We already have sys_set_tid_address() to change this address for the
current task but there is no way to obtain it from user space.

Without the ability to find this address and dump it we can't restore
pthread'ed apps which call pthread_join() once they have been restored.

This patch introduces the PR_GET_TID_ADDRESS prctl option which allows the
current process to obtain own clear_tid_address.

This feature is available iif CONFIG_CHECKPOINT_RESTORE is set.

[akpm@linux-foundation.org: fix prctl numbering]
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Pedro Alves <palves@redhat.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Pavel Emelyanov <xemul@parallels.com>
Cc: Tejun Heo <tj@kernel.org>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
DRAFT: c/r: proc -- Add typed fdinfo for eventfd/eventpoll/inotify files

This patch will be heavily reworked and at moment it's just a stab
for kernel interface.

It adds additional data to be printed for /proc/pid/fdinfo/fd files.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org
fs, proc: Revert commit 30a08bf2d31d275c6fc71dd1811342777e95c831

Otherwise I can't read fdinfo symlinks.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>