zdtm: check one-shot posix timers

With the patch zdtm will check not only periodic timers, but also
one-shot ones.

 Set one-shot timer to expire in a very long interval (INT_MAX in the
 test), and check its remaining value after checkpoint/restore. The
 following relationship must hold:

 initial_value - remaining_value = time_passed

Signed-off-by: Vladimir Davydov <vdavydov@parallels.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
make: Define program object deps as separate variable

Will need to extend it to support vdso-pie code which
used in both -- pie code and plain executable code.

I know it's ugly and I must invent some more elegant
way, but need some solution at moment to be able to
compile existing code.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
vdso: Introduce vdso pie-engine

It's quite minimal at moment and provides only two helpers

 - vdso_redirect_calls, to patch vdso area redirectling
   calls to some new place.

 - vdso_fill_symtable, to parse vma area as vdso library
   and fill symbols table with offsets and names.

Because these routines will be needed in both regular criu
code and restorer code -- we compile it in pie format.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
vdso: Initialize vdso data on startup

During criu startup we need to fill symbol table of own
run-time vdso provided by the kernel. We will need this
data for vdso proxy.

Because this functions are not used in restorer code,
we move them out of PIE (since PIE code must remain
as small as possible).

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
vdso: Remap runtime vdso copy to safe place

Runtime vdso need to be kept in some safe place when all
self-vmas are unmapped. So we reserve space for it in restorer
blob area and then remap it into. It's quite important to do
a remap here rather than data copy because otherwise pfn
of vdso disappear and in future we won't be able to detect
vdso are on dumping stage.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
vdso: Implement vdso proxy on restore

When a task being restored we may meet two situations

 - vdso in image doesn't match the runtime vdso provided
   by a kernel. For this case we need to patch dumpee
   vdso redirecting calls to runtime vdso, thus dumpee
   vdso become a proxy.

 - vdso in image does match the runtime vdso, in this
   case we simply remap runtime vdso to address where
   dumpee vdso lives. Plain remapping here is quite
   important and allows us to save vdso pfn which will
   be used in parasite code later.

Note after this patch the restored task may have two
vdso in memory. Proper dumping of such situation will
be addressed in future patches.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
vdso: Fetch page frame number on init

We will need it in parasite code to detect run time vdso area.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
vdso: Mark runtime vdso if proxy needed

In case if we need vdso proxy there is a need
to recognize it somehow on further checkpoint
action. But such vdso won't be recognized by
the kernel and [vdso] mark won't appear in
procfs output. Thus we put own mark on it.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
vdso: Escape double dumping of rt-vdso if proxy present

In case if we have created vdso proxy the rt-vdso should
not be dumped because it will be re-created on next restore
anyway. Thus with help of parasite service routine find
the rt-vdso and tear it off from VMAs list.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
proc: Don't mark mishinted vdso

The [vdso] mark in procfs output is not reliable,
so since we know which prot it should has, escape
obvious mishints.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
vdso: Cleanup vdso_proxify routine

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>