* create two bound socket (for unicase and broadcase messages),
a connected socket, an unbound and unconnected socket.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
PID SID TT COMMAND
26748 26748 ? tty03
26749 26749 pts/2 \_ tty03
26750 26750 ? \_ tty03
The second process has not a file descriptor for the ctl tty,
but this tty is opened in tty03.
Currently CRIU can not restore this test case correctly.
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
The system call open can add O_LARGEFILE.
A point is reopend for unsharing a file descriptor. So here are two
types of points. One is returned by pipe() and all other ones are
got via opening /proc/PID/fd.
Currently I know only one difference between these types, it's
O_LARGEFILE.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Tested-by: Alexander Kartashov <alekskartashov@parallels.com
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Generate random data only for buffers with sizes less than FAST_SIZE
If a size of buffer is more that FAST_SIZE, the first FAST_SIZE bytes
are filled by random generator and then this chunk is used as pattern
for all other chunks.
With out this patch:
$ time bash -x test/zdtm.sh static/maps04
real 0m16.777s
user 0m0.054s
sys 0m0.724s
With this patch:
$ time bash -x test/zdtm.sh static/maps04
real 0m1.865s
user 0m0.128s
sys 0m0.745s
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
A signal can be handled by non-leader thread and sigsuspend
will not be woken up.
kill can send signals to a specified thread, so a futex is used for
synchronization.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
To be able to test it one need indeed enough
physical memory on the node (at least 16G).
Thus I don't include this test for regular
passes.
Inspired by commit 40dcaf885e
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Otherwise if no such files present I'm getting warnings.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Andrew Vagin pointed out that the static testsuite compilation
may run as standalone so the variable ARCH won't be available.
This patch introduces the facility test/zdtm/Makefile.inc
designated to detect the target machine automatically
if the variable ARCH isn't defined. This makefile is supposed
to be included into all test subsuite Makefiles.
Andrew Vagin also pointed out that machine-dependent tests
may be added into non-static subsuites as well so the macro
adding machine-specific headers into CPPFLAGS goes to
the file test/zdtm/Makefile.inc.
Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
The file lib/atomic.h is the only machine-dependent file in the test suite
that breaks compilation of the test static/session01 on ARM.
The file is moved into a separate directory and the build system is modified
accordingly to prevent this.
Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
On glibc-2.16 I'm getting
| sched_prio00.c: In function ‘main’:
| sched_prio00.c:48:3: error: implicit declaration of function ‘setpriority’ [-Werror=implicit-function-declaration]
| sched_prio00.c:48:19: error: ‘PRIO_PROCESS’ undeclared (first use in this function)
| sched_prio00.c:48:19: note: each undeclared identifier is reported only once for each function it appears in
| sched_prio00.c:60:3: error: implicit declaration of function ‘getpriority’ [-Werror=implicit-function-declaration]
fix it adding headers needed.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
We check shared lock, exclusive lock and mandatory-read lock for flock
file locks. After restore, by parsing /proc/locks file, we check if
the process holds the same file locks as it was dumped.
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
We check read lock and write lock for posix file locks. After restore,
we use fcntl(fd, F_GETLK, &lock), to see if the file is hold the same
lock as it was dumped.
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Just reading if event entry exist in buffer is not
enough we rathee need to be sure that all flags
and bits are recovered well.
For this sake we parse fdinfo before and after the
c/r sessions and compare results.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
As Andrew pointed the logically it's more correct to use
err() instead of fail() if test_daemon() has not been
used.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
CC: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This one is pretty trivial and need to be extented for
more masks and flags, but fine for now.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
On my FC17 box calloc calls brk() and the subsequent mprotect(PROT_EXEC)
fails with EACCESS. Using mmap is safer here.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Kernel started with 3.8-rc1 are not report non-existent caps in
/proc/pid/status, so crtools doesn't dump/restore such caps.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
We should explicitly unlink old /dev/null instance, otherwise
if such device already exist we might hit a problem as
| (00.002984) 7412 fdinfo 0: pos: 0x 0 flags: 100002/0
| (00.003015) Dumping path for 0 fd via self 42 [/dev/null]
| (00.003025) Error (files-reg.c:422): Unaccessible path opened 2049:109720, need 5:10
| (00.003033) Error (cr-dump.c:1565): Dump files (pid: 7412) failed with -1
Reported-by: Alexander Kartashov <alekskartashov@parallels.com>
Tested-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This test loads ymm0/ymm7 registers and check if after
restore the contents is not changed.
The test requires xsave capability to present on the
test system, thus if we figure out that there is no
suitable cpu provided we skip the test.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
The test for fpu transition will require to do
a runtime check for the cpu features it's running
on. For this sake we need to use cpuid. Thus make
it more widely available by providing in the general
header.
The code is adopted from the linux kernel code.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Content of /proc/$pid/auxv declared as array of long and this file hasn't compat layer.
https://jira.sw.ru/browse/PSBM-16280
Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
The SO_BINDTODEVICE getter is changed in the kernel (before
official release) to report not index, but name to be in
harmony with setter.
Fix crtools accordingly.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Otherwise test with -d option get fail (this is because
SIGTRAP get cleared by our parasizte engine).
The proper fix most likely will require kernel patching
or redesign of parasite code. Meanwhile to make test
working we switch to the signal which just known to work.
Reported-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
It has escaped me on previous pass.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
The tls_data is used for read-cycles only thus
there is no need for mutex since this area get
filled earlier than fork() issued.
Same time on restore the tls filled before the
program restarts.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
P_ALL is an argument for waitid, not waitpid.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
No need for error code here, we test results
by special bitmap.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This test tests the following combinations:
1. parent and child have a cow-ed mapping
2. parent and child have just coinciding mappings
the pages state in both should be in all possible combinations of
a. write mapped
b. read mapped
c. not touched
d. before fork
e. after fork
v2: * wait until a child are not prepared
* check a FILE | PRIVATE mappings
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
- use pthread_sigmask instead of sigprocmask
- show_sigset should take the size of dereferenced variable
- zeroify sigsets before use, since libc has own definition
for sigset which doesn't match one the kernel uses
http://bugzilla.openvz.org/show_bug.cgi?id=2437
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>