2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-29 13:28:27 +00:00

10726 Commits

Author SHA1 Message Date
Radostin Stoyanov
d79d73e3a0 ci: install procps in Alpine
The version of ps in Alpine image by default is very limited.
It is based on the one from busybox and doesn't support options
such as '-p'.

Signed-off-by: Radostin Stoyanov <radostin@redhat.com>
2022-04-28 17:53:52 -07:00
Bui Quang Minh
3eba68089e ci: Enable disabled unix socket related tests
As the unix socket broken tests have been fixed in the pull request

https://github.com/checkpoint-restore/criu/pull/1680

We re-enable these tests.

Signed-off-by: Bui Quang Minh <minhquangbui99@gmail.com>
2022-04-28 17:53:52 -07:00
Bui Quang Minh
94111596f8 sk-unix: Fix TCP_ESTABLISHED checks in unix sockets
Since commit 83301b5367a98 ("af_unix: Set TCP_ESTABLISHED for datagram sockets
too") in Linux kernel, SOCK_DGRAM unix sockets can have TCP_ESTABLISHED state
when connected. So we need to fix checks that assume SOCK_DRAM sockets cannot
have TCP_ESTABLISHED state.

Signed-off-by: Bui Quang Minh <minhquangbui99@gmail.com>
2022-04-28 17:53:52 -07:00
Adrian Reber
6930d6a32d util: make page-server IPv6 safe
The function run_tcp_server() was the last place CRIU was still using
the IPv4 only function inet_ntoa(). It was only used during a print, so
that it did not really break anything, but with this commit the output
is now no longer:

 Accepted connection from 0.0.0.0:58396

but correctly displaying the IPv6 address

 Accepted connection from ::1:58398

if connecting via IPv6.

Signed-off-by: Adrian Reber <areber@redhat.com>
2022-04-28 17:53:52 -07:00
ianlang
d57f27bc94 files-reg: try dump_ghost_remap if link-remap failed with error ENOENT
An issue with dumping deleted reg files in overlayfs:

After deleting a file originated from lower layer in merged dir,
fstat() on the /proc/$pid/map_files symlink returns st_nlink=1, while
linkat() fails with errno ENOENT.

Signed-off-by: langyenan <ianlang@tencent.com>
2022-04-28 17:53:52 -07:00
Adrian Reber
14075baf72 test: do not use --keep-going for single zdtm tests
Looking at CI logs there are often messages like:

 "[WARNING] Option --keep-going is more useful when running multiple tests"

This commit removes '--keep-going' from single zdtm test runs.

Signed-off-by: Adrian Reber <areber@redhat.com>
2022-04-28 17:53:52 -07:00
Adrian Reber
a52185ffe3 ci: disable broken tests until fixed
Broken tests are being tracked at

 * https://github.com/checkpoint-restore/criu/issues/1669
 * https://github.com/checkpoint-restore/criu/issues/1635

This also enables previously disabled BPF related tests:

 * https://github.com/checkpoint-restore/criu/issues/1354

Signed-off-by: Adrian Reber <areber@redhat.com>
2022-04-28 17:53:52 -07:00
Salvatore Bonaccorso
4ab2facb24 make: Explicitly enable FPU on ARMv7 builds
Starting with gcc-11, Debian's armhf compiler no longer builds with
a default -mfpu= option. Instead it enables the FPU via an extension
to the -march flag (--with-arch=armv7-a+fp). criu's Makefile explicitly
passes its own -march=armv7-a setting, which overrides the +fp default,
so we end up with no FPU:

    cc1: error: '-mfloat-abi=hard': selected architecture lacks an FPU

Signed-off-by: Radostin Stoyanov <radostin@redhat.com>
2022-04-28 17:53:52 -07:00
Radostin Stoyanov
d514bacb40 ci: Run cross compile with debian testing
Debian testing has newer compiler version and running
cross compilation tests would allow us to catch any compilation
errors early.

Signed-off-by: Radostin Stoyanov <radostin@redhat.com>
2022-04-28 17:53:52 -07:00
Radostin Stoyanov
4c1330bb0c ci: Run cross compile on debian stable
The current debian stable release is Bullseye, not Buster. However, we
can use the 'stable' release instead. This would allow the CI to
automatically pick up updates in the future.

Signed-off-by: Radostin Stoyanov <radostin@redhat.com>
2022-04-28 17:53:52 -07:00
Pavel Tikhomirov
718eb06be3 clang-format: disable wrong struct pointer declaration format
When we declare struct and at the same time declare variable pointer of
this struct type, it looks like clang-format threats "*" as a
multiplication operator instead of indirection (pointer declaration)
operator and puts spaces on both sides, which looks wrong.

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
2022-04-28 17:53:52 -07:00
Pavel Tikhomirov
8580024838 zdtm: add ro-mount check after c/r to mntns_ghost01
This is a test for "ghost/mount: allocate remounted_rw in shmem to get
info from other processes" patch, without the patch test fails with:

  ############# Test zdtm/static/mntns_ghost01 FAIL at result check ##############
  Test output: ================================
  16:15:19.607:     5: ERR: mntns_ghost01.c:95: open for write on rofs -> 7 (errno = 11 (Resource temporarily unavailable))
  16:15:19.607:     4: FAIL: mntns_ghost01.c:121: Test died (errno = 11 (Resource temporarily unavailable))

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
2022-04-28 17:53:52 -07:00
Pavel Tikhomirov
17357d67fe files-reg: temporary remount writable the mount we do unlink on
Previousely I din't mention this case because we had bad error handling
in ghost cleanup path.

Without these patch but with proper error handling for unlink we have an
error in mntns_ghost01 test:

Error (criu/files-reg.c:2269): Failed to unlink the remap file:
Read-only file system

Cherry-picked from Virtuozzo criu:
https://src.openvz.org/projects/OVZ/repos/criu/commits/151c859e1

Changes: check lookup_mnt_id return for NULL

Fixes: fd0a3cd9efb9 ("mount: remount ro mounts writable before
ghost-file restore")
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
2022-04-28 17:53:52 -07:00
Pavel Tikhomirov
bd219b69a6 ghost/mount: allocate remounted_rw in shmem to get info from other processes
Previousely remounted_rw was not shared between all processes on
restore, thus cleanup didn't got this info from rfi_remap and these
mounts were wrongly left writable after restore.

Cherry-picked from Virtuozzo criu:
https://src.openvz.org/projects/OVZ/repos/criu/commits/3a1a592e7

Fixes: fd0a3cd9efb9 ("mount: remount ro mounts writable before
ghost-file restore")
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
2022-04-28 17:53:52 -07:00
Pavel Tikhomirov
cfed6f35e1 files-reg: fix error handling of rm_parent_dirs
If unlinkat fails it means that fs is in "corrupted" state - spoiled
with non-unlinked auxiliary directories.

While on it add fixme note as this function can be racy and BUG_ON if
path contains double slashes.

Cherry-picked from Virtuozzo criu:
https://src.openvz.org/projects/OVZ/repos/criu/commits/b7b4e69fd

Changes: simplify while loop condition, remove confusing FIXME, remove
excess !count check in favour of while loop condition check

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
2022-04-28 17:53:52 -07:00
Pavel Tikhomirov
5a0943c900 files-reg: fix error handling in open_path
1) On error paths need to close fd and unlock mutex.
2) Make rfi_remap return special return code to identify EEXIST from
   linkat_hard, all other errors should be reported up.
3) Report unlinkat error as criu should not corrupt fs.

Cherry-picked from Virtuozzo criu:
https://src.openvz.org/projects/OVZ/repos/criu/commits/fe1d0be14

Changes: use close_safe(), fix order in "Fake %s -> %s link" error
message.

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
2022-04-28 17:53:52 -07:00
Nicolas Viennot
64b58b5141 check: cleanup child processes
Always wait() for forked child processes. It avoid zombie processes in
containers that don't have an init process reaping orphans.

Signed-off-by: Nicolas Viennot <Nicolas.Viennot@twosigma.com>
2022-04-28 17:53:52 -07:00
Adrian Reber
156cce78c5 ci: switch to centos-stream-8
CentOS 8 goes EOL at the end of 2021. This switches our CentOS 8 based
tests to CentOS Stream 8 which should be supported until 2024.

Signed-off-by: Adrian Reber <areber@redhat.com>
2022-04-28 17:53:52 -07:00
Liu Hua
c2fd819039 crtools: ignore SIGPIPE in swrk mode
Criu ignores SIGPIPE in most cases except swrk mode. And in the
following situtation criu get killed by SIGPIPE and have no chance
to do cleanup: Connection to page server is lost when we do disk-less
migration, criu send PS_IOV_FLUSH via a broken connction in
disconnect_from_page_server.

This patch let criu ignore SIGPIPE in all paths .

Signed-off-by: Liu Hua <weldonliu@tencent.com>
2022-04-28 17:53:52 -07:00
Pavel Tikhomirov
a491706cce ci: Use latest Fedora for lint ci runs again
Now when we fixed clang-format complains in zdtm, let's switch to lates
clang-format available. This is effectively a revert of commit 07a2f0265
("ci: use Fedora 34 for lint CI runs").

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
2022-04-28 17:53:52 -07:00
Liu Hua
eb0dee4082 seize: restore cgroup freezer to right state
The new freezer_state is a complete equivalent of old freezer_thawed
except for the initial value. If old freezer_thawed was not initialized
it was 0 and in freezer_restore_state were threated as if we need to
freeze cgroup "back", thus before this patch if criu dump failed before
freezing dumpee, criu always freeze dumpee in cr_dump_finish which is
wrong. Switching to freezer_state initialized with FREEZER_ERROR fixes
the problem.

v2: improve description, rename to origin_freezer_state

Signed-off-by: Liu Hua <weldonliu@tencent.com>
2022-04-28 17:53:52 -07:00
Pavel Tikhomirov
781676f102 clang-format/zdtm: fix clang complains about strange elseifs
Clang-format v13 on my Fedora 35 complains about these hunks, more over
reading the formating we had before is a pain:

} else /* comment */
	if (smth) {
	fail("")
	return -1;
}

Let's make explicit {} braces for else, this way it looks much better.

Fixes: 93dd984ca ("Run 'make indent' on all C files")
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
2022-04-28 17:53:52 -07:00
Nicolas Viennot
d2b6faf8fd tests: improve the deterministic behavior of the test suite
Various I/O objects are unclosed when the object falls out of scope.
This can lead to non-deterministic behavior.

Also fixed a few missing list(). It doesn't play way with python3.
e.g., `random.shuffle(filter(...))` doesn't work.

Signed-off-by: Nicolas Viennot <Nicolas.Viennot@twosigma.com>
2022-04-28 17:53:52 -07:00
Pavel Tikhomirov
94092ce002 zdtm.py: make tests with --link_remap exclusive
We see that tests mntns_ghost01 and unlink_fstat03 can run
simultaneousely and thus the former sees leftover link_remap.* files in
the test directory created by the latter, and the latter is still
running so it's ok to have link_remap.* at this point.

Let's implicitly make all --link-remap tests exclusive (not running in
parallel).

Fixes: #1633

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
2022-04-28 17:53:52 -07:00
Pavel Tikhomirov
1f9e2c4204 ci: disable socket-raw test on centos8
We see error in centos8 ci on restore of socket-raw test:

  inet: \tRestore: family AF_INET type SOCK_RAW proto 66
  port 66 state TCP_CLOSE src_addr 0.0.0.0
  Error (criu/sk-inet.c:834): inet: Can't create inet socket:
  Protocol not supported

Centos 8 kernel replaces IPPROTO_MPTCP(262) with "in-kernel" value
IPPROTO_MPTCP_KERN(66) on inet_create(), but later shows this inkernel
value to criu when listing sockets info. Same code in inet_create()
returns EPROTONOSUPPORT on the attempr to create socket with
IPPROTO_MPTCP_KERN. So this ci error is completely rh8 kernel related.
Kernel should not show "in-kernel" value to userspace. But anyway this
is already changed in Centos 9 kernel, so we can just skip socket-raw
test on Centos 8.

v2: use cirrus.yml

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
2022-04-28 17:53:52 -07:00
Pavel Tikhomirov
a9d9fb8aa5 clang-format: make x86_ins_capability_mask human-readable
There is no option in clang not to merge as much binary operands as it
fits in column limit, but here we need each bit on new line to make it
readable, so let's disable clang-format for x86_ins_capability_masks.

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
2022-04-28 17:53:52 -07:00
Liu Hua
4ff252656d cr-dump: fail dumping when zombie process with sid 0
A zombie process with 0 sid has a session leader in
outer pidns and has ignored SIGHUP. Criu has no idea
to restore this type of process, so fail the dumpping.

Signed-off-by: Liu Hua <weldonliu@tencent.com>
2022-04-28 17:53:52 -07:00
Pavel Tikhomirov
26db7adbbb clang-format: do automatic comment fixups
Result of `make indent` after enabling AlignTrailingComments.

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
2022-04-28 17:53:52 -07:00
Pavel Tikhomirov
2064793225 clang-format: do several manual comment fixups
Automatic AlignTrailingComments fails to make those comments look right,
so let's do it manually, so that they both satisfy AlignTrailingComments
and also are human-readable.

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
2022-04-28 17:53:52 -07:00
Pavel Tikhomirov
bbfd9031a3 clang-format: enable AlignTrailingComments
Code becomes much more human-readable after enabling it.

Example 1:

Before:
```
struct file_desc {
	u32 id; /* File id, unique */
	struct hlist_node hash; /* Descriptor hashing and lookup */
	struct list_head fd_info_head; /* Chain of fdinfo_list_entry-s with same ID and type but different pids */
	struct file_desc_ops *ops; /* Associated operations */
	struct list_head fake_master_list; /* To chain in the list of file_desc, which don't
						    have a fle in a task, that having permissions */
};
```
After:
```
struct file_desc {
	u32 id;                            /* File id, unique */
	struct hlist_node hash;            /* Descriptor hashing and lookup */
	struct list_head fd_info_head;     /* Chain of fdinfo_list_entry-s with same ID and type but different pids */
	struct file_desc_ops *ops;         /* Associated operations */
	struct list_head fake_master_list; /* To chain in the list of file_desc, which don't
					    * have a fle in a task, that having permissions */
};
```

Example 2:

Before:
```
enum fsconfig_command {
	FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */
	FSCONFIG_SET_STRING = 1, /* Set parameter, supplying a string value */
	FSCONFIG_SET_BINARY = 2, /* Set parameter, supplying a binary blob value */
	FSCONFIG_SET_PATH = 3, /* Set parameter, supplying an object by path */
	FSCONFIG_SET_PATH_EMPTY = 4, /* Set parameter, supplying an object by (empty) path */
	FSCONFIG_SET_FD = 5, /* Set parameter, supplying an object by fd */
	FSCONFIG_CMD_CREATE = 6, /* Invoke superblock creation */
	FSCONFIG_CMD_RECONFIGURE = 7, /* Invoke superblock reconfiguration */
};
```
After:
```
enum fsconfig_command {
	FSCONFIG_SET_FLAG = 0,        /* Set parameter, supplying no value */
	FSCONFIG_SET_STRING = 1,      /* Set parameter, supplying a string value */
	FSCONFIG_SET_BINARY = 2,      /* Set parameter, supplying a binary blob value */
	FSCONFIG_SET_PATH = 3,        /* Set parameter, supplying an object by path */
	FSCONFIG_SET_PATH_EMPTY = 4,  /* Set parameter, supplying an object by (empty) path */
	FSCONFIG_SET_FD = 5,          /* Set parameter, supplying an object by fd */
	FSCONFIG_CMD_CREATE = 6,      /* Invoke superblock creation */
	FSCONFIG_CMD_RECONFIGURE = 7, /* Invoke superblock reconfiguration */
};
```

Example 3:

Before:
```
	ret = libnet_build_tcp(ntohs(sk->dst_addr->v4.sin_port), /* source port */
			       ntohs(sk->src_addr->v4.sin_port), /* destination port */
			       data->inq_seq, /* sequence number */
			       data->outq_seq - data->outq_len, /* acknowledgement num */
			       flags, /* control flags */
			       data->rcv_wnd, /* window size */
			       0, /* checksum */
			       10, /* urgent pointer */
			       LIBNET_TCP_H + 20, /* TCP packet size */
			       NULL, /* payload */
			       0, /* payload size */
			       l, /* libnet handle */
			       0); /* libnet id */
```
After:
```
	ret = libnet_build_tcp(ntohs(sk->dst_addr->v4.sin_port), /* source port */
			       ntohs(sk->src_addr->v4.sin_port), /* destination port */
			       data->inq_seq,                    /* sequence number */
			       data->outq_seq - data->outq_len,  /* acknowledgement num */
			       flags,                            /* control flags */
			       data->rcv_wnd,                    /* window size */
			       0,                                /* checksum */
			       10,                               /* urgent pointer */
			       LIBNET_TCP_H + 20,                /* TCP packet size */
			       NULL,                             /* payload */
			       0,                                /* payload size */
			       l,                                /* libnet handle */
			       0);                               /* libnet id */
```

Example 4:

Before:
```
static struct testcase __testcases[] = {
	{ 2, 1, 2, 1, 2, 1 }, /* session00                      */
	{ 4, 2, 4, 2, 4, 1 }, /*  |\_session00          */
	{ 15, 4, 4, 4, 15, 1 }, /*  |  |\_session00             */
	{ 16, 4, 4, 4, 15, 1 }, /*  |   \_session00             */
	{ 17, 4, 4, 4, 17, 0 }, /*  |  |\_session00             */
	{ 18, 4, 4, 4, 17, 1 }, /*  |   \_session00             */
	{ 5, 2, 2, 2, 2, 1 }, /*  |\_session00          */
	{ 8, 2, 8, 2, 8, 1 }, /*  |\_session00          */
	{ 9, 8, 2, 2, 2, 1 }, /*  |   \_session00               */
	{ 10, 2, 10, 2, 10, 1 }, /*  |\_session00               */
	{ 11, 10, 11, 2, 11, 1 }, /*  |    \_session00          */
	{ 12, 11, 2, 2, 2, 1 }, /*  |        \_session00        */
	{ 13, 2, 2, 2, 2, 0 }, /*   \_session00         */
	{ 3, 13, 2, 2, 2, 1 }, /* session00                     */
	{ 6, 2, 6, 2, 6, 0 }, /*   \_session00          */
	{ 14, 6, 6, 6, 6, 1 }, /* session00                     */
};
```
After:
```
static struct testcase __testcases[] = {
	{ 2, 1, 2, 1, 2, 1 },     /* session00                  */
	{ 4, 2, 4, 2, 4, 1 },     /*  |\_session00              */
	{ 15, 4, 4, 4, 15, 1 },   /*  |  |\_session00           */
	{ 16, 4, 4, 4, 15, 1 },   /*  |   \_session00           */
	{ 17, 4, 4, 4, 17, 0 },   /*  |  |\_session00           */
	{ 18, 4, 4, 4, 17, 1 },   /*  |   \_session00           */
	{ 5, 2, 2, 2, 2, 1 },     /*  |\_session00              */
	{ 8, 2, 8, 2, 8, 1 },     /*  |\_session00              */
	{ 9, 8, 2, 2, 2, 1 },     /*  |   \_session00           */
	{ 10, 2, 10, 2, 10, 1 },  /*  |\_session00              */
	{ 11, 10, 11, 2, 11, 1 }, /*  |    \_session00          */
	{ 12, 11, 2, 2, 2, 1 },   /*  |        \_session00      */
	{ 13, 2, 2, 2, 2, 0 },    /*   \_session00              */
	{ 3, 13, 2, 2, 2, 1 },    /* session00                  */
	{ 6, 2, 6, 2, 6, 0 },     /*   \_session00              */
	{ 14, 6, 6, 6, 6, 1 },    /* session00                  */
};
```

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
2022-04-28 17:53:52 -07:00
Pavel Tikhomirov
718f4cae2c zdtm: make sock_opts02 also check lock change by SO_*BUF*
Reviewed-by: Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com>
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
2022-04-28 17:53:52 -07:00
Pavel Tikhomirov
3a875cc4c7 zdtm: add test for socket buffer size locks
Just set all possible values 0-3 and chack if it persists.

Reviewed-by: Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com>
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
2022-04-28 17:53:52 -07:00
Pavel Tikhomirov
e69be16db7 sockets: c/r bufer size locks
When one sets socket buffer sizes with setsockopt(SO_{SND,RCV}BUF*),
kernel sets coresponding SOCK_SNDBUF_LOCK or SOCK_RCVBUF_LOCK flags on
struct sock. It means that such a socket with explicitly changed buffer
size can not be auto-adjusted by kernel (e.g. if there is free memory
kernel can auto-increase default socket buffers to improve perfomance).
(see tcp_fixup_rcvbuf() and tcp_sndbuf_expand())

CRIU is always changing buf sizes on restore, that means that all
sockets receive lock flags on struct sock and become non-auto-adjusted
after migration. In some cases it can decrease perfomance of network
connections quite a lot.

So let's c/r socket buf locks (SO_BUF_LOCKS), so that sockets for which
auto-adjustment is available does not lose it.

Reviewed-by: Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com>
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
2022-04-28 17:53:52 -07:00
Pavel Tikhomirov
ce5ce285a8 kerndat: check for set/getsockopt SO_BUF_LOCK availability
This is a new kernel feature to let criu restore sockets with kernel
auto-adjusted buffer sizes.

Reviewed-by: Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com>
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
2022-04-28 17:53:52 -07:00
Pavel Tikhomirov
2bd709664f sockets: don't call sk_setbufs asyncronously
We want to also c/r socket buf locks (SO_BUF_LOCKS) which are also
implicitly set by setsockopt(SO_{SND,RCV}BUF*), so we need to order
these two properly. That's why we need to wait for sk_setbufs to finish.
And there is no much point in seting buffer sizes asyncronously anyway.

Reviewed-by: Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com>
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
2022-04-28 17:53:52 -07:00
Nicolas Viennot
37a8090d8c tests: improve the image streamer process control
When exceptions are raised during testing, the image streamer process
should be terminated as opposed to being left hanging.
This could lead to the whole test suite to be left hanging as it waits
for all child processes to exit.

Signed-off-by: Nicolas Viennot <Nicolas.Viennot@twosigma.com>
2022-04-28 17:53:52 -07:00
Adrian Reber
dae0704b61 ci: use Fedora 34 for lint CI runs
Fedora 35 comes with clang 13 which provides different results for
clang-format than clang 12 in Fedora 34.

Signed-off-by: Adrian Reber <areber@redhat.com>
2022-04-28 17:53:52 -07:00
Adrian Reber
f7bc3bdc91 ci: fix userfaultfd test failures
Newer kernels (5.11) require echo 1 > /proc/sys/vm/unprivileged_userfaultfd

Without the 'echo 1' the kernel prints a message like this:

 uffd: Set unprivileged_userfaultfd sysctl knob to 1 if kernel faults must be handled without obtaining CAP_SYS_PTRACE capability

Signed-off-by: Adrian Reber <areber@redhat.com>
2022-04-28 17:53:52 -07:00
Adrian Reber
d17eb325c6 ci: replace deprecated codecov bash uploader
Replace deprecated codecov bash uploader with new version:

https://about.codecov.io/blog/introducing-codecovs-new-uploader/

Signed-off-by: Adrian Reber <areber@redhat.com>
2022-04-28 17:53:52 -07:00
Nicolas Viennot
c1659c386d net: optimize restore_rule() to not open the CR_FD_RULE image file twice
Previously, `open_image(CR_FD_RULE, O_RSTR, pid)` was called twice.
Opening an image file twice is not allowed when streaming the image.
This commit optimizes the code to only open the image file once.

Also improved the error path in restore_ip_dump().

Signed-off-by: Nicolas Viennot <Nicolas.Viennot@twosigma.com>
2022-04-28 17:53:52 -07:00
Pavel Tikhomirov
e3a853ab99 criu-ns: make pidns init first do setsid
We see that on criu-ns dump/restore/dump of the process which initially
was not a session leader (with --shell-job option) we see sid == 0 for
it and fail with something like:

Error (criu/cr-dump.c:1333): A session leader of 41585(41585) is outside of its pid namespace

Note: We should not dump processes with sid 0 (even with --shell-job) as
on restore we can can put such processes from multiple sessions into
one, which is wrong.

Fixes: #232

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
2022-04-28 17:53:52 -07:00
Pavel Tikhomirov
c750e62cac util: use nftw in rmrf helper
This simplifies the code by removing excess recursion and reusing
standard function to walk over file-tree instead of opencoding it.

This addresses problem mentioned in my review comment:
https://github.com/checkpoint-restore/criu/pull/1495#discussion_r677554523

Fixes: 0db135ac4 ("util: add rm -rf function")

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
2022-04-28 17:53:52 -07:00
fu.lin
485a83c110 tty: fix the null pointer of get_tty_driver
v2: split error checking from index variable initialization
v3: use PRIx64 for printing dev_t

Signed-off-by: fu.lin <fulin10@huawei.com>
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
2022-04-28 17:53:52 -07:00
Pavel Tikhomirov
7ba4d3bf1d pie/restorer: remove excess hash printf specifier
We use here "%#x" printf specifier in pie code, but sbuf_printf core pie
printing function knows nothing about '#' specifier. More over simple
"%x" in pie does same as "%#x" in stdio printf, see print_hex* functions
add "0x" before hex numbers.

We've got this error on vzt-cpt runs in Virtuozzo:

(04.750271) pie: 158: Adjust id
Error: Unknown printf format %#

So to fix it we can just remove '#'.

Fixes: ecd432fe2 ("timerfd: Implement c/r procedure")
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
2022-04-28 17:53:52 -07:00
Radostin Stoyanov
bffaa7d072 ci: enable coredump tests
Signed-off-by: Radostin Stoyanov <radostin@redhat.com>
2022-04-28 17:53:52 -07:00
Radostin Stoyanov
bf8382a800 make: enable lint for coredump
Signed-off-by: Radostin Stoyanov <radostin@redhat.com>
2022-04-28 17:53:52 -07:00
Radostin Stoyanov
8aa7694558 test/coredump: fix shellcheck errors
ShellCheck reports the following problems:

SC2086: Double quote to prevent globbing and word splitting.
SC2035: Use ./*glob* or -- *glob* so names with dashes won't become options.
SC1091: Not following: ../env.sh was not specified as input (see shellcheck -x).

Signed-off-by: Radostin Stoyanov <radostin@redhat.com>
2022-04-28 17:53:52 -07:00
Radostin Stoyanov
0b3cf5c9e5 coredump: lint fix visually indented line
Continuation line over-indented for visual indent
https://www.flake8rules.com/rules/E127.html

Visually indented line with same indent as next logical line
https://www.flake8rules.com/rules/E129.html

Signed-off-by: Radostin Stoyanov <radostin@redhat.com>
2022-04-28 17:53:52 -07:00
Radostin Stoyanov
3a689ed9a6 coredump: fix comparison to true
Comparison to true should be 'if cond is true:' or 'if cond:'
https://www.flake8rules.com/rules/E712.html

Signed-off-by: Radostin Stoyanov <radostin@redhat.com>
2022-04-28 17:53:52 -07:00
Radostin Stoyanov
c1eab7d06a coredump: fix too many blank lines
https://www.flake8rules.com/rules/E303.html

Signed-off-by: Radostin Stoyanov <radostin@redhat.com>
2022-04-28 17:53:52 -07:00