Update to version 3.17
Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
This commit is contained in:
parent
3b7bdc24e4
commit
00845889d4
1
.gitignore
vendored
1
.gitignore
vendored
@ -52,3 +52,4 @@
|
||||
/criu-3.16.tar.bz2
|
||||
/criu-3.16.tar.gz
|
||||
/criu-3.16.1.tar.gz
|
||||
/criu-3.17.tar.gz
|
||||
|
||||
@ -1,33 +0,0 @@
|
||||
From 865ee1b856e1ad8a6ee45192e048c414417b4ee9 Mon Sep 17 00:00:00 2001
|
||||
From: Radostin Stoyanov <radostin@redhat.com>
|
||||
Date: Mon, 20 Sep 2021 13:50:08 +0100
|
||||
Subject: [PATCH 001/249] criu(8): add --external net option
|
||||
|
||||
Support for external net namespaces has been introduced with
|
||||
commit c2b21fbf (criu: add support for external net namespaces).
|
||||
|
||||
Signed-off-by: Radostin Stoyanov <radostin@redhat.com>
|
||||
---
|
||||
Documentation/criu.txt | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/Documentation/criu.txt b/Documentation/criu.txt
|
||||
index 690f61e14..3c4c1eaf8 100644
|
||||
--- a/Documentation/criu.txt
|
||||
+++ b/Documentation/criu.txt
|
||||
@@ -242,6 +242,12 @@ In other words, do not use it unless really needed.
|
||||
Tell *criu* that one end of a pair of UNIX sockets (created by
|
||||
*socketpair*(2)) with the given _id_ is OK to be disconnected.
|
||||
|
||||
+*--external* **net[**__inode__**]:**__name__::
|
||||
+ Mark a network namespace as external and do not include it in the
|
||||
+ checkpoint. The label 'name' can be used with *--inherit-fd* during
|
||||
+ restore to specify a file descriptor to a preconfigured network
|
||||
+ namespace.
|
||||
+
|
||||
*--external* **pid[**__inode__**]:**__name__::
|
||||
Mark a PID namespace as external. This can be later used to restore
|
||||
a process into an existing PID namespace. The label 'name' can be
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,40 +0,0 @@
|
||||
From 77c65d7d668d152e660d0a3395348cd69ee0284f Mon Sep 17 00:00:00 2001
|
||||
From: Bui Quang Minh <minhquangbui99@gmail.com>
|
||||
Date: Thu, 12 Aug 2021 11:05:09 +0000
|
||||
Subject: [PATCH 002/249] tcp: Skip restoring TCP state when dumping with
|
||||
--tcp-close
|
||||
|
||||
Since commit e42f5e0 ("tcp: allow to specify --tcp-close on dump"),
|
||||
--tcp-close option can be used when checkpointing. This option skips
|
||||
checkpointing established socket's state (including once established
|
||||
but now closed socket). However, when restoring, we still try to
|
||||
restore closed socket's state. As a result, a non-existent protobuf
|
||||
image is opened.
|
||||
|
||||
This commit skips TCP_CLOSE socket when restoring established TCP
|
||||
connection and removes the redundant check for TCP_LISTEN socket as
|
||||
TCP_LISTEN socket cannot reach this function.
|
||||
|
||||
Suggested-by: Andrei Vagin <avagin@gmail.com>
|
||||
Suggested-by: Radostin Stoyanov <radostin@redhat.com>
|
||||
Signed-off-by: Bui Quang Minh <minhquangbui99@gmail.com>
|
||||
---
|
||||
criu/sk-tcp.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/criu/sk-tcp.c b/criu/sk-tcp.c
|
||||
index 0afecd2d6..96d5d13bf 100644
|
||||
--- a/criu/sk-tcp.c
|
||||
+++ b/criu/sk-tcp.c
|
||||
@@ -451,7 +451,7 @@ int restore_one_tcp(int fd, struct inet_sk_info *ii)
|
||||
|
||||
pr_info("Restoring TCP connection\n");
|
||||
|
||||
- if (opts.tcp_close && ii->ie->state != TCP_LISTEN && ii->ie->state != TCP_CLOSE) {
|
||||
+ if (opts.tcp_close) {
|
||||
if (shutdown(fd, SHUT_RDWR) && errno != ENOTCONN) {
|
||||
pr_perror("Unable to shutdown the socket id %x ino %x", ii->ie->id, ii->ie->ino);
|
||||
}
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,110 +0,0 @@
|
||||
From 249e34007646ac4c11b0c6c594896aef2eff59e0 Mon Sep 17 00:00:00 2001
|
||||
From: Bui Quang Minh <minhquangbui99@gmail.com>
|
||||
Date: Mon, 20 Sep 2021 20:57:03 +0700
|
||||
Subject: [PATCH 003/249] zdtm: Dumping/restoring with --tcp-close on TCP_CLOSE
|
||||
socket
|
||||
|
||||
Signed-off-by: Bui Quang Minh <minhquangbui99@gmail.com>
|
||||
---
|
||||
test/zdtm/static/Makefile | 1 +
|
||||
test/zdtm/static/socket-tcp-close2.c | 67 +++++++++++++++++++++++++
|
||||
test/zdtm/static/socket-tcp-close2.desc | 1 +
|
||||
3 files changed, 69 insertions(+)
|
||||
create mode 100644 test/zdtm/static/socket-tcp-close2.c
|
||||
create mode 100644 test/zdtm/static/socket-tcp-close2.desc
|
||||
|
||||
diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile
|
||||
index c9e6589f0..b6aa621c7 100644
|
||||
--- a/test/zdtm/static/Makefile
|
||||
+++ b/test/zdtm/static/Makefile
|
||||
@@ -107,6 +107,7 @@ TST_NOFILE := \
|
||||
socket-tcp4v6-closed \
|
||||
socket-tcp-close0 \
|
||||
socket-tcp-close1 \
|
||||
+ socket-tcp-close2 \
|
||||
socket-dump-tcp-close \
|
||||
socket-tcp-unconn \
|
||||
socket-tcp6-unconn \
|
||||
diff --git a/test/zdtm/static/socket-tcp-close2.c b/test/zdtm/static/socket-tcp-close2.c
|
||||
new file mode 100644
|
||||
index 000000000..697c99f39
|
||||
--- /dev/null
|
||||
+++ b/test/zdtm/static/socket-tcp-close2.c
|
||||
@@ -0,0 +1,67 @@
|
||||
+#include <sys/types.h>
|
||||
+#include <sys/socket.h>
|
||||
+#include <netinet/tcp.h>
|
||||
+#include <netinet/in.h>
|
||||
+#include <linux/types.h>
|
||||
+#include <signal.h>
|
||||
+
|
||||
+#include "zdtmtst.h"
|
||||
+
|
||||
+const char *test_doc = "Check both dump and restore with tcp_close on TCP_CLOSE sockets";
|
||||
+const char *test_author = "Bui Quang Minh <minhquangbui99@gmail.com>";
|
||||
+
|
||||
+static int port = 8880;
|
||||
+
|
||||
+int main(int argc, char **argv)
|
||||
+{
|
||||
+ int fd_s, fd, client;
|
||||
+ char c;
|
||||
+
|
||||
+ test_init(argc, argv);
|
||||
+ signal(SIGPIPE, SIG_IGN);
|
||||
+
|
||||
+ fd_s = tcp_init_server(AF_INET, &port);
|
||||
+ if (fd_s < 0) {
|
||||
+ pr_err("Server initializations failed\n");
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ client = tcp_init_client(AF_INET, "localhost", port);
|
||||
+ if (client < 0) {
|
||||
+ pr_err("Client initializations failed\n");
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ fd = tcp_accept_server(fd_s);
|
||||
+ if (fd < 0) {
|
||||
+ pr_err("Can't accept client\n");
|
||||
+ return 1;
|
||||
+ }
|
||||
+ close(fd_s);
|
||||
+
|
||||
+ shutdown(client, SHUT_WR);
|
||||
+ shutdown(fd, SHUT_WR);
|
||||
+
|
||||
+ test_daemon();
|
||||
+ test_waitsig();
|
||||
+
|
||||
+ if (read(fd, &c, 1) != 0) {
|
||||
+ fail("read server");
|
||||
+ return 1;
|
||||
+ }
|
||||
+ if (read(client, &c, 1) != 0) {
|
||||
+ fail("read client");
|
||||
+ return 1;
|
||||
+ }
|
||||
+ if (write(client, &c, 1) != -1) {
|
||||
+ fail("write client");
|
||||
+ return 1;
|
||||
+ }
|
||||
+ if (write(fd, &c, 1) != -1) {
|
||||
+ fail("write server");
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ pass();
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/test/zdtm/static/socket-tcp-close2.desc b/test/zdtm/static/socket-tcp-close2.desc
|
||||
new file mode 100644
|
||||
index 000000000..c53a1f315
|
||||
--- /dev/null
|
||||
+++ b/test/zdtm/static/socket-tcp-close2.desc
|
||||
@@ -0,0 +1 @@
|
||||
+{'opts': '--tcp-close', 'flags': 'reqrst '}
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,33 +0,0 @@
|
||||
From e42ff0557a30ab4ddf7dfb594de181b7ec7cdc15 Mon Sep 17 00:00:00 2001
|
||||
From: Bui Quang Minh <minhquangbui99@gmail.com>
|
||||
Date: Mon, 4 Oct 2021 20:38:34 +0700
|
||||
Subject: [PATCH 004/249] criu(8): Add more detailed description about
|
||||
--tcp-close dump option
|
||||
|
||||
The expected behavior of --tcp-close option when dumpping is to close
|
||||
all established tcp connections including connection that is once
|
||||
established but now closed. This adds an explicit description about
|
||||
that behavior.
|
||||
|
||||
Signed-off-by: Bui Quang Minh <minhquangbui99@gmail.com>
|
||||
---
|
||||
Documentation/criu.txt | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Documentation/criu.txt b/Documentation/criu.txt
|
||||
index 3c4c1eaf8..4c6885fc9 100644
|
||||
--- a/Documentation/criu.txt
|
||||
+++ b/Documentation/criu.txt
|
||||
@@ -334,7 +334,8 @@ mount -t cgroup -o devices,freezer none devices,freezer
|
||||
Checkpoint established TCP connections.
|
||||
|
||||
*--tcp-close*::
|
||||
- Don't dump the state of, or block, established tcp connections.
|
||||
+ Don't dump the state of, or block, established tcp connections
|
||||
+ (including the connection is once established but now closed).
|
||||
This is useful when tcp connections are not going to be restored.
|
||||
|
||||
*--skip-in-flight*::
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,311 +0,0 @@
|
||||
From 215fa63c41d9e5595946ac085babbdd01930ca6f Mon Sep 17 00:00:00 2001
|
||||
From: Andrey Vyazovtsev <viazovtsev.av@phystech.edu>
|
||||
Date: Thu, 26 Aug 2021 22:22:33 +0300
|
||||
Subject: [PATCH 005/249] Add support for python3 in criu-coredump
|
||||
|
||||
Resolve the following python3 portability issues:
|
||||
|
||||
1) Python 3 needs explicit relative import path.
|
||||
|
||||
2) Coredumps are binary data, not unicode strings. Use byte strings
|
||||
(b"" instead of "") and open files in binary format.
|
||||
|
||||
3) Some functions (for example: filter) return a list in python 2,
|
||||
but an iterator in python 3. Port code to a common subset of python 2
|
||||
and python 3 using itertool.
|
||||
|
||||
4) Division operator / changed meaning in Python 3. Use explicit
|
||||
integer division (//) where appropriate.
|
||||
|
||||
Signed-off-by: Andrey Vyazovtsev <viazovtsev.av@phystech.edu>
|
||||
---
|
||||
coredump/criu-coredump | 4 +-
|
||||
coredump/criu_coredump/__init__.py | 4 +-
|
||||
coredump/criu_coredump/coredump.py | 68 ++++++++++++++++++------------
|
||||
coredump/criu_coredump/elf.py | 2 +-
|
||||
4 files changed, 45 insertions(+), 33 deletions(-)
|
||||
|
||||
diff --git a/coredump/criu-coredump b/coredump/criu-coredump
|
||||
index 25c188c6b..d3113d372 100755
|
||||
--- a/coredump/criu-coredump
|
||||
+++ b/coredump/criu-coredump
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/usr/bin/env python2
|
||||
+#!/usr/bin/env python
|
||||
import argparse
|
||||
import os
|
||||
|
||||
@@ -10,7 +10,7 @@ def coredump(opts):
|
||||
for pid in cores:
|
||||
if opts['pid'] and pid != opts['pid']:
|
||||
continue
|
||||
- with open(os.path.realpath(opts['out'])+"/core."+str(pid), 'w+') as f:
|
||||
+ with open(os.path.realpath(opts['out'])+"/core."+str(pid), 'wb+') as f:
|
||||
cores[pid].write(f)
|
||||
|
||||
|
||||
diff --git a/coredump/criu_coredump/__init__.py b/coredump/criu_coredump/__init__.py
|
||||
index 213af42ec..7f947518e 100644
|
||||
--- a/coredump/criu_coredump/__init__.py
|
||||
+++ b/coredump/criu_coredump/__init__.py
|
||||
@@ -1,2 +1,2 @@
|
||||
-from coredump import *
|
||||
-import elf
|
||||
+from .coredump import *
|
||||
+from . import elf
|
||||
diff --git a/coredump/criu_coredump/coredump.py b/coredump/criu_coredump/coredump.py
|
||||
index b37ef2291..d67c335c1 100644
|
||||
--- a/coredump/criu_coredump/coredump.py
|
||||
+++ b/coredump/criu_coredump/coredump.py
|
||||
@@ -29,9 +29,14 @@
|
||||
# 4) VMAs contents;
|
||||
#
|
||||
import io
|
||||
-import elf
|
||||
+import sys
|
||||
+from . import elf
|
||||
import ctypes
|
||||
from pycriu import images
|
||||
+try:
|
||||
+ from itertools import ifilter as filter
|
||||
+except ImportError:
|
||||
+ pass
|
||||
|
||||
# Some memory-related constants
|
||||
PAGESIZE = 4096
|
||||
@@ -88,7 +93,7 @@ class coredump:
|
||||
for note in self.notes:
|
||||
buf.write(note.nhdr)
|
||||
buf.write(note.owner)
|
||||
- buf.write("\0" * (8 - len(note.owner)))
|
||||
+ buf.write(b"\0" * (8 - len(note.owner)))
|
||||
buf.write(note.data)
|
||||
|
||||
offset = ctypes.sizeof(elf.Elf64_Ehdr())
|
||||
@@ -136,7 +141,7 @@ class coredump_generator:
|
||||
path += "-" + str(pid)
|
||||
path += ".img"
|
||||
|
||||
- with open(path) as f:
|
||||
+ with open(path, 'rb') as f:
|
||||
img = images.load(f)
|
||||
|
||||
if single:
|
||||
@@ -177,7 +182,7 @@ class coredump_generator:
|
||||
for p in self.coredumps:
|
||||
if pid and p != pid:
|
||||
continue
|
||||
- with open(coredumps_dir + "/" + "core." + str(p), 'w+') as f:
|
||||
+ with open(coredumps_dir + "/" + "core." + str(p), 'wb+') as f:
|
||||
self.coredumps[p].write(f)
|
||||
|
||||
def _gen_coredump(self, pid):
|
||||
@@ -295,7 +300,7 @@ class coredump_generator:
|
||||
prpsinfo.pr_state = 3
|
||||
# Don't even ask me why it is so, just borrowed from linux
|
||||
# source and made pr_state match.
|
||||
- prpsinfo.pr_sname = '.' if prpsinfo.pr_state > 5 else "RSDTZW" [
|
||||
+ prpsinfo.pr_sname = b'.' if prpsinfo.pr_state > 5 else b"RSDTZW" [
|
||||
prpsinfo.pr_state]
|
||||
prpsinfo.pr_zomb = 1 if prpsinfo.pr_state == 4 else 0
|
||||
prpsinfo.pr_nice = core["thread_core"][
|
||||
@@ -307,8 +312,12 @@ class coredump_generator:
|
||||
prpsinfo.pr_ppid = pstree["ppid"]
|
||||
prpsinfo.pr_pgrp = pstree["pgid"]
|
||||
prpsinfo.pr_sid = pstree["sid"]
|
||||
- prpsinfo.pr_fname = core["tc"]["comm"]
|
||||
prpsinfo.pr_psargs = self._gen_cmdline(pid)
|
||||
+ if (sys.version_info > (3, 0)):
|
||||
+ prpsinfo.pr_fname = core["tc"]["comm"].encode()
|
||||
+ else:
|
||||
+ prpsinfo.pr_fname = core["tc"]["comm"]
|
||||
+
|
||||
|
||||
nhdr = elf.Elf64_Nhdr()
|
||||
nhdr.n_namesz = 5
|
||||
@@ -317,7 +326,7 @@ class coredump_generator:
|
||||
|
||||
note = elf_note()
|
||||
note.data = prpsinfo
|
||||
- note.owner = "CORE"
|
||||
+ note.owner = b"CORE"
|
||||
note.nhdr = nhdr
|
||||
|
||||
return note
|
||||
@@ -375,7 +384,7 @@ class coredump_generator:
|
||||
|
||||
note = elf_note()
|
||||
note.data = prstatus
|
||||
- note.owner = "CORE"
|
||||
+ note.owner = b"CORE"
|
||||
note.nhdr = nhdr
|
||||
|
||||
return note
|
||||
@@ -411,7 +420,7 @@ class coredump_generator:
|
||||
|
||||
note = elf_note()
|
||||
note.data = fpregset
|
||||
- note.owner = "CORE"
|
||||
+ note.owner = b"CORE"
|
||||
note.nhdr = nhdr
|
||||
|
||||
return note
|
||||
@@ -452,7 +461,7 @@ class coredump_generator:
|
||||
|
||||
note = elf_note()
|
||||
note.data = data
|
||||
- note.owner = "LINUX"
|
||||
+ note.owner = b"LINUX"
|
||||
note.nhdr = nhdr
|
||||
|
||||
return note
|
||||
@@ -472,7 +481,7 @@ class coredump_generator:
|
||||
|
||||
note = elf_note()
|
||||
note.data = siginfo
|
||||
- note.owner = "CORE"
|
||||
+ note.owner = b"CORE"
|
||||
note.nhdr = nhdr
|
||||
|
||||
return note
|
||||
@@ -482,7 +491,7 @@ class coredump_generator:
|
||||
Generate NT_AUXV note for thread tid of process pid.
|
||||
"""
|
||||
mm = self.mms[pid]
|
||||
- num_auxv = len(mm["mm_saved_auxv"]) / 2
|
||||
+ num_auxv = len(mm["mm_saved_auxv"]) // 2
|
||||
|
||||
class elf_auxv(ctypes.Structure):
|
||||
_fields_ = [("auxv", elf.Elf64_auxv_t * num_auxv)]
|
||||
@@ -499,7 +508,7 @@ class coredump_generator:
|
||||
|
||||
note = elf_note()
|
||||
note.data = auxv
|
||||
- note.owner = "CORE"
|
||||
+ note.owner = b"CORE"
|
||||
note.nhdr = nhdr
|
||||
|
||||
return note
|
||||
@@ -523,10 +532,10 @@ class coredump_generator:
|
||||
continue
|
||||
|
||||
shmid = vma["shmid"]
|
||||
- off = vma["pgoff"] / PAGESIZE
|
||||
+ off = vma["pgoff"] // PAGESIZE
|
||||
|
||||
files = self.reg_files
|
||||
- fname = filter(lambda x: x["id"] == shmid, files)[0]["name"]
|
||||
+ fname = next(filter(lambda x: x["id"] == shmid, files))["name"]
|
||||
|
||||
info = mmaped_file_info()
|
||||
info.start = vma["start"]
|
||||
@@ -569,7 +578,10 @@ class coredump_generator:
|
||||
setattr(data, "start" + str(i), info.start)
|
||||
setattr(data, "end" + str(i), info.end)
|
||||
setattr(data, "file_ofs" + str(i), info.file_ofs)
|
||||
- setattr(data, "name" + str(i), info.name)
|
||||
+ if (sys.version_info > (3, 0)):
|
||||
+ setattr(data, "name" + str(i), info.name.encode())
|
||||
+ else:
|
||||
+ setattr(data, "name" + str(i), info.name)
|
||||
|
||||
nhdr = elf.Elf64_Nhdr()
|
||||
|
||||
@@ -579,7 +591,7 @@ class coredump_generator:
|
||||
|
||||
note = elf_note()
|
||||
note.nhdr = nhdr
|
||||
- note.owner = "CORE"
|
||||
+ note.owner = b"CORE"
|
||||
note.data = data
|
||||
|
||||
return note
|
||||
@@ -644,7 +656,7 @@ class coredump_generator:
|
||||
ppid = self.pstree[pid]["ppid"]
|
||||
return self._get_page(ppid, page_no)
|
||||
else:
|
||||
- with open(self._imgs_dir + "/pages-%s.img" % pages_id) as f:
|
||||
+ with open(self._imgs_dir + "/pages-%s.img" % pages_id, 'rb') as f:
|
||||
f.seek(off * PAGESIZE)
|
||||
return f.read(PAGESIZE)
|
||||
|
||||
@@ -657,16 +669,16 @@ class coredump_generator:
|
||||
f = None
|
||||
|
||||
if size == 0:
|
||||
- return ""
|
||||
+ return b""
|
||||
|
||||
if vma["status"] & status["VMA_AREA_VVAR"]:
|
||||
#FIXME this is what gdb does, as vvar vma
|
||||
# is not readable from userspace?
|
||||
- return "\0" * size
|
||||
+ return b"\0" * size
|
||||
elif vma["status"] & status["VMA_AREA_VSYSCALL"]:
|
||||
#FIXME need to dump it with criu or read from
|
||||
# current process.
|
||||
- return "\0" * size
|
||||
+ return b"\0" * size
|
||||
|
||||
if vma["status"] & status["VMA_FILE_SHARED"] or \
|
||||
vma["status"] & status["VMA_FILE_PRIVATE"]:
|
||||
@@ -675,9 +687,9 @@ class coredump_generator:
|
||||
off = vma["pgoff"]
|
||||
|
||||
files = self.reg_files
|
||||
- fname = filter(lambda x: x["id"] == shmid, files)[0]["name"]
|
||||
+ fname = next(filter(lambda x: x["id"] == shmid, files))["name"]
|
||||
|
||||
- f = open(fname)
|
||||
+ f = open(fname, 'rb')
|
||||
f.seek(off)
|
||||
|
||||
start = vma["start"]
|
||||
@@ -699,10 +711,10 @@ class coredump_generator:
|
||||
# a file, and changed ones -- from pages.img.
|
||||
# Finally, if no page is found neither in pages.img nor
|
||||
# in file, hole in inserted -- a page filled with zeroes.
|
||||
- start_page = start / PAGESIZE
|
||||
- end_page = end / PAGESIZE
|
||||
+ start_page = start // PAGESIZE
|
||||
+ end_page = end // PAGESIZE
|
||||
|
||||
- buf = ""
|
||||
+ buf = b""
|
||||
for page_no in range(start_page, end_page + 1):
|
||||
page = None
|
||||
|
||||
@@ -720,7 +732,7 @@ class coredump_generator:
|
||||
|
||||
if page is None:
|
||||
# Hole
|
||||
- page = PAGESIZE * "\0"
|
||||
+ page = PAGESIZE * b"\0"
|
||||
|
||||
# If it is a start or end page, we need to read
|
||||
# only part of it.
|
||||
@@ -762,7 +774,7 @@ class coredump_generator:
|
||||
chunk = self._gen_mem_chunk(pid, vma, size)
|
||||
|
||||
# Replace all '\0's with spaces.
|
||||
- return chunk.replace('\0', ' ')
|
||||
+ return chunk.replace(b'\0', b' ')
|
||||
|
||||
def _get_vma_dump_size(self, vma):
|
||||
"""
|
||||
diff --git a/coredump/criu_coredump/elf.py b/coredump/criu_coredump/elf.py
|
||||
index e65919e6b..a670ae866 100644
|
||||
--- a/coredump/criu_coredump/elf.py
|
||||
+++ b/coredump/criu_coredump/elf.py
|
||||
@@ -368,7 +368,7 @@ elf_fpregset_t = user_fpregs_struct
|
||||
# siginfo_t related constants.
|
||||
|
||||
_SI_MAX_SIZE = 128
|
||||
-_SI_PAD_SIZE = (_SI_MAX_SIZE / ctypes.sizeof(ctypes.c_int)) - 4
|
||||
+_SI_PAD_SIZE = (_SI_MAX_SIZE // ctypes.sizeof(ctypes.c_int)) - 4
|
||||
|
||||
|
||||
# /* kill(). */
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,71 +0,0 @@
|
||||
From d08f284b5d5120a8e550b44901ee96b840900b7d Mon Sep 17 00:00:00 2001
|
||||
From: AndreyVV-100 <viazovtsev.av@phystech.edu>
|
||||
Date: Fri, 23 Jul 2021 12:48:03 +0300
|
||||
Subject: [PATCH 006/249] Add new files for running criu-coredump via python 2
|
||||
or 3
|
||||
|
||||
Previous commit added support for python3 in criu-coredump. For convenience,
|
||||
add two files (coredump-python2 and coredump-python3) that start
|
||||
criu-coredump with respective python version. Edit env.sh accordingly.
|
||||
|
||||
Signed-off-by: Andrey Vyazovtsev <viazovtsev.av@phystech.edu>
|
||||
---
|
||||
coredump/coredump-python2 | 6 ++++++
|
||||
coredump/coredump-python3 | 6 ++++++
|
||||
coredump/{criu-coredump => coredump.py} | 1 -
|
||||
test/others/env.sh | 2 +-
|
||||
4 files changed, 13 insertions(+), 2 deletions(-)
|
||||
create mode 100755 coredump/coredump-python2
|
||||
create mode 100755 coredump/coredump-python3
|
||||
rename coredump/{criu-coredump => coredump.py} (97%)
|
||||
|
||||
diff --git a/coredump/coredump-python2 b/coredump/coredump-python2
|
||||
new file mode 100755
|
||||
index 000000000..3a15c90a3
|
||||
--- /dev/null
|
||||
+++ b/coredump/coredump-python2
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/usr/bin/env python2
|
||||
+
|
||||
+import coredump
|
||||
+
|
||||
+if __name__ == '__main__':
|
||||
+ coredump.main()
|
||||
diff --git a/coredump/coredump-python3 b/coredump/coredump-python3
|
||||
new file mode 100755
|
||||
index 000000000..82ec6b855
|
||||
--- /dev/null
|
||||
+++ b/coredump/coredump-python3
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/usr/bin/env python3
|
||||
+
|
||||
+import coredump
|
||||
+
|
||||
+if __name__ == '__main__':
|
||||
+ coredump.main()
|
||||
diff --git a/coredump/criu-coredump b/coredump/coredump.py
|
||||
similarity index 97%
|
||||
rename from coredump/criu-coredump
|
||||
rename to coredump/coredump.py
|
||||
index d3113d372..56ba54083 100755
|
||||
--- a/coredump/criu-coredump
|
||||
+++ b/coredump/coredump.py
|
||||
@@ -1,4 +1,3 @@
|
||||
-#!/usr/bin/env python
|
||||
import argparse
|
||||
import os
|
||||
|
||||
diff --git a/test/others/env.sh b/test/others/env.sh
|
||||
index b514e87d9..e2f63eee3 100755
|
||||
--- a/test/others/env.sh
|
||||
+++ b/test/others/env.sh
|
||||
@@ -13,5 +13,5 @@ fi
|
||||
#export PYTHON
|
||||
CRIT=$(readlink -f `dirname ${BASH_SOURCE[0]}`/../../crit/crit-"${PYTHON}")
|
||||
crit=$CRIT
|
||||
-CRIU_COREDUMP=$(readlink -f `dirname ${BASH_SOURCE[0]}`/../../criu-coredump/criu-coredump)
|
||||
+CRIU_COREDUMP=$(readlink -f `dirname ${BASH_SOURCE[0]}`/../../criu-coredump/coredump-"${PYTHON}")
|
||||
criu_coredump=$CRIU_COREDUMP
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,32 +0,0 @@
|
||||
From 2d4bb6601de571f5dca7cd43089979747f6acc2e Mon Sep 17 00:00:00 2001
|
||||
From: Radostin Stoyanov <radostin@redhat.com>
|
||||
Date: Sun, 5 Sep 2021 21:31:12 +0100
|
||||
Subject: [PATCH 007/249] coredump: remove unused import
|
||||
|
||||
Signed-off-by: Radostin Stoyanov <radostin@redhat.com>
|
||||
---
|
||||
coredump/criu_coredump/__init__.py | 3 +--
|
||||
scripts/flake8.cfg | 2 ++
|
||||
2 files changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/coredump/criu_coredump/__init__.py b/coredump/criu_coredump/__init__.py
|
||||
index 7f947518e..c1a437cf4 100644
|
||||
--- a/coredump/criu_coredump/__init__.py
|
||||
+++ b/coredump/criu_coredump/__init__.py
|
||||
@@ -1,2 +1 @@
|
||||
-from .coredump import *
|
||||
-from . import elf
|
||||
+from .coredump import coredump_generator
|
||||
diff --git a/scripts/flake8.cfg b/scripts/flake8.cfg
|
||||
index b6a587729..bd4f95bb2 100644
|
||||
--- a/scripts/flake8.cfg
|
||||
+++ b/scripts/flake8.cfg
|
||||
@@ -2,3 +2,5 @@
|
||||
# E501 line too long
|
||||
# W504 line break after binary operator
|
||||
ignore = E501,W504
|
||||
+# F401: imported but unused
|
||||
+per-file-ignores = __init__.py:F401
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,31 +0,0 @@
|
||||
From e849a46256da1c5b8990c7875580172e35210205 Mon Sep 17 00:00:00 2001
|
||||
From: Radostin Stoyanov <radostin@redhat.com>
|
||||
Date: Sun, 5 Sep 2021 21:32:17 +0100
|
||||
Subject: [PATCH 008/249] coredump: sort imports
|
||||
|
||||
Signed-off-by: Radostin Stoyanov <radostin@redhat.com>
|
||||
---
|
||||
coredump/criu_coredump/coredump.py | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/coredump/criu_coredump/coredump.py b/coredump/criu_coredump/coredump.py
|
||||
index d67c335c1..9b4aad5ff 100644
|
||||
--- a/coredump/criu_coredump/coredump.py
|
||||
+++ b/coredump/criu_coredump/coredump.py
|
||||
@@ -30,9 +30,12 @@
|
||||
#
|
||||
import io
|
||||
import sys
|
||||
-from . import elf
|
||||
import ctypes
|
||||
+
|
||||
from pycriu import images
|
||||
+from . import elf
|
||||
+
|
||||
+
|
||||
try:
|
||||
from itertools import ifilter as filter
|
||||
except ImportError:
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,107 +0,0 @@
|
||||
From 4f99f82cb3fae3ebaf35b853d7ecbbf1a9fecd27 Mon Sep 17 00:00:00 2001
|
||||
From: Radostin Stoyanov <radostin@redhat.com>
|
||||
Date: Sun, 5 Sep 2021 21:34:00 +0100
|
||||
Subject: [PATCH 009/249] coredump: convert indentation to spaces
|
||||
|
||||
Signed-off-by: Radostin Stoyanov <radostin@redhat.com>
|
||||
---
|
||||
coredump/coredump-python2 | 2 +-
|
||||
coredump/coredump-python3 | 2 +-
|
||||
coredump/coredump.py | 58 ++++++++++++++++++++-------------------
|
||||
3 files changed, 32 insertions(+), 30 deletions(-)
|
||||
|
||||
diff --git a/coredump/coredump-python2 b/coredump/coredump-python2
|
||||
index 3a15c90a3..564c05ce9 100755
|
||||
--- a/coredump/coredump-python2
|
||||
+++ b/coredump/coredump-python2
|
||||
@@ -3,4 +3,4 @@
|
||||
import coredump
|
||||
|
||||
if __name__ == '__main__':
|
||||
- coredump.main()
|
||||
+ coredump.main()
|
||||
diff --git a/coredump/coredump-python3 b/coredump/coredump-python3
|
||||
index 82ec6b855..3032dbadf 100755
|
||||
--- a/coredump/coredump-python3
|
||||
+++ b/coredump/coredump-python3
|
||||
@@ -3,4 +3,4 @@
|
||||
import coredump
|
||||
|
||||
if __name__ == '__main__':
|
||||
- coredump.main()
|
||||
+ coredump.main()
|
||||
diff --git a/coredump/coredump.py b/coredump/coredump.py
|
||||
index 56ba54083..e63abf951 100755
|
||||
--- a/coredump/coredump.py
|
||||
+++ b/coredump/coredump.py
|
||||
@@ -3,37 +3,39 @@ import os
|
||||
|
||||
import criu_coredump
|
||||
|
||||
+
|
||||
def coredump(opts):
|
||||
- generator = criu_coredump.coredump_generator()
|
||||
- cores = generator(os.path.realpath(opts['in']))
|
||||
- for pid in cores:
|
||||
- if opts['pid'] and pid != opts['pid']:
|
||||
- continue
|
||||
- with open(os.path.realpath(opts['out'])+"/core."+str(pid), 'wb+') as f:
|
||||
- cores[pid].write(f)
|
||||
+ generator = criu_coredump.coredump_generator()
|
||||
+ cores = generator(os.path.realpath(opts['in']))
|
||||
+ for pid in cores:
|
||||
+ if opts['pid'] and pid != opts['pid']:
|
||||
+ continue
|
||||
+ with open(os.path.realpath(opts['out'])+"/core."+str(pid), 'wb+') as f:
|
||||
+ cores[pid].write(f)
|
||||
|
||||
|
||||
def main():
|
||||
- desc = 'CRIU core dump'
|
||||
- parser = argparse.ArgumentParser(description=desc,
|
||||
- formatter_class=argparse.RawTextHelpFormatter)
|
||||
-
|
||||
- parser.add_argument('-i',
|
||||
- '--in',
|
||||
- default = '.',
|
||||
- help = 'directory where to get images from')
|
||||
- parser.add_argument('-p',
|
||||
- '--pid',
|
||||
- type = int,
|
||||
- help = 'generate coredump for specific pid(all pids py default)')
|
||||
- parser.add_argument('-o',
|
||||
- '--out',
|
||||
- default = '.',
|
||||
- help = 'directory to write coredumps to')
|
||||
-
|
||||
- opts = vars(parser.parse_args())
|
||||
-
|
||||
- coredump(opts)
|
||||
+ desc = 'CRIU core dump'
|
||||
+ parser = argparse.ArgumentParser(description=desc,
|
||||
+ formatter_class=argparse.RawTextHelpFormatter)
|
||||
+
|
||||
+ parser.add_argument('-i',
|
||||
+ '--in',
|
||||
+ default='.',
|
||||
+ help='directory where to get images from')
|
||||
+ parser.add_argument('-p',
|
||||
+ '--pid',
|
||||
+ type=int,
|
||||
+ help='generate coredump for specific pid(all pids py default)')
|
||||
+ parser.add_argument('-o',
|
||||
+ '--out',
|
||||
+ default='.',
|
||||
+ help='directory to write coredumps to')
|
||||
+
|
||||
+ opts = vars(parser.parse_args())
|
||||
+
|
||||
+ coredump(opts)
|
||||
+
|
||||
|
||||
if __name__ == '__main__':
|
||||
- main()
|
||||
+ main()
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,117 +0,0 @@
|
||||
From 6d8ba10f26a6f6d73fd0ff64a85f8803b3021a8a Mon Sep 17 00:00:00 2001
|
||||
From: Radostin Stoyanov <radostin@redhat.com>
|
||||
Date: Sun, 5 Sep 2021 21:36:10 +0100
|
||||
Subject: [PATCH 010/249] python: replace equality with identity test
|
||||
|
||||
PEP8 recommends for comparisons to singletons like None to always be
|
||||
done with 'is' or 'is not', never the equality operators.
|
||||
|
||||
https://python.org/dev/peps/pep-0008/#programming-recommendations
|
||||
|
||||
Signed-off-by: Radostin Stoyanov <radostin@redhat.com>
|
||||
---
|
||||
coredump/criu_coredump/coredump.py | 6 +++---
|
||||
test/exhaustive/pipe.py | 12 ++++++------
|
||||
test/exhaustive/unix.py | 2 +-
|
||||
3 files changed, 10 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/coredump/criu_coredump/coredump.py b/coredump/criu_coredump/coredump.py
|
||||
index 9b4aad5ff..a9a8bb27c 100644
|
||||
--- a/coredump/criu_coredump/coredump.py
|
||||
+++ b/coredump/criu_coredump/coredump.py
|
||||
@@ -725,10 +725,10 @@ class coredump_generator:
|
||||
# and choose appropriate.
|
||||
page_mem = self._get_page(pid, page_no)
|
||||
|
||||
- if f != None:
|
||||
+ if f is not None:
|
||||
page = f.read(PAGESIZE)
|
||||
|
||||
- if page_mem != None:
|
||||
+ if page_mem is not None:
|
||||
# Page from pages.img has higher priority
|
||||
# than one from maped file on disk.
|
||||
page = page_mem
|
||||
@@ -755,7 +755,7 @@ class coredump_generator:
|
||||
buf += page[n_skip:n_skip + n_read]
|
||||
|
||||
# Don't forget to close file.
|
||||
- if f != None:
|
||||
+ if f is not None:
|
||||
f.close()
|
||||
|
||||
return buf
|
||||
diff --git a/test/exhaustive/pipe.py b/test/exhaustive/pipe.py
|
||||
index fdadc480c..7f1c53d34 100755
|
||||
--- a/test/exhaustive/pipe.py
|
||||
+++ b/test/exhaustive/pipe.py
|
||||
@@ -75,7 +75,7 @@ def get_pipe_rw(pid, fd):
|
||||
|
||||
def check_pipe_y(pid, fd, rw, inos):
|
||||
ino = get_pipe_ino(pid, fd)
|
||||
- if ino == None:
|
||||
+ if ino is None:
|
||||
return 'missing '
|
||||
if not inos.has_key(fd):
|
||||
inos[fd] = ino
|
||||
@@ -89,7 +89,7 @@ def check_pipe_y(pid, fd, rw, inos):
|
||||
|
||||
def check_pipe_n(pid, fd):
|
||||
ino = get_pipe_ino(pid, fd)
|
||||
- if ino == None:
|
||||
+ if ino is None:
|
||||
return None
|
||||
else:
|
||||
return 'present '
|
||||
@@ -102,7 +102,7 @@ def check_pipe_end(kids, fd, comb, rw, inos):
|
||||
res = check_pipe_y(t_pid, fd, rw, inos)
|
||||
else:
|
||||
res = check_pipe_n(t_pid, fd)
|
||||
- if res != None:
|
||||
+ if res is not None:
|
||||
return res + 'kid(%d)' % t_nr
|
||||
t_nr += 1
|
||||
return None
|
||||
@@ -111,7 +111,7 @@ def check_pipe_end(kids, fd, comb, rw, inos):
|
||||
def check_pipe(kids, fds, comb, inos):
|
||||
for e in (0, 1): # 0 == R, 1 == W, see get_pipe_rw()
|
||||
res = check_pipe_end(kids, fds[e], comb[e], e, inos)
|
||||
- if res != None:
|
||||
+ if res is not None:
|
||||
return res + 'end(%d)' % e
|
||||
return None
|
||||
|
||||
@@ -124,7 +124,7 @@ def check_pipes(kids, pipes, comb):
|
||||
p_inos = {}
|
||||
for p_fds in pipes:
|
||||
res = check_pipe(kids, p_fds, comb[p_nr], p_inos)
|
||||
- if res != None:
|
||||
+ if res is not None:
|
||||
return res + 'pipe(%d)' % p_nr
|
||||
p_nr += 1
|
||||
|
||||
@@ -182,7 +182,7 @@ def make_comb(comb, opts, status_pipe):
|
||||
if v == '0':
|
||||
print('\tCheck pipes')
|
||||
res = check_pipes(kids, pipes, comb)
|
||||
- if res == None:
|
||||
+ if res is None:
|
||||
ex_code = 0
|
||||
else:
|
||||
print('\tFAIL %s' % res)
|
||||
diff --git a/test/exhaustive/unix.py b/test/exhaustive/unix.py
|
||||
index 98dbbb7b0..114bf957b 100755
|
||||
--- a/test/exhaustive/unix.py
|
||||
+++ b/test/exhaustive/unix.py
|
||||
@@ -304,7 +304,7 @@ class sock:
|
||||
for psk in st.sockets:
|
||||
if psk == self:
|
||||
continue
|
||||
- if psk.peer != None and psk.peer != self.sk_id:
|
||||
+ if psk.peer is not None and psk.peer != self.sk_id:
|
||||
# Peer by someone else, can do nothing
|
||||
continue
|
||||
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,26 +0,0 @@
|
||||
From 4f14d170a2cf59a7a1ddfad6f6570e9a750eb16c Mon Sep 17 00:00:00 2001
|
||||
From: Radostin Stoyanov <radostin@redhat.com>
|
||||
Date: Sun, 5 Sep 2021 21:38:06 +0100
|
||||
Subject: [PATCH 011/249] coredump: drop unused variable
|
||||
|
||||
Signed-off-by: Radostin Stoyanov <radostin@redhat.com>
|
||||
---
|
||||
coredump/criu_coredump/coredump.py | 2 --
|
||||
1 file changed, 2 deletions(-)
|
||||
|
||||
diff --git a/coredump/criu_coredump/coredump.py b/coredump/criu_coredump/coredump.py
|
||||
index a9a8bb27c..42c2fed19 100644
|
||||
--- a/coredump/criu_coredump/coredump.py
|
||||
+++ b/coredump/criu_coredump/coredump.py
|
||||
@@ -834,8 +834,6 @@ class coredump_generator:
|
||||
|
||||
vmas = []
|
||||
for vma in mm["vmas"]:
|
||||
- size = self._get_vma_dump_size(vma)
|
||||
-
|
||||
v = vma_class()
|
||||
v.filesz = self._get_vma_dump_size(vma)
|
||||
v.data = self._gen_mem_chunk(pid, vma, v.filesz)
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,20 +0,0 @@
|
||||
From 9108a60b953530b594fd246bd33693a6b28bba3e Mon Sep 17 00:00:00 2001
|
||||
From: Radostin Stoyanov <radostin@redhat.com>
|
||||
Date: Sun, 5 Sep 2021 21:42:46 +0100
|
||||
Subject: [PATCH 012/249] coredump: drop exec permission
|
||||
|
||||
The shebang line in this file was removed in a previous commit and the
|
||||
file should be non-executable.
|
||||
|
||||
Signed-off-by: Radostin Stoyanov <radostin@redhat.com>
|
||||
---
|
||||
coredump/coredump.py | 0
|
||||
1 file changed, 0 insertions(+), 0 deletions(-)
|
||||
mode change 100755 => 100644 coredump/coredump.py
|
||||
|
||||
diff --git a/coredump/coredump.py b/coredump/coredump.py
|
||||
old mode 100755
|
||||
new mode 100644
|
||||
--
|
||||
2.35.1
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,29 +0,0 @@
|
||||
From 33b1692e10d8192f583e5fa10d5ab9fb7ac7bef7 Mon Sep 17 00:00:00 2001
|
||||
From: Radostin Stoyanov <radostin@redhat.com>
|
||||
Date: Sun, 5 Sep 2021 22:37:26 +0100
|
||||
Subject: [PATCH 014/249] coredump: fix missing whitespace around operator
|
||||
|
||||
Missing whitespace around arithmetic operator
|
||||
https://www.flake8rules.com/rules/E226.html
|
||||
|
||||
Signed-off-by: Radostin Stoyanov <radostin@redhat.com>
|
||||
---
|
||||
coredump/coredump.py | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/coredump/coredump.py b/coredump/coredump.py
|
||||
index e63abf951..5e63d2138 100644
|
||||
--- a/coredump/coredump.py
|
||||
+++ b/coredump/coredump.py
|
||||
@@ -10,7 +10,7 @@ def coredump(opts):
|
||||
for pid in cores:
|
||||
if opts['pid'] and pid != opts['pid']:
|
||||
continue
|
||||
- with open(os.path.realpath(opts['out'])+"/core."+str(pid), 'wb+') as f:
|
||||
+ with open(os.path.realpath(opts['out']) + "/core." + str(pid), 'wb+') as f:
|
||||
cores[pid].write(f)
|
||||
|
||||
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,27 +0,0 @@
|
||||
From a20c0fe6e518a76db428979d2a145e98fdd79988 Mon Sep 17 00:00:00 2001
|
||||
From: Radostin Stoyanov <radostin@redhat.com>
|
||||
Date: Sun, 5 Sep 2021 22:39:50 +0100
|
||||
Subject: [PATCH 015/249] coredump: fix too many blank lines
|
||||
|
||||
https://www.flake8rules.com/rules/E303.html
|
||||
|
||||
Signed-off-by: Radostin Stoyanov <radostin@redhat.com>
|
||||
---
|
||||
coredump/criu_coredump/coredump.py | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/coredump/criu_coredump/coredump.py b/coredump/criu_coredump/coredump.py
|
||||
index 274889800..a232132fd 100644
|
||||
--- a/coredump/criu_coredump/coredump.py
|
||||
+++ b/coredump/criu_coredump/coredump.py
|
||||
@@ -321,7 +321,6 @@ class coredump_generator:
|
||||
else:
|
||||
prpsinfo.pr_fname = core["tc"]["comm"]
|
||||
|
||||
-
|
||||
nhdr = elf.Elf64_Nhdr()
|
||||
nhdr.n_namesz = 5
|
||||
nhdr.n_descsz = ctypes.sizeof(elf.elf_prpsinfo())
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,29 +0,0 @@
|
||||
From e2fe46e74dd8904f296baa1257cf7191bcd74c4c Mon Sep 17 00:00:00 2001
|
||||
From: Radostin Stoyanov <radostin@redhat.com>
|
||||
Date: Sun, 5 Sep 2021 22:42:19 +0100
|
||||
Subject: [PATCH 016/249] 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>
|
||||
---
|
||||
coredump/criu_coredump/coredump.py | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/coredump/criu_coredump/coredump.py b/coredump/criu_coredump/coredump.py
|
||||
index a232132fd..41d102db7 100644
|
||||
--- a/coredump/criu_coredump/coredump.py
|
||||
+++ b/coredump/criu_coredump/coredump.py
|
||||
@@ -653,7 +653,7 @@ class coredump_generator:
|
||||
if not found:
|
||||
continue
|
||||
|
||||
- if "in_parent" in m and m["in_parent"] == True:
|
||||
+ if "in_parent" in m and m["in_parent"]:
|
||||
ppid = self.pstree[pid]["ppid"]
|
||||
return self._get_page(ppid, page_no)
|
||||
else:
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,52 +0,0 @@
|
||||
From 630893e55da8281877ddd833e79e33a5dddd2b1b Mon Sep 17 00:00:00 2001
|
||||
From: Radostin Stoyanov <radostin@redhat.com>
|
||||
Date: Sun, 5 Sep 2021 22:47:59 +0100
|
||||
Subject: [PATCH 017/249] 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>
|
||||
---
|
||||
coredump/criu_coredump/coredump.py | 18 +++++++++---------
|
||||
1 file changed, 9 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/coredump/criu_coredump/coredump.py b/coredump/criu_coredump/coredump.py
|
||||
index 41d102db7..881c40b0a 100644
|
||||
--- a/coredump/criu_coredump/coredump.py
|
||||
+++ b/coredump/criu_coredump/coredump.py
|
||||
@@ -781,19 +781,19 @@ class coredump_generator:
|
||||
"""
|
||||
Calculate amount of vma to put into core dump.
|
||||
"""
|
||||
- if vma["status"] & status["VMA_AREA_VVAR"] or \
|
||||
- vma["status"] & status["VMA_AREA_VSYSCALL"] or \
|
||||
- vma["status"] & status["VMA_AREA_VDSO"]:
|
||||
+ if (vma["status"] & status["VMA_AREA_VVAR"] or
|
||||
+ vma["status"] & status["VMA_AREA_VSYSCALL"] or
|
||||
+ vma["status"] & status["VMA_AREA_VDSO"]):
|
||||
size = vma["end"] - vma["start"]
|
||||
elif vma["prot"] == 0:
|
||||
size = 0
|
||||
- elif vma["prot"] & prot["PROT_READ"] and \
|
||||
- vma["prot"] & prot["PROT_EXEC"]:
|
||||
+ elif (vma["prot"] & prot["PROT_READ"] and
|
||||
+ vma["prot"] & prot["PROT_EXEC"]):
|
||||
size = PAGESIZE
|
||||
- elif vma["status"] & status["VMA_ANON_SHARED"] or \
|
||||
- vma["status"] & status["VMA_FILE_SHARED"] or \
|
||||
- vma["status"] & status["VMA_ANON_PRIVATE"] or \
|
||||
- vma["status"] & status["VMA_FILE_PRIVATE"]:
|
||||
+ elif (vma["status"] & status["VMA_ANON_SHARED"] or
|
||||
+ vma["status"] & status["VMA_FILE_SHARED"] or
|
||||
+ vma["status"] & status["VMA_ANON_PRIVATE"] or
|
||||
+ vma["status"] & status["VMA_FILE_PRIVATE"]):
|
||||
size = vma["end"] - vma["start"]
|
||||
else:
|
||||
size = 0
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,51 +0,0 @@
|
||||
From 8fa9bbf2a2d5d5fcc80de865d380af7e7917a371 Mon Sep 17 00:00:00 2001
|
||||
From: Radostin Stoyanov <radostin@redhat.com>
|
||||
Date: Mon, 6 Sep 2021 00:20:58 +0100
|
||||
Subject: [PATCH 018/249] 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>
|
||||
---
|
||||
test/others/criu-coredump/test.sh | 10 +++++++---
|
||||
1 file changed, 7 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/test/others/criu-coredump/test.sh b/test/others/criu-coredump/test.sh
|
||||
index 62d9f7edc..dd774e298 100755
|
||||
--- a/test/others/criu-coredump/test.sh
|
||||
+++ b/test/others/criu-coredump/test.sh
|
||||
@@ -1,4 +1,8 @@
|
||||
-source ../env.sh
|
||||
+#!/bin/bash
|
||||
+
|
||||
+set -x
|
||||
+# shellcheck disable=SC1091
|
||||
+source ../env.sh || exit 1
|
||||
|
||||
function gen_imgs {
|
||||
PID=$(../loop)
|
||||
@@ -9,7 +13,7 @@ function gen_imgs {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- images_list=$(ls -1 *.img)
|
||||
+ images_list=$(ls -1 ./*.img)
|
||||
if [ -z "$images_list" ]; then
|
||||
echo "Failed to generate images"
|
||||
exit 1
|
||||
@@ -32,7 +36,7 @@ function run_test {
|
||||
for x in $cores
|
||||
do
|
||||
echo "=== try readelf $x"
|
||||
- readelf -a $x || exit $?
|
||||
+ readelf -a "$x" || exit $?
|
||||
echo "=== done"
|
||||
done
|
||||
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,31 +0,0 @@
|
||||
From 7ea1e500fb23ce96dc895c5d59aae5a3728040b0 Mon Sep 17 00:00:00 2001
|
||||
From: Radostin Stoyanov <radostin@redhat.com>
|
||||
Date: Sun, 5 Sep 2021 22:55:24 +0100
|
||||
Subject: [PATCH 019/249] make: enable lint for coredump
|
||||
|
||||
Signed-off-by: Radostin Stoyanov <radostin@redhat.com>
|
||||
---
|
||||
Makefile | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 08761efed..1f0dec78b 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -409,11 +409,13 @@ lint:
|
||||
flake8 --config=scripts/flake8.cfg test/others/rpc/config_file.py
|
||||
flake8 --config=scripts/flake8.cfg lib/py/images/pb2dict.py
|
||||
flake8 --config=scripts/flake8.cfg scripts/criu-ns
|
||||
+ flake8 --config=scripts/flake8.cfg coredump/
|
||||
shellcheck --version
|
||||
shellcheck scripts/*.sh
|
||||
shellcheck scripts/ci/*.sh scripts/ci/apt-install
|
||||
shellcheck test/others/crit/*.sh
|
||||
shellcheck test/others/libcriu/*.sh
|
||||
+ shellcheck test/others/crit/*.sh test/others/criu-coredump/*.sh
|
||||
shellcheck test/others/config-file/*.sh
|
||||
# Do not append \n to pr_perror or fail
|
||||
! git --no-pager grep -E '^\s*\<(pr_perror|fail)\>.*\\n"'
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,39 +0,0 @@
|
||||
From 2b3165ebfecb216a8f07c3d2b7a68723d96f13ff Mon Sep 17 00:00:00 2001
|
||||
From: Radostin Stoyanov <radostin@redhat.com>
|
||||
Date: Sun, 5 Sep 2021 23:06:56 +0100
|
||||
Subject: [PATCH 020/249] ci: enable coredump tests
|
||||
|
||||
Signed-off-by: Radostin Stoyanov <radostin@redhat.com>
|
||||
---
|
||||
scripts/ci/run-ci-tests.sh | 3 +++
|
||||
test/others/env.sh | 2 +-
|
||||
2 files changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/scripts/ci/run-ci-tests.sh b/scripts/ci/run-ci-tests.sh
|
||||
index 7c66e6802..51aa7db9e 100755
|
||||
--- a/scripts/ci/run-ci-tests.sh
|
||||
+++ b/scripts/ci/run-ci-tests.sh
|
||||
@@ -259,6 +259,9 @@ ip net add test
|
||||
# more crit testing
|
||||
make -C test/others/crit run
|
||||
|
||||
+# coredump testing
|
||||
+make -C test/others/criu-coredump run
|
||||
+
|
||||
# libcriu testing
|
||||
make -C test/others/libcriu run
|
||||
|
||||
diff --git a/test/others/env.sh b/test/others/env.sh
|
||||
index e2f63eee3..45066f760 100755
|
||||
--- a/test/others/env.sh
|
||||
+++ b/test/others/env.sh
|
||||
@@ -13,5 +13,5 @@ fi
|
||||
#export PYTHON
|
||||
CRIT=$(readlink -f `dirname ${BASH_SOURCE[0]}`/../../crit/crit-"${PYTHON}")
|
||||
crit=$CRIT
|
||||
-CRIU_COREDUMP=$(readlink -f `dirname ${BASH_SOURCE[0]}`/../../criu-coredump/coredump-"${PYTHON}")
|
||||
+CRIU_COREDUMP=$(readlink -f `dirname ${BASH_SOURCE[0]}`/../../coredump/coredump-"${PYTHON}")
|
||||
criu_coredump=$CRIU_COREDUMP
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,39 +0,0 @@
|
||||
From fe002c36aa94b8cfde68c12710084be558afec02 Mon Sep 17 00:00:00 2001
|
||||
From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
|
||||
Date: Thu, 21 Oct 2021 11:47:01 +0300
|
||||
Subject: [PATCH 021/249] 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>
|
||||
---
|
||||
criu/pie/restorer.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/criu/pie/restorer.c b/criu/pie/restorer.c
|
||||
index 4304691bb..0051452e4 100644
|
||||
--- a/criu/pie/restorer.c
|
||||
+++ b/criu/pie/restorer.c
|
||||
@@ -1013,7 +1013,7 @@ static int timerfd_arm(struct task_restore_args *args)
|
||||
|
||||
t->val.it_value.tv_sec += (time_t)ts.tv_sec;
|
||||
|
||||
- pr_debug("Adjust id %#x it_value(%llu, %llu) -> it_value(%llu, %llu)\n", t->id,
|
||||
+ pr_debug("Adjust id %x it_value(%llu, %llu) -> it_value(%llu, %llu)\n", t->id,
|
||||
(unsigned long long)ts.tv_sec, (unsigned long long)ts.tv_nsec,
|
||||
(unsigned long long)t->val.it_value.tv_sec,
|
||||
(unsigned long long)t->val.it_value.tv_nsec);
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,34 +0,0 @@
|
||||
From 373b1b787c96c4ee795000cb0e190ac5d135e17c Mon Sep 17 00:00:00 2001
|
||||
From: "fu.lin" <fulin10@huawei.com>
|
||||
Date: Fri, 17 Sep 2021 17:16:48 +0800
|
||||
Subject: [PATCH 022/249] 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>
|
||||
---
|
||||
criu/tty.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/criu/tty.c b/criu/tty.c
|
||||
index 1598ad956..1462193c5 100644
|
||||
--- a/criu/tty.c
|
||||
+++ b/criu/tty.c
|
||||
@@ -1977,6 +1977,12 @@ static int dump_one_tty(int lfd, u32 id, const struct fd_parms *p)
|
||||
pr_info("Dumping tty %d with id %#x\n", lfd, id);
|
||||
|
||||
driver = get_tty_driver(p->stat.st_rdev, p->stat.st_dev);
|
||||
+ if (driver == NULL) {
|
||||
+ pr_err("Unable to find a tty driver (rdev %#" PRIx64 " dev %#" PRIx64 ")\n", p->stat.st_rdev,
|
||||
+ p->stat.st_dev);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
if (driver->fd_get_index)
|
||||
index = driver->fd_get_index(lfd, p);
|
||||
else
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,126 +0,0 @@
|
||||
From 03cb3026fe42cc66b177e66ab96f27bba4e06ce3 Mon Sep 17 00:00:00 2001
|
||||
From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
|
||||
Date: Fri, 22 Oct 2021 17:56:37 +0300
|
||||
Subject: [PATCH 023/249] 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>
|
||||
---
|
||||
criu/apparmor.c | 2 +-
|
||||
criu/include/util.h | 4 ++--
|
||||
criu/util.c | 46 ++++++++++++++-------------------------------
|
||||
3 files changed, 17 insertions(+), 35 deletions(-)
|
||||
|
||||
diff --git a/criu/apparmor.c b/criu/apparmor.c
|
||||
index 328fc606b..f9ad79619 100644
|
||||
--- a/criu/apparmor.c
|
||||
+++ b/criu/apparmor.c
|
||||
@@ -630,7 +630,7 @@ int suspend_aa(void)
|
||||
}
|
||||
|
||||
ret = do_suspend(true);
|
||||
- if (rm_rf(policydir) < 0)
|
||||
+ if (rmrf(policydir) < 0)
|
||||
pr_err("failed removing policy dir %s\n", policydir);
|
||||
|
||||
return ret;
|
||||
diff --git a/criu/include/util.h b/criu/include/util.h
|
||||
index a2dac2233..19d378fc5 100644
|
||||
--- a/criu/include/util.h
|
||||
+++ b/criu/include/util.h
|
||||
@@ -284,8 +284,8 @@ int setup_tcp_server(char *type, char *addr, unsigned short *port);
|
||||
int run_tcp_server(bool daemon_mode, int *ask, int cfd, int sk);
|
||||
int setup_tcp_client(char *hostname);
|
||||
|
||||
-/* *dir should be writable and at least PATH_MAX long */
|
||||
-int rm_rf(char *dir);
|
||||
+/* path should be writable and no more than PATH_MAX long */
|
||||
+int rmrf(char *path);
|
||||
|
||||
#define LAST_PID_PATH "sys/kernel/ns_last_pid"
|
||||
#define PID_MAX_PATH "sys/kernel/pid_max"
|
||||
diff --git a/criu/util.c b/criu/util.c
|
||||
index 06124c220..414879971 100644
|
||||
--- a/criu/util.c
|
||||
+++ b/criu/util.c
|
||||
@@ -1,4 +1,4 @@
|
||||
-#define _XOPEN_SOURCE
|
||||
+#define _XOPEN_SOURCE 500
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <sched.h>
|
||||
+#include <ftw.h>
|
||||
|
||||
#include "linux/mount.h"
|
||||
|
||||
@@ -1613,44 +1614,25 @@ ssize_t write_all(int fd, const void *buf, size_t size)
|
||||
return n;
|
||||
}
|
||||
|
||||
-int rm_rf(char *target)
|
||||
+static int remove_one(const char *fpath, const struct stat *sb, int tflag, struct FTW *ftwbuf)
|
||||
{
|
||||
- int offset = strlen(target);
|
||||
- DIR *dir = NULL;
|
||||
- struct dirent *de;
|
||||
- int ret = -1;
|
||||
+ int ret;
|
||||
|
||||
- dir = opendir(target);
|
||||
- if (!dir) {
|
||||
- pr_perror("unable to open %s", target);
|
||||
+ ret = remove(fpath);
|
||||
+ if (ret) {
|
||||
+ pr_perror("rmrf: unable to remove %s", fpath);
|
||||
return -1;
|
||||
}
|
||||
|
||||
- while ((de = readdir(dir))) {
|
||||
- int n;
|
||||
-
|
||||
- if (dir_dots(de))
|
||||
- continue;
|
||||
-
|
||||
- n = snprintf(target + offset, PATH_MAX - offset, "/%s", de->d_name);
|
||||
- if (n < 0 || n >= PATH_MAX) {
|
||||
- pr_err("snprintf failed\n");
|
||||
- goto out;
|
||||
- }
|
||||
-
|
||||
- if (de->d_type == DT_DIR && rm_rf(target))
|
||||
- goto out;
|
||||
+ return 0;
|
||||
+}
|
||||
|
||||
- if (remove(target) < 0) {
|
||||
- pr_perror("unable to remove %s", target);
|
||||
- goto out;
|
||||
- }
|
||||
- }
|
||||
+#define NFTW_FD_MAX 64
|
||||
|
||||
- ret = 0;
|
||||
-out:
|
||||
- target[offset] = 0;
|
||||
- return ret;
|
||||
+int rmrf(char *path)
|
||||
+{
|
||||
+ pr_debug("rmrf: removing %s\n", path);
|
||||
+ return nftw(path, remove_one, NFTW_FD_MAX, FTW_DEPTH | FTW_PHYS);
|
||||
}
|
||||
|
||||
__attribute__((returns_twice)) static pid_t raw_legacy_clone(unsigned long flags, int *pidfd)
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,37 +0,0 @@
|
||||
From 5002b2bedcdeac2e682f7995c9210fe351c6f818 Mon Sep 17 00:00:00 2001
|
||||
From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
|
||||
Date: Mon, 18 Oct 2021 18:43:14 +0300
|
||||
Subject: [PATCH 024/249] 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>
|
||||
---
|
||||
scripts/criu-ns | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/scripts/criu-ns b/scripts/criu-ns
|
||||
index d76db3606..72c0753e5 100755
|
||||
--- a/scripts/criu-ns
|
||||
+++ b/scripts/criu-ns
|
||||
@@ -102,6 +102,7 @@ def wrap_restore():
|
||||
|
||||
criu_pid = os.fork()
|
||||
if criu_pid == 0:
|
||||
+ os.setsid()
|
||||
_mount_new_proc()
|
||||
run_criu(restore_args)
|
||||
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,113 +0,0 @@
|
||||
From 23f4a75c65a08007e8c42aa71ceea4d32cebf9cd Mon Sep 17 00:00:00 2001
|
||||
From: Nicolas Viennot <Nicolas.Viennot@twosigma.com>
|
||||
Date: Thu, 28 Oct 2021 21:05:57 +0000
|
||||
Subject: [PATCH 025/249] 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>
|
||||
---
|
||||
criu/net.c | 51 ++++++++++++++++++---------------------------------
|
||||
1 file changed, 18 insertions(+), 33 deletions(-)
|
||||
|
||||
diff --git a/criu/net.c b/criu/net.c
|
||||
index 7b45f0633..02115c4de 100644
|
||||
--- a/criu/net.c
|
||||
+++ b/criu/net.c
|
||||
@@ -2250,12 +2250,12 @@ static int restore_ip_dump(int type, int pid, char *cmd)
|
||||
sockfd = img_raw_fd(img);
|
||||
if (sockfd < 0) {
|
||||
pr_err("Getting raw FD failed\n");
|
||||
- return -1;
|
||||
+ goto out_image;
|
||||
}
|
||||
tmp_file = tmpfile();
|
||||
if (!tmp_file) {
|
||||
pr_perror("Failed to open tmpfile");
|
||||
- return -1;
|
||||
+ goto out_image;
|
||||
}
|
||||
|
||||
while ((n = read(sockfd, buf, 1024)) > 0) {
|
||||
@@ -2264,25 +2264,34 @@ static int restore_ip_dump(int type, int pid, char *cmd)
|
||||
pr_perror("Failed to write to tmpfile "
|
||||
"[written: %d; total: %d]",
|
||||
written, n);
|
||||
- goto close;
|
||||
+ goto out_tmp_file;
|
||||
}
|
||||
}
|
||||
|
||||
if (fseek(tmp_file, 0, SEEK_SET)) {
|
||||
pr_perror("Failed to set file position to beginning of tmpfile");
|
||||
- goto close;
|
||||
+ goto out_tmp_file;
|
||||
}
|
||||
|
||||
- if (img) {
|
||||
- ret = run_ip_tool(cmd, "restore", NULL, NULL, fileno(tmp_file), -1, 0);
|
||||
- close_image(img);
|
||||
+ if (type == CR_FD_RULE) {
|
||||
+ /*
|
||||
+ * Delete 3 default rules to prevent duplicates. See kernel's
|
||||
+ * function fib_default_rules_init() for the details.
|
||||
+ */
|
||||
+ run_ip_tool("rule", "flush", NULL, NULL, -1, -1, 0);
|
||||
+ run_ip_tool("rule", "delete", "table", "local", -1, -1, 0);
|
||||
}
|
||||
|
||||
-close:
|
||||
+ ret = run_ip_tool(cmd, "restore", NULL, NULL, fileno(tmp_file), -1, 0);
|
||||
+
|
||||
+out_tmp_file:
|
||||
if (fclose(tmp_file)) {
|
||||
pr_perror("Failed to close tmpfile");
|
||||
}
|
||||
|
||||
+out_image:
|
||||
+ close_image(img);
|
||||
+
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -2304,31 +2313,7 @@ static inline int restore_route(int pid)
|
||||
|
||||
static inline int restore_rule(int pid)
|
||||
{
|
||||
- struct cr_img *img;
|
||||
- int ret = 0;
|
||||
-
|
||||
- img = open_image(CR_FD_RULE, O_RSTR, pid);
|
||||
- if (!img) {
|
||||
- ret = -1;
|
||||
- goto out;
|
||||
- }
|
||||
-
|
||||
- if (empty_image(img))
|
||||
- goto close;
|
||||
-
|
||||
- /*
|
||||
- * Delete 3 default rules to prevent duplicates. See kernel's
|
||||
- * function fib_default_rules_init() for the details.
|
||||
- */
|
||||
- run_ip_tool("rule", "flush", NULL, NULL, -1, -1, 0);
|
||||
- run_ip_tool("rule", "delete", "table", "local", -1, -1, 0);
|
||||
-
|
||||
- if (restore_ip_dump(CR_FD_RULE, pid, "rule"))
|
||||
- ret = -1;
|
||||
-close:
|
||||
- close_image(img);
|
||||
-out:
|
||||
- return ret;
|
||||
+ return restore_ip_dump(CR_FD_RULE, pid, "rule");
|
||||
}
|
||||
|
||||
/*
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,45 +0,0 @@
|
||||
From 3920fd02a3494c5888083967a3054d8569866b4a Mon Sep 17 00:00:00 2001
|
||||
From: Adrian Reber <areber@redhat.com>
|
||||
Date: Wed, 27 Oct 2021 07:27:22 +0000
|
||||
Subject: [PATCH 026/249] 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>
|
||||
---
|
||||
.github/workflows/gcov-test.yml | 2 ++
|
||||
Makefile | 4 +++-
|
||||
2 files changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/.github/workflows/gcov-test.yml b/.github/workflows/gcov-test.yml
|
||||
index f1b38e77e..f782c5b9d 100644
|
||||
--- a/.github/workflows/gcov-test.yml
|
||||
+++ b/.github/workflows/gcov-test.yml
|
||||
@@ -10,5 +10,7 @@ jobs:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Run Coverage Tests
|
||||
run: sudo -E make -C scripts/ci local GCOV=1
|
||||
+ - name: Run gcov
|
||||
+ run: sudo -E find . -name '*gcda' -type f -print0 | sudo -E xargs --null --max-args 128 --max-procs 4 gcov
|
||||
- name: Run Coverage Analysis
|
||||
run: sudo -E make codecov
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 1f0dec78b..c0b8b7e54 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -431,7 +431,9 @@ lint:
|
||||
|
||||
codecov: SHELL := $(shell which bash)
|
||||
codecov:
|
||||
- bash <(curl -s https://codecov.io/bash)
|
||||
+ curl -Os https://uploader.codecov.io/latest/linux/codecov
|
||||
+ chmod +x codecov
|
||||
+ ./codecov
|
||||
.PHONY: codecov
|
||||
|
||||
fetch-clang-format: .FORCE
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,36 +0,0 @@
|
||||
From 9dcf2c5116dcdac8b5ef99bf995cf5cfe6424c92 Mon Sep 17 00:00:00 2001
|
||||
From: Adrian Reber <areber@redhat.com>
|
||||
Date: Thu, 4 Nov 2021 09:10:38 +0000
|
||||
Subject: [PATCH 027/249] 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>
|
||||
---
|
||||
scripts/ci/run-ci-tests.sh | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/scripts/ci/run-ci-tests.sh b/scripts/ci/run-ci-tests.sh
|
||||
index 51aa7db9e..096f907fb 100755
|
||||
--- a/scripts/ci/run-ci-tests.sh
|
||||
+++ b/scripts/ci/run-ci-tests.sh
|
||||
@@ -197,6 +197,12 @@ fi
|
||||
# shellcheck disable=SC2086
|
||||
./test/zdtm.py run -a -p 2 --keep-going $ZDTM_OPTS
|
||||
|
||||
+# Newer kernels are blocking access to userfaultfd:
|
||||
+# uffd: Set unprivileged_userfaultfd sysctl knob to 1 if kernel faults must be handled without obtaining CAP_SYS_PTRACE capability
|
||||
+if [ -e /proc/sys/vm/unprivileged_userfaultfd ]; then
|
||||
+ echo 1 > /proc/sys/vm/unprivileged_userfaultfd
|
||||
+fi
|
||||
+
|
||||
LAZY_EXCLUDE="-x maps04 -x cmdlinenv00 -x maps007"
|
||||
|
||||
LAZY_TESTS='.*(maps0|uffd-events|lazy-thp|futex|fork).*'
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,29 +0,0 @@
|
||||
From fa1ec35f42dd652ff57a9c816b11359eae38ddcf Mon Sep 17 00:00:00 2001
|
||||
From: Adrian Reber <areber@redhat.com>
|
||||
Date: Thu, 4 Nov 2021 09:18:31 +0000
|
||||
Subject: [PATCH 028/249] 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>
|
||||
---
|
||||
.github/workflows/lint.yml | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
|
||||
index 50b241e9f..49eb6aaac 100644
|
||||
--- a/.github/workflows/lint.yml
|
||||
+++ b/.github/workflows/lint.yml
|
||||
@@ -6,7 +6,7 @@ jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
- image: registry.fedoraproject.org/fedora:latest
|
||||
+ image: registry.fedoraproject.org/fedora:34
|
||||
steps:
|
||||
- name: Install tools
|
||||
run: sudo dnf -y install git make python3-flake8 ShellCheck clang-tools-extra which findutils
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,145 +0,0 @@
|
||||
From ff5beb22edc05bad44a1e6aecc4433212c991ed6 Mon Sep 17 00:00:00 2001
|
||||
From: Nicolas Viennot <Nicolas.Viennot@twosigma.com>
|
||||
Date: Fri, 29 Oct 2021 02:49:31 +0000
|
||||
Subject: [PATCH 029/249] 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>
|
||||
---
|
||||
test/zdtm.py | 44 ++++++++++++++++++++++++++++++++++----------
|
||||
1 file changed, 34 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/test/zdtm.py b/test/zdtm.py
|
||||
index 0a52e1b96..fc7b8a183 100755
|
||||
--- a/test/zdtm.py
|
||||
+++ b/test/zdtm.py
|
||||
@@ -1039,6 +1039,7 @@ class criu:
|
||||
self.__lazy_pages_p = None
|
||||
self.__page_server_p = None
|
||||
self.__dump_process = None
|
||||
+ self.__img_streamer_process = None
|
||||
self.__tls = self.__tls_options() if opts['tls'] else []
|
||||
self.__criu_bin = opts['criu_bin']
|
||||
self.__crit_bin = opts['crit_bin']
|
||||
@@ -1065,6 +1066,11 @@ class criu:
|
||||
self.__dump_process = None
|
||||
if ret:
|
||||
raise test_fail_exc("criu dump exited with %s" % ret)
|
||||
+ if self.__img_streamer_process:
|
||||
+ ret = self.wait_for_criu_image_streamer()
|
||||
+ if ret:
|
||||
+ raise test_fail_exc("criu-image-streamer exited with %s" % ret)
|
||||
+
|
||||
return
|
||||
|
||||
def logs(self):
|
||||
@@ -1219,8 +1225,10 @@ class criu:
|
||||
stent['pages_written'])
|
||||
|
||||
if self.__stream:
|
||||
- p = self.spawn_criu_image_streamer("extract")
|
||||
- p.wait()
|
||||
+ self.spawn_criu_image_streamer("extract")
|
||||
+ ret = self.wait_for_criu_image_streamer()
|
||||
+ if ret:
|
||||
+ raise test_fail_exc("criu-image-streamer (extract) exited with %s" % ret)
|
||||
|
||||
real_written = 0
|
||||
for f in os.listdir(self.__ddir()):
|
||||
@@ -1262,6 +1270,8 @@ class criu:
|
||||
"--progress-fd {progress_fd}",
|
||||
action]
|
||||
|
||||
+ log = open(os.path.join(self.__ddir(), "img-streamer.log"), "w")
|
||||
+
|
||||
# * As we are using a shell pipe command, we want to use pipefail.
|
||||
# Otherwise, failures stay unnoticed. For this, we use bash as sh
|
||||
# doesn't support that feature.
|
||||
@@ -1270,7 +1280,9 @@ class criu:
|
||||
progress_fd=progress_w,
|
||||
images_dir=self.__ddir(),
|
||||
img_file=os.path.join(self.__ddir(), STREAMED_IMG_FILE_NAME)
|
||||
- )], close_fds=False)
|
||||
+ )], stderr=log, close_fds=False)
|
||||
+
|
||||
+ log.close()
|
||||
|
||||
os.close(progress_w)
|
||||
progress = os.fdopen(progress_r, "r")
|
||||
@@ -1287,7 +1299,15 @@ class criu:
|
||||
raise test_fail_exc(
|
||||
"criu-image-streamer is not starting (exit_code=%d)" % p.wait())
|
||||
|
||||
- return p
|
||||
+ progress.close()
|
||||
+
|
||||
+ self.__img_streamer_process = p
|
||||
+
|
||||
+ def wait_for_criu_image_streamer(self):
|
||||
+ ret = self.__img_streamer_process.wait()
|
||||
+ grep_errors(os.path.join(self.__ddir(), "img-streamer.log"))
|
||||
+ self.__img_streamer_process = None
|
||||
+ return ret
|
||||
|
||||
def dump(self, action, opts=[]):
|
||||
self.__iter += 1
|
||||
@@ -1319,7 +1339,7 @@ class criu:
|
||||
a_opts += self.__test.getdopts()
|
||||
|
||||
if self.__stream:
|
||||
- streamer_p = self.spawn_criu_image_streamer("capture")
|
||||
+ self.spawn_criu_image_streamer("capture")
|
||||
a_opts += ["--stream"]
|
||||
|
||||
if self.__dedup:
|
||||
@@ -1347,9 +1367,9 @@ class criu:
|
||||
opts=a_opts + opts,
|
||||
nowait=nowait)
|
||||
if self.__stream:
|
||||
- ret = streamer_p.wait()
|
||||
+ ret = self.wait_for_criu_image_streamer()
|
||||
if ret:
|
||||
- raise test_fail_exc("criu-image-streamer exited with %d" % ret)
|
||||
+ raise test_fail_exc("criu-image-streamer (capture) exited with %d" % ret)
|
||||
|
||||
if self.__mdedup and self.__iter > 1:
|
||||
self.__criu_act("dedup", opts=[])
|
||||
@@ -1382,7 +1402,7 @@ class criu:
|
||||
r_opts += ['--action-script', os.getcwd() + '/empty-netns-prep.sh']
|
||||
|
||||
if self.__stream:
|
||||
- streamer_p = self.spawn_criu_image_streamer("serve")
|
||||
+ self.spawn_criu_image_streamer("serve")
|
||||
r_opts += ["--stream"]
|
||||
|
||||
if self.__dedup:
|
||||
@@ -1419,9 +1439,9 @@ class criu:
|
||||
|
||||
self.__criu_act("restore", opts=r_opts + ["--restore-detached"])
|
||||
if self.__stream:
|
||||
- ret = streamer_p.wait()
|
||||
+ ret = self.wait_for_criu_image_streamer()
|
||||
if ret:
|
||||
- raise test_fail_exc("criu-image-streamer exited with %d" % ret)
|
||||
+ raise test_fail_exc("criu-image-streamer (serve) exited with %d" % ret)
|
||||
|
||||
self.show_stats("restore")
|
||||
|
||||
@@ -1466,6 +1486,10 @@ class criu:
|
||||
print("criu dump exited with %s" % self.__dump_process.wait())
|
||||
grep_errors(os.path.join(self.__ddir(), "dump.log"))
|
||||
self.__dump_process = None
|
||||
+ if self.__img_streamer_process:
|
||||
+ self.__img_streamer_process.terminate()
|
||||
+ ret = self.wait_for_criu_image_streamer()
|
||||
+ print("criu-image-streamer exited with %s" % ret)
|
||||
|
||||
|
||||
def try_run_hook(test, args):
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,32 +0,0 @@
|
||||
From 36869e72971182f0e738edb7174a4505dcc5380c Mon Sep 17 00:00:00 2001
|
||||
From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
|
||||
Date: Thu, 29 Jul 2021 14:21:37 +0300
|
||||
Subject: [PATCH 030/249] 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>
|
||||
---
|
||||
criu/sockets.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/criu/sockets.c b/criu/sockets.c
|
||||
index 9426b5b94..65aa82950 100644
|
||||
--- a/criu/sockets.c
|
||||
+++ b/criu/sockets.c
|
||||
@@ -517,7 +517,7 @@ int restore_socket_opts(int sk, SkOptsEntry *soe)
|
||||
pr_info("%d restore sndbuf %d rcv buf %d\n", sk, soe->so_sndbuf, soe->so_rcvbuf);
|
||||
|
||||
/* setsockopt() multiplies the input values by 2 */
|
||||
- ret |= userns_call(sk_setbufs, UNS_ASYNC, bufs, sizeof(bufs), sk);
|
||||
+ ret |= userns_call(sk_setbufs, 0, bufs, sizeof(bufs), sk);
|
||||
|
||||
if (soe->has_so_priority) {
|
||||
pr_debug("\trestore priority %d for socket\n", soe->so_priority);
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,132 +0,0 @@
|
||||
From f00d0d2c8cca8217eaaccf08605192cc3f12503b Mon Sep 17 00:00:00 2001
|
||||
From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
|
||||
Date: Thu, 29 Jul 2021 14:57:17 +0300
|
||||
Subject: [PATCH 031/249] 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>
|
||||
---
|
||||
criu/cr-check.c | 10 ++++++++++
|
||||
criu/include/kerndat.h | 1 +
|
||||
criu/include/sockets.h | 4 ++++
|
||||
criu/kerndat.c | 33 +++++++++++++++++++++++++++++++++
|
||||
4 files changed, 48 insertions(+)
|
||||
|
||||
diff --git a/criu/cr-check.c b/criu/cr-check.c
|
||||
index 3575fb3b3..3e268c439 100644
|
||||
--- a/criu/cr-check.c
|
||||
+++ b/criu/cr-check.c
|
||||
@@ -1372,6 +1372,14 @@ static int check_network_lock_nftables(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int check_sockopt_buf_lock(void)
|
||||
+{
|
||||
+ if (!kdat.has_sockopt_buf_lock)
|
||||
+ return -1;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static int (*chk_feature)(void);
|
||||
|
||||
/*
|
||||
@@ -1490,6 +1498,7 @@ int cr_check(void)
|
||||
ret |= check_ns_pid();
|
||||
ret |= check_apparmor_stacking();
|
||||
ret |= check_network_lock_nftables();
|
||||
+ ret |= check_sockopt_buf_lock();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1602,6 +1611,7 @@ static struct feature_list feature_list[] = {
|
||||
{ "ns_pid", check_ns_pid },
|
||||
{ "apparmor_stacking", check_apparmor_stacking },
|
||||
{ "network_lock_nftables", check_network_lock_nftables },
|
||||
+ { "sockopt_buf_lock", check_sockopt_buf_lock },
|
||||
{ NULL, NULL },
|
||||
};
|
||||
|
||||
diff --git a/criu/include/kerndat.h b/criu/include/kerndat.h
|
||||
index 80bad7f11..2ded7d1da 100644
|
||||
--- a/criu/include/kerndat.h
|
||||
+++ b/criu/include/kerndat.h
|
||||
@@ -74,6 +74,7 @@ struct kerndat_s {
|
||||
bool has_pidfd_getfd;
|
||||
bool has_nspid;
|
||||
bool has_nftables_concat;
|
||||
+ bool has_sockopt_buf_lock;
|
||||
};
|
||||
|
||||
extern struct kerndat_s kdat;
|
||||
diff --git a/criu/include/sockets.h b/criu/include/sockets.h
|
||||
index 3e8f3d601..399d38664 100644
|
||||
--- a/criu/include/sockets.h
|
||||
+++ b/criu/include/sockets.h
|
||||
@@ -123,4 +123,8 @@ extern const char *socket_proto_name(unsigned int proto, char *nm, size_t size);
|
||||
#define ___socket_family_name(family) __socket_info_helper(socket_family_name, family)
|
||||
#define ___socket_proto_name(proto) __socket_info_helper(socket_proto_name, proto)
|
||||
|
||||
+#ifndef SO_BUF_LOCK
|
||||
+#define SO_BUF_LOCK 72
|
||||
+#endif
|
||||
+
|
||||
#endif /* __CR_SOCKETS_H__ */
|
||||
diff --git a/criu/kerndat.c b/criu/kerndat.c
|
||||
index 0e88ba43e..9f6a6ec42 100644
|
||||
--- a/criu/kerndat.c
|
||||
+++ b/criu/kerndat.c
|
||||
@@ -816,6 +816,35 @@ static int kerndat_x86_has_ptrace_fpu_xsave_bug(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+int kerndat_sockopt_buf_lock(void)
|
||||
+{
|
||||
+ int exit_code = -1;
|
||||
+ socklen_t len;
|
||||
+ u32 buf_lock;
|
||||
+ int sock;
|
||||
+
|
||||
+ sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
+ if (sock < 0) {
|
||||
+ pr_perror("Unable to create a socket");
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ len = sizeof(buf_lock);
|
||||
+ if (getsockopt(sock, SOL_SOCKET, SO_BUF_LOCK, &buf_lock, &len)) {
|
||||
+ if (errno != ENOPROTOOPT) {
|
||||
+ pr_perror("Unable to get SO_BUF_LOCK with getsockopt");
|
||||
+ goto err;
|
||||
+ }
|
||||
+ kdat.has_sockopt_buf_lock = false;
|
||||
+ } else
|
||||
+ kdat.has_sockopt_buf_lock = true;
|
||||
+
|
||||
+ exit_code = 0;
|
||||
+err:
|
||||
+ close(sock);
|
||||
+ return exit_code;
|
||||
+}
|
||||
+
|
||||
#define KERNDAT_CACHE_FILE KDAT_RUNDIR "/criu.kdat"
|
||||
#define KERNDAT_CACHE_FILE_TMP KDAT_RUNDIR "/.criu.kdat"
|
||||
|
||||
@@ -1359,6 +1388,10 @@ int kerndat_init(void)
|
||||
pr_err("kerndat_has_nftables_concat failed when initializing kerndat.\n");
|
||||
ret = -1;
|
||||
}
|
||||
+ if (!ret && kerndat_sockopt_buf_lock()) {
|
||||
+ pr_err("kerndat_sockopt_buf_lock failed when initializing kerndat.\n");
|
||||
+ ret = -1;
|
||||
+ }
|
||||
|
||||
kerndat_lsm();
|
||||
kerndat_mmap_min_addr();
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,69 +0,0 @@
|
||||
From 4bad0745c28810a2d2bb724b5d13b70d07545ae4 Mon Sep 17 00:00:00 2001
|
||||
From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
|
||||
Date: Thu, 29 Jul 2021 11:27:13 +0300
|
||||
Subject: [PATCH 032/249] 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>
|
||||
---
|
||||
criu/sockets.c | 8 ++++++++
|
||||
images/sk-opts.proto | 2 ++
|
||||
2 files changed, 10 insertions(+)
|
||||
|
||||
diff --git a/criu/sockets.c b/criu/sockets.c
|
||||
index 65aa82950..db772707b 100644
|
||||
--- a/criu/sockets.c
|
||||
+++ b/criu/sockets.c
|
||||
@@ -519,6 +519,10 @@ int restore_socket_opts(int sk, SkOptsEntry *soe)
|
||||
/* setsockopt() multiplies the input values by 2 */
|
||||
ret |= userns_call(sk_setbufs, 0, bufs, sizeof(bufs), sk);
|
||||
|
||||
+ if (soe->has_so_buf_lock) {
|
||||
+ pr_debug("\trestore buf_lock %d for socket\n", soe->so_buf_lock);
|
||||
+ ret |= restore_opt(sk, SOL_SOCKET, SO_BUF_LOCK, &soe->so_buf_lock);
|
||||
+ }
|
||||
if (soe->has_so_priority) {
|
||||
pr_debug("\trestore priority %d for socket\n", soe->so_priority);
|
||||
ret |= restore_opt(sk, SOL_SOCKET, SO_PRIORITY, &soe->so_priority);
|
||||
@@ -619,6 +623,10 @@ int dump_socket_opts(int sk, SkOptsEntry *soe)
|
||||
|
||||
ret |= dump_opt(sk, SOL_SOCKET, SO_SNDBUF, &soe->so_sndbuf);
|
||||
ret |= dump_opt(sk, SOL_SOCKET, SO_RCVBUF, &soe->so_rcvbuf);
|
||||
+ if (kdat.has_sockopt_buf_lock) {
|
||||
+ soe->has_so_buf_lock = true;
|
||||
+ ret |= dump_opt(sk, SOL_SOCKET, SO_BUF_LOCK, &soe->so_buf_lock);
|
||||
+ }
|
||||
soe->has_so_priority = true;
|
||||
ret |= dump_opt(sk, SOL_SOCKET, SO_PRIORITY, &soe->so_priority);
|
||||
soe->has_so_rcvlowat = true;
|
||||
diff --git a/images/sk-opts.proto b/images/sk-opts.proto
|
||||
index 2377f6b62..1d24d47cc 100644
|
||||
--- a/images/sk-opts.proto
|
||||
+++ b/images/sk-opts.proto
|
||||
@@ -31,6 +31,8 @@ message sk_opts_entry {
|
||||
optional uint32 tcp_keepintvl = 22;
|
||||
optional uint32 so_oobinline = 23;
|
||||
optional uint32 so_linger = 24;
|
||||
+
|
||||
+ optional uint32 so_buf_lock = 25;
|
||||
}
|
||||
|
||||
enum sk_shutdown {
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,118 +0,0 @@
|
||||
From e32a58fcc35b57d6cbc81214e7c4d8f8539dbc5a Mon Sep 17 00:00:00 2001
|
||||
From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
|
||||
Date: Thu, 29 Jul 2021 16:16:12 +0300
|
||||
Subject: [PATCH 033/249] 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>
|
||||
---
|
||||
test/zdtm/static/Makefile | 1 +
|
||||
test/zdtm/static/sock_opts02.c | 73 +++++++++++++++++++++++++++++++
|
||||
test/zdtm/static/sock_opts02.desc | 1 +
|
||||
3 files changed, 75 insertions(+)
|
||||
create mode 100644 test/zdtm/static/sock_opts02.c
|
||||
create mode 100644 test/zdtm/static/sock_opts02.desc
|
||||
|
||||
diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile
|
||||
index b6aa621c7..3e1e0a498 100644
|
||||
--- a/test/zdtm/static/Makefile
|
||||
+++ b/test/zdtm/static/Makefile
|
||||
@@ -117,6 +117,7 @@ TST_NOFILE := \
|
||||
socket-linger \
|
||||
sock_opts00 \
|
||||
sock_opts01 \
|
||||
+ sock_opts02 \
|
||||
sk-unix-unconn \
|
||||
ipc_namespace \
|
||||
selfexe00 \
|
||||
diff --git a/test/zdtm/static/sock_opts02.c b/test/zdtm/static/sock_opts02.c
|
||||
new file mode 100644
|
||||
index 000000000..21a81a28f
|
||||
--- /dev/null
|
||||
+++ b/test/zdtm/static/sock_opts02.c
|
||||
@@ -0,0 +1,73 @@
|
||||
+#include <stdio.h>
|
||||
+#include <unistd.h>
|
||||
+#include <sys/types.h>
|
||||
+#include <sys/socket.h>
|
||||
+#include <netinet/in.h>
|
||||
+
|
||||
+#include "zdtmtst.h"
|
||||
+
|
||||
+const char *test_doc = "Check that SO_BUF_LOCK option dumped";
|
||||
+const char *test_author = "Pavel Tikhomirov <ptikhomirov@virtuozzo.com>";
|
||||
+
|
||||
+#ifndef SO_BUF_LOCK
|
||||
+#define SO_BUF_LOCK 72
|
||||
+#endif
|
||||
+
|
||||
+#define NSOCK 4
|
||||
+
|
||||
+int main(int argc, char **argv)
|
||||
+{
|
||||
+ int sock[NSOCK];
|
||||
+ uint32_t val[NSOCK];
|
||||
+ int ret, i;
|
||||
+ int exit_code = 1;
|
||||
+
|
||||
+ test_init(argc, argv);
|
||||
+
|
||||
+ for (i = 0; i < NSOCK; i++) {
|
||||
+ sock[i] = -1;
|
||||
+ val[i] = i;
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < NSOCK; i++) {
|
||||
+ sock[i] = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
+ if (sock[i] < 0) {
|
||||
+ pr_perror("can't create socket %d", i);
|
||||
+ goto err;
|
||||
+ }
|
||||
+
|
||||
+ ret = setsockopt(sock[i], SOL_SOCKET, SO_BUF_LOCK, &val[i], sizeof(val[i]));
|
||||
+ if (ret < 0) {
|
||||
+ pr_perror("can't set SO_BUF_LOCK (%u) on socket %d", val[i], i);
|
||||
+ goto err;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ test_daemon();
|
||||
+ test_waitsig();
|
||||
+
|
||||
+ for (i = 0; i < NSOCK; i++) {
|
||||
+ uint32_t tmp;
|
||||
+ socklen_t len;
|
||||
+
|
||||
+ len = sizeof(tmp);
|
||||
+ ret = getsockopt(sock[i], SOL_SOCKET, SO_BUF_LOCK, &tmp, &len);
|
||||
+ if (ret < 0) {
|
||||
+ pr_perror("can't get SO_BUF_LOCK from socket %d", i);
|
||||
+ goto err;
|
||||
+ }
|
||||
+
|
||||
+ if (tmp != val[i]) {
|
||||
+ fail("SO_BUF_LOCK missmatch %u != %u", tmp, val[i]);
|
||||
+ goto err;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ pass();
|
||||
+ exit_code = 0;
|
||||
+err:
|
||||
+ for (i = 0; i < NSOCK; i++)
|
||||
+ close(sock[i]);
|
||||
+
|
||||
+ return exit_code;
|
||||
+}
|
||||
diff --git a/test/zdtm/static/sock_opts02.desc b/test/zdtm/static/sock_opts02.desc
|
||||
new file mode 100644
|
||||
index 000000000..37d3a6354
|
||||
--- /dev/null
|
||||
+++ b/test/zdtm/static/sock_opts02.desc
|
||||
@@ -0,0 +1 @@
|
||||
+{'flags': 'suid', 'feature': 'sockopt_buf_lock'}
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,115 +0,0 @@
|
||||
From 46b0f54fe43b128e4949b2522450b519d20a5fc4 Mon Sep 17 00:00:00 2001
|
||||
From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
|
||||
Date: Tue, 3 Aug 2021 13:05:32 +0300
|
||||
Subject: [PATCH 034/249] 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>
|
||||
---
|
||||
test/zdtm/static/sock_opts02.c | 63 +++++++++++++++++++++++++++++-----
|
||||
1 file changed, 54 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/test/zdtm/static/sock_opts02.c b/test/zdtm/static/sock_opts02.c
|
||||
index 21a81a28f..7ea98744a 100644
|
||||
--- a/test/zdtm/static/sock_opts02.c
|
||||
+++ b/test/zdtm/static/sock_opts02.c
|
||||
@@ -13,32 +13,77 @@ const char *test_author = "Pavel Tikhomirov <ptikhomirov@virtuozzo.com>";
|
||||
#define SO_BUF_LOCK 72
|
||||
#endif
|
||||
|
||||
-#define NSOCK 4
|
||||
+#ifndef SOCK_SNDBUF_LOCK
|
||||
+#define SOCK_SNDBUF_LOCK 1
|
||||
+#endif
|
||||
+#ifndef SOCK_RCVBUF_LOCK
|
||||
+#define SOCK_RCVBUF_LOCK 2
|
||||
+#endif
|
||||
+
|
||||
+#define BUFSIZE 16384
|
||||
+
|
||||
+struct sk_opt {
|
||||
+ int type;
|
||||
+ uint32_t val;
|
||||
+ uint32_t lock;
|
||||
+} sk_opts[] = { { SO_BUF_LOCK, 0, 0 },
|
||||
+ { SO_BUF_LOCK, SOCK_SNDBUF_LOCK, SOCK_SNDBUF_LOCK },
|
||||
+ { SO_BUF_LOCK, SOCK_RCVBUF_LOCK, SOCK_RCVBUF_LOCK },
|
||||
+ { SO_BUF_LOCK, SOCK_SNDBUF_LOCK | SOCK_RCVBUF_LOCK, SOCK_SNDBUF_LOCK | SOCK_RCVBUF_LOCK },
|
||||
+ { SO_SNDBUF, BUFSIZE, SOCK_SNDBUF_LOCK },
|
||||
+ { SO_RCVBUF, BUFSIZE, SOCK_RCVBUF_LOCK } };
|
||||
+
|
||||
+#define NSOCK ARRAY_SIZE(sk_opts)
|
||||
+
|
||||
+char *type_to_str(int type)
|
||||
+{
|
||||
+ switch (type) {
|
||||
+ case SO_BUF_LOCK:
|
||||
+ return "SO_BUF_LOCK";
|
||||
+ case SO_SNDBUFFORCE:
|
||||
+ return "SO_SNDBUFFORCE";
|
||||
+ case SO_RCVBUFFORCE:
|
||||
+ return "SO_RCVBUFFORCE";
|
||||
+ }
|
||||
+ return NULL;
|
||||
+}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int sock[NSOCK];
|
||||
- uint32_t val[NSOCK];
|
||||
int ret, i;
|
||||
int exit_code = 1;
|
||||
|
||||
test_init(argc, argv);
|
||||
|
||||
- for (i = 0; i < NSOCK; i++) {
|
||||
+ for (i = 0; i < NSOCK; i++)
|
||||
sock[i] = -1;
|
||||
- val[i] = i;
|
||||
- }
|
||||
|
||||
for (i = 0; i < NSOCK; i++) {
|
||||
+ uint32_t tmp;
|
||||
+ socklen_t len;
|
||||
+
|
||||
sock[i] = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
if (sock[i] < 0) {
|
||||
pr_perror("can't create socket %d", i);
|
||||
goto err;
|
||||
}
|
||||
|
||||
- ret = setsockopt(sock[i], SOL_SOCKET, SO_BUF_LOCK, &val[i], sizeof(val[i]));
|
||||
+ ret = setsockopt(sock[i], SOL_SOCKET, sk_opts[i].type, &sk_opts[i].val, sizeof(sk_opts[i].val));
|
||||
+ if (ret < 0) {
|
||||
+ pr_perror("can't set %s (%u) on socket %d", type_to_str(sk_opts[i].type), sk_opts[i].val, i);
|
||||
+ goto err;
|
||||
+ }
|
||||
+
|
||||
+ len = sizeof(tmp);
|
||||
+ ret = getsockopt(sock[i], SOL_SOCKET, SO_BUF_LOCK, &tmp, &len);
|
||||
if (ret < 0) {
|
||||
- pr_perror("can't set SO_BUF_LOCK (%u) on socket %d", val[i], i);
|
||||
+ pr_perror("can't get SO_BUF_LOCK from socket %d", i);
|
||||
+ goto err;
|
||||
+ }
|
||||
+
|
||||
+ if (tmp != sk_opts[i].lock) {
|
||||
+ fail("SO_BUF_LOCK missmatch %u != %u", tmp, sk_opts[i].lock);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
@@ -57,8 +102,8 @@ int main(int argc, char **argv)
|
||||
goto err;
|
||||
}
|
||||
|
||||
- if (tmp != val[i]) {
|
||||
- fail("SO_BUF_LOCK missmatch %u != %u", tmp, val[i]);
|
||||
+ if (tmp != sk_opts[i].lock) {
|
||||
+ fail("SO_BUF_LOCK missmatch %u != %u", tmp, sk_opts[i].lock);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,173 +0,0 @@
|
||||
From ff3ff3b94a45d6907e0d3c6fb850cf3d729ce252 Mon Sep 17 00:00:00 2001
|
||||
From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
|
||||
Date: Thu, 28 Oct 2021 17:15:52 +0300
|
||||
Subject: [PATCH 035/249] 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>
|
||||
---
|
||||
.clang-format | 2 +-
|
||||
scripts/fetch-clang-format.sh | 1 +
|
||||
2 files changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/.clang-format b/.clang-format
|
||||
index dd4ade370..96ba5909f 100644
|
||||
--- a/.clang-format
|
||||
+++ b/.clang-format
|
||||
@@ -15,7 +15,7 @@ AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveDeclarations: false
|
||||
AlignEscapedNewlines: Left # Unknown to clang-format-4.0
|
||||
AlignOperands: true
|
||||
-AlignTrailingComments: false
|
||||
+AlignTrailingComments: true
|
||||
AlignConsecutiveMacros: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
diff --git a/scripts/fetch-clang-format.sh b/scripts/fetch-clang-format.sh
|
||||
index c9006c518..0e9545f2d 100755
|
||||
--- a/scripts/fetch-clang-format.sh
|
||||
+++ b/scripts/fetch-clang-format.sh
|
||||
@@ -12,4 +12,5 @@ curl -s "${URL}" | sed -e "
|
||||
s,Intended for clang-format >= 4,Intended for clang-format >= 11,g;
|
||||
s,ForEachMacros:,ForEachMacros:\n - 'for_each_pstree_item',g;
|
||||
s,\(AlignTrailingComments:.*\)$,\1\nAlignConsecutiveMacros: true,g;
|
||||
+ s,AlignTrailingComments: false,AlignTrailingComments: true,g;
|
||||
" > .clang-format
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,169 +0,0 @@
|
||||
From f8018e956406b88a9bc170354229b5ec40570fef Mon Sep 17 00:00:00 2001
|
||||
From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
|
||||
Date: Thu, 28 Oct 2021 17:17:44 +0300
|
||||
Subject: [PATCH 036/249] 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>
|
||||
---
|
||||
criu/include/files.h | 10 +++++-----
|
||||
criu/include/page-pipe.h | 6 ++----
|
||||
criu/include/pagemap.h | 19 ++++++++----------
|
||||
criu/include/pipes.h | 4 ++--
|
||||
criu/shmem.c | 3 ++-
|
||||
test/zdtm/static/ipc_namespace.c | 33 ++++++++++++++++----------------
|
||||
6 files changed, 36 insertions(+), 39 deletions(-)
|
||||
|
||||
diff --git a/criu/include/files.h b/criu/include/files.h
|
||||
index 96face71b..26ce1f42a 100644
|
||||
--- a/criu/include/files.h
|
||||
+++ b/criu/include/files.h
|
||||
@@ -121,12 +121,12 @@ unsigned int find_unused_fd(struct pstree_item *, int hint_fd);
|
||||
struct fdinfo_list_entry *find_used_fd(struct pstree_item *, int fd);
|
||||
|
||||
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 */
|
||||
+ 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 */
|
||||
+ * have a fle in a task, that having permissions */
|
||||
};
|
||||
|
||||
struct fdtype_ops {
|
||||
diff --git a/criu/include/page-pipe.h b/criu/include/page-pipe.h
|
||||
index a5f97678e..0917869d9 100644
|
||||
--- a/criu/include/page-pipe.h
|
||||
+++ b/criu/include/page-pipe.h
|
||||
@@ -130,10 +130,8 @@ struct page_pipe {
|
||||
unsigned int flags; /* PP_FOO flags below */
|
||||
};
|
||||
|
||||
-#define PP_CHUNK_MODE \
|
||||
- 0x1 /* Restrict the maximum buffer size of pipes
|
||||
- and dump memory for a few iterations */
|
||||
-#define PP_OWN_IOVS 0x4 /* create_page_pipe allocated IOVs memory */
|
||||
+#define PP_CHUNK_MODE 0x1 /* Restrict the maximum buffer size of pipes and dump memory for a few iterations */
|
||||
+#define PP_OWN_IOVS 0x4 /* create_page_pipe allocated IOVs memory */
|
||||
|
||||
struct page_pipe *create_page_pipe(unsigned int nr_segs, struct iovec *iovs, unsigned flags);
|
||||
extern void destroy_page_pipe(struct page_pipe *p);
|
||||
diff --git a/criu/include/pagemap.h b/criu/include/pagemap.h
|
||||
index c39c25d0c..8c7180559 100644
|
||||
--- a/criu/include/pagemap.h
|
||||
+++ b/criu/include/pagemap.h
|
||||
@@ -63,17 +63,14 @@ struct page_read {
|
||||
struct cr_img *pi;
|
||||
u32 pages_img_id;
|
||||
|
||||
- PagemapEntry *pe; /* current pagemap we are on */
|
||||
- struct page_read *parent; /* parent pagemap (if ->in_parent
|
||||
- pagemap is met in image, then
|
||||
- go to this guy for page, see
|
||||
- read_pagemap_page */
|
||||
- unsigned long cvaddr; /* vaddr we are on */
|
||||
- off_t pi_off; /* current offset in pages file */
|
||||
-
|
||||
- struct iovec bunch; /* record consequent neighbour
|
||||
- iovecs to punch together */
|
||||
- unsigned id; /* for logging */
|
||||
+ PagemapEntry *pe; /* current pagemap we are on */
|
||||
+ struct page_read *parent; /* parent pagemap (if ->in_parent pagemap is met in image,
|
||||
+ * then go to this guy for page, see read_pagemap_page */
|
||||
+ unsigned long cvaddr; /* vaddr we are on */
|
||||
+ off_t pi_off; /* current offset in pages file */
|
||||
+
|
||||
+ struct iovec bunch; /* record consequent neighbour iovecs to punch together */
|
||||
+ unsigned id; /* for logging */
|
||||
unsigned long img_id; /* pagemap image file ID */
|
||||
|
||||
PagemapEntry **pmes;
|
||||
diff --git a/criu/include/pipes.h b/criu/include/pipes.h
|
||||
index 6e6310e14..f442d7f65 100644
|
||||
--- a/criu/include/pipes.h
|
||||
+++ b/criu/include/pipes.h
|
||||
@@ -49,8 +49,8 @@ extern int restore_pipe_data(int img_type, int pfd, u32 id, struct pipe_data_rst
|
||||
struct pipe_info {
|
||||
PipeEntry *pe;
|
||||
struct list_head pipe_list; /* All pipe_info with the same pipe_id
|
||||
- * This is pure circular list without head */
|
||||
- struct list_head list; /* global list of pipes */
|
||||
+ * This is pure circular list without head */
|
||||
+ struct list_head list; /* global list of pipes */
|
||||
struct file_desc d;
|
||||
unsigned int create : 1, reopen : 1;
|
||||
};
|
||||
diff --git a/criu/shmem.c b/criu/shmem.c
|
||||
index 1b83327ef..bb48e436b 100644
|
||||
--- a/criu/shmem.c
|
||||
+++ b/criu/shmem.c
|
||||
@@ -85,7 +85,8 @@ struct shmem_info {
|
||||
int self_count; /* the number of regions, which belongs to "pid" */
|
||||
};
|
||||
|
||||
- struct { /* For sysvipc restore */
|
||||
+ /* For sysvipc restore */
|
||||
+ struct {
|
||||
struct list_head att; /* list of shmem_sysv_att-s */
|
||||
int want_write;
|
||||
};
|
||||
diff --git a/test/zdtm/static/ipc_namespace.c b/test/zdtm/static/ipc_namespace.c
|
||||
index 98241d816..4273951ae 100644
|
||||
--- a/test/zdtm/static/ipc_namespace.c
|
||||
+++ b/test/zdtm/static/ipc_namespace.c
|
||||
@@ -19,27 +19,28 @@ extern int shmctl(int __shmid, int __cmd, struct shmid_ds *__buf);
|
||||
|
||||
struct ipc_ids {
|
||||
int in_use; /* TODO: Check for 0 */
|
||||
- // unsigned short seq;
|
||||
- // unsigned short seq_max;
|
||||
- // struct rw_semaphore rw_mutex;
|
||||
- // struct idr ipcs_idr; /* TODO */
|
||||
+
|
||||
+ // unsigned short seq;
|
||||
+ // unsigned short seq_max;
|
||||
+ // struct rw_semaphore rw_mutex;
|
||||
+ // struct idr ipcs_idr; /* TODO */
|
||||
};
|
||||
|
||||
struct ipc_ns {
|
||||
struct ipc_ids ids[3];
|
||||
|
||||
- int sem_ctls[4]; // +
|
||||
- int used_sems; // +
|
||||
-
|
||||
- int msg_ctlmax; // +
|
||||
- int msg_ctlmnb; // +
|
||||
- int msg_ctlmni; // +
|
||||
- int msg_bytes; // +
|
||||
- int msg_hdrs; // +
|
||||
- int auto_msgmni; // +
|
||||
- int msg_next_id; // +
|
||||
- int sem_next_id; // +
|
||||
- int shm_next_id; // +
|
||||
+ int sem_ctls[4];
|
||||
+ int used_sems;
|
||||
+
|
||||
+ int msg_ctlmax;
|
||||
+ int msg_ctlmnb;
|
||||
+ int msg_ctlmni;
|
||||
+ int msg_bytes;
|
||||
+ int msg_hdrs;
|
||||
+ int auto_msgmni;
|
||||
+ int msg_next_id;
|
||||
+ int sem_next_id;
|
||||
+ int shm_next_id;
|
||||
|
||||
size_t shm_ctlmax;
|
||||
size_t shm_ctlall;
|
||||
--
|
||||
2.35.1
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,35 +0,0 @@
|
||||
From b03d50673e9159a712e86f7a9c75c5cabc09278d Mon Sep 17 00:00:00 2001
|
||||
From: Liu Hua <weldonliu@tencent.com>
|
||||
Date: Mon, 1 Nov 2021 20:50:58 +0800
|
||||
Subject: [PATCH 038/249] 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>
|
||||
---
|
||||
criu/cr-dump.c | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/criu/cr-dump.c b/criu/cr-dump.c
|
||||
index ecc99f116..c972e343a 100644
|
||||
--- a/criu/cr-dump.c
|
||||
+++ b/criu/cr-dump.c
|
||||
@@ -1129,6 +1129,13 @@ static int dump_zombies(void)
|
||||
item->pgid = pps_buf.pgid;
|
||||
|
||||
BUG_ON(!list_empty(&item->children));
|
||||
+
|
||||
+ if (!item->sid) {
|
||||
+ pr_err("A session leader of zombie process %d(%d) is outside of its pid namespace\n",
|
||||
+ item->pid->real, vpid(item));
|
||||
+ goto err;
|
||||
+ }
|
||||
+
|
||||
if (dump_one_zombie(item, &pps_buf) < 0)
|
||||
goto err;
|
||||
}
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,176 +0,0 @@
|
||||
From cf56caeb12eb8900409846d2d3d9383cd210388d Mon Sep 17 00:00:00 2001
|
||||
From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
|
||||
Date: Fri, 29 Oct 2021 10:35:28 +0300
|
||||
Subject: [PATCH 039/249] 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>
|
||||
---
|
||||
criu/arch/x86/cpu.c | 139 ++++++++++++++++++++++++++++----------------
|
||||
1 file changed, 89 insertions(+), 50 deletions(-)
|
||||
|
||||
diff --git a/criu/arch/x86/cpu.c b/criu/arch/x86/cpu.c
|
||||
index d02f4abd5..b3a7ca636 100644
|
||||
--- a/criu/arch/x86/cpu.c
|
||||
+++ b/criu/arch/x86/cpu.c
|
||||
@@ -107,64 +107,103 @@ int cpu_dump_cpuinfo(void)
|
||||
|
||||
#define __ins_bit(__l, __v) (1u << ((__v)-32u * (__l)))
|
||||
|
||||
+// clang-format off
|
||||
static uint32_t x86_ins_capability_mask[NCAPINTS] = {
|
||||
- [CPUID_1_EDX] = __ins_bit(CPUID_1_EDX, X86_FEATURE_FPU) | __ins_bit(CPUID_1_EDX, X86_FEATURE_TSC) |
|
||||
- __ins_bit(CPUID_1_EDX, X86_FEATURE_CX8) | __ins_bit(CPUID_1_EDX, X86_FEATURE_SEP) |
|
||||
- __ins_bit(CPUID_1_EDX, X86_FEATURE_CMOV) | __ins_bit(CPUID_1_EDX, X86_FEATURE_CLFLUSH) |
|
||||
- __ins_bit(CPUID_1_EDX, X86_FEATURE_MMX) | __ins_bit(CPUID_1_EDX, X86_FEATURE_FXSR) |
|
||||
- __ins_bit(CPUID_1_EDX, X86_FEATURE_XMM) | __ins_bit(CPUID_1_EDX, X86_FEATURE_XMM2),
|
||||
-
|
||||
- [CPUID_8000_0001_EDX] = __ins_bit(CPUID_8000_0001_EDX, X86_FEATURE_SYSCALL) |
|
||||
- __ins_bit(CPUID_8000_0001_EDX, X86_FEATURE_MMXEXT) |
|
||||
- __ins_bit(CPUID_8000_0001_EDX, X86_FEATURE_RDTSCP) |
|
||||
- __ins_bit(CPUID_8000_0001_EDX, X86_FEATURE_3DNOWEXT) |
|
||||
- __ins_bit(CPUID_8000_0001_EDX, X86_FEATURE_3DNOW),
|
||||
-
|
||||
- [CPUID_LNX_1] = __ins_bit(CPUID_LNX_1, X86_FEATURE_REP_GOOD) | __ins_bit(CPUID_LNX_1, X86_FEATURE_NOPL),
|
||||
-
|
||||
- [CPUID_1_ECX] = __ins_bit(CPUID_1_ECX, X86_FEATURE_XMM3) | __ins_bit(CPUID_1_ECX, X86_FEATURE_PCLMULQDQ) |
|
||||
- __ins_bit(CPUID_1_ECX, X86_FEATURE_MWAIT) | __ins_bit(CPUID_1_ECX, X86_FEATURE_SSSE3) |
|
||||
- __ins_bit(CPUID_1_ECX, X86_FEATURE_CX16) | __ins_bit(CPUID_1_ECX, X86_FEATURE_XMM4_1) |
|
||||
- __ins_bit(CPUID_1_ECX, X86_FEATURE_XMM4_2) | __ins_bit(CPUID_1_ECX, X86_FEATURE_MOVBE) |
|
||||
- __ins_bit(CPUID_1_ECX, X86_FEATURE_POPCNT) | __ins_bit(CPUID_1_ECX, X86_FEATURE_AES) |
|
||||
- __ins_bit(CPUID_1_ECX, X86_FEATURE_XSAVE) | __ins_bit(CPUID_1_ECX, X86_FEATURE_OSXSAVE) |
|
||||
- __ins_bit(CPUID_1_ECX, X86_FEATURE_AVX) | __ins_bit(CPUID_1_ECX, X86_FEATURE_F16C) |
|
||||
- __ins_bit(CPUID_1_ECX, X86_FEATURE_RDRAND),
|
||||
+ [CPUID_1_EDX] =
|
||||
+ __ins_bit(CPUID_1_EDX, X86_FEATURE_FPU) |
|
||||
+ __ins_bit(CPUID_1_EDX, X86_FEATURE_TSC) |
|
||||
+ __ins_bit(CPUID_1_EDX, X86_FEATURE_CX8) |
|
||||
+ __ins_bit(CPUID_1_EDX, X86_FEATURE_SEP) |
|
||||
+ __ins_bit(CPUID_1_EDX, X86_FEATURE_CMOV) |
|
||||
+ __ins_bit(CPUID_1_EDX, X86_FEATURE_CLFLUSH) |
|
||||
+ __ins_bit(CPUID_1_EDX, X86_FEATURE_MMX) |
|
||||
+ __ins_bit(CPUID_1_EDX, X86_FEATURE_FXSR) |
|
||||
+ __ins_bit(CPUID_1_EDX, X86_FEATURE_XMM) |
|
||||
+ __ins_bit(CPUID_1_EDX, X86_FEATURE_XMM2),
|
||||
+
|
||||
+ [CPUID_8000_0001_EDX] =
|
||||
+ __ins_bit(CPUID_8000_0001_EDX, X86_FEATURE_SYSCALL) |
|
||||
+ __ins_bit(CPUID_8000_0001_EDX, X86_FEATURE_MMXEXT) |
|
||||
+ __ins_bit(CPUID_8000_0001_EDX, X86_FEATURE_RDTSCP) |
|
||||
+ __ins_bit(CPUID_8000_0001_EDX, X86_FEATURE_3DNOWEXT) |
|
||||
+ __ins_bit(CPUID_8000_0001_EDX, X86_FEATURE_3DNOW),
|
||||
+
|
||||
+ [CPUID_LNX_1] =
|
||||
+ __ins_bit(CPUID_LNX_1, X86_FEATURE_REP_GOOD) |
|
||||
+ __ins_bit(CPUID_LNX_1, X86_FEATURE_NOPL),
|
||||
+
|
||||
+ [CPUID_1_ECX] =
|
||||
+ __ins_bit(CPUID_1_ECX, X86_FEATURE_XMM3) |
|
||||
+ __ins_bit(CPUID_1_ECX, X86_FEATURE_PCLMULQDQ) |
|
||||
+ __ins_bit(CPUID_1_ECX, X86_FEATURE_MWAIT) |
|
||||
+ __ins_bit(CPUID_1_ECX, X86_FEATURE_SSSE3) |
|
||||
+ __ins_bit(CPUID_1_ECX, X86_FEATURE_CX16) |
|
||||
+ __ins_bit(CPUID_1_ECX, X86_FEATURE_XMM4_1) |
|
||||
+ __ins_bit(CPUID_1_ECX, X86_FEATURE_XMM4_2) |
|
||||
+ __ins_bit(CPUID_1_ECX, X86_FEATURE_MOVBE) |
|
||||
+ __ins_bit(CPUID_1_ECX, X86_FEATURE_POPCNT) |
|
||||
+ __ins_bit(CPUID_1_ECX, X86_FEATURE_AES) |
|
||||
+ __ins_bit(CPUID_1_ECX, X86_FEATURE_XSAVE) |
|
||||
+ __ins_bit(CPUID_1_ECX, X86_FEATURE_OSXSAVE) |
|
||||
+ __ins_bit(CPUID_1_ECX, X86_FEATURE_AVX) |
|
||||
+ __ins_bit(CPUID_1_ECX, X86_FEATURE_F16C) |
|
||||
+ __ins_bit(CPUID_1_ECX, X86_FEATURE_RDRAND),
|
||||
|
||||
[CPUID_8000_0001_ECX] =
|
||||
- __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_ABM) | __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_SSE4A) |
|
||||
- __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_MISALIGNSSE) |
|
||||
- __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_3DNOWPREFETCH) |
|
||||
- __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_XOP) | __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_FMA4) |
|
||||
- __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_TBM),
|
||||
+ __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_ABM) |
|
||||
+ __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_SSE4A) |
|
||||
+ __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_MISALIGNSSE) |
|
||||
+ __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_3DNOWPREFETCH) |
|
||||
+ __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_XOP) |
|
||||
+ __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_FMA4) |
|
||||
+ __ins_bit(CPUID_8000_0001_ECX, X86_FEATURE_TBM),
|
||||
|
||||
[CPUID_7_0_EBX] =
|
||||
- __ins_bit(CPUID_7_0_EBX, X86_FEATURE_FSGSBASE) | __ins_bit(CPUID_7_0_EBX, X86_FEATURE_BMI1) |
|
||||
- __ins_bit(CPUID_7_0_EBX, X86_FEATURE_HLE) | __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX2) |
|
||||
- __ins_bit(CPUID_7_0_EBX, X86_FEATURE_BMI2) | __ins_bit(CPUID_7_0_EBX, X86_FEATURE_ERMS) |
|
||||
- __ins_bit(CPUID_7_0_EBX, X86_FEATURE_RTM) | __ins_bit(CPUID_7_0_EBX, X86_FEATURE_MPX) |
|
||||
- __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512F) | __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512DQ) |
|
||||
- __ins_bit(CPUID_7_0_EBX, X86_FEATURE_RDSEED) | __ins_bit(CPUID_7_0_EBX, X86_FEATURE_ADX) |
|
||||
- __ins_bit(CPUID_7_0_EBX, X86_FEATURE_CLFLUSHOPT) | __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512PF) |
|
||||
- __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512ER) | __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512CD) |
|
||||
- __ins_bit(CPUID_7_0_EBX, X86_FEATURE_SHA_NI) | __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512BW) |
|
||||
- __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512VL),
|
||||
-
|
||||
- [CPUID_D_1_EAX] = __ins_bit(CPUID_D_1_EAX, X86_FEATURE_XSAVEOPT) |
|
||||
- __ins_bit(CPUID_D_1_EAX, X86_FEATURE_XSAVEC) | __ins_bit(CPUID_D_1_EAX, X86_FEATURE_XGETBV1),
|
||||
+ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_FSGSBASE) |
|
||||
+ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_BMI1) |
|
||||
+ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_HLE) |
|
||||
+ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX2) |
|
||||
+ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_BMI2) |
|
||||
+ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_ERMS) |
|
||||
+ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_RTM) |
|
||||
+ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_MPX) |
|
||||
+ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512F) |
|
||||
+ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512DQ) |
|
||||
+ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_RDSEED) |
|
||||
+ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_ADX) |
|
||||
+ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_CLFLUSHOPT) |
|
||||
+ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512PF) |
|
||||
+ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512ER) |
|
||||
+ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512CD) |
|
||||
+ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_SHA_NI) |
|
||||
+ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512BW) |
|
||||
+ __ins_bit(CPUID_7_0_EBX, X86_FEATURE_AVX512VL),
|
||||
+
|
||||
+ [CPUID_D_1_EAX] =
|
||||
+ __ins_bit(CPUID_D_1_EAX, X86_FEATURE_XSAVEOPT) |
|
||||
+ __ins_bit(CPUID_D_1_EAX, X86_FEATURE_XSAVEC) |
|
||||
+ __ins_bit(CPUID_D_1_EAX, X86_FEATURE_XGETBV1),
|
||||
|
||||
[CPUID_7_0_ECX] =
|
||||
- __ins_bit(CPUID_7_0_ECX, X86_FEATURE_AVX512VBMI) | __ins_bit(CPUID_7_0_ECX, X86_FEATURE_AVX512_VBMI2) |
|
||||
- __ins_bit(CPUID_7_0_ECX, X86_FEATURE_GFNI) | __ins_bit(CPUID_7_0_ECX, X86_FEATURE_VAES) |
|
||||
- __ins_bit(CPUID_7_0_ECX, X86_FEATURE_VPCLMULQDQ) | __ins_bit(CPUID_7_0_ECX, X86_FEATURE_AVX512_VNNI) |
|
||||
- __ins_bit(CPUID_7_0_ECX, X86_FEATURE_AVX512_BITALG) | __ins_bit(CPUID_7_0_ECX, X86_FEATURE_TME) |
|
||||
- __ins_bit(CPUID_7_0_ECX, X86_FEATURE_AVX512_VPOPCNTDQ) | __ins_bit(CPUID_7_0_ECX, X86_FEATURE_RDPID),
|
||||
-
|
||||
- [CPUID_8000_0008_EBX] = __ins_bit(CPUID_8000_0008_EBX, X86_FEATURE_CLZERO),
|
||||
-
|
||||
- [CPUID_7_0_EDX] = __ins_bit(CPUID_7_0_EDX, X86_FEATURE_AVX512_4VNNIW) |
|
||||
- __ins_bit(CPUID_7_0_EDX, X86_FEATURE_AVX512_4FMAPS),
|
||||
+ __ins_bit(CPUID_7_0_ECX, X86_FEATURE_AVX512VBMI) |
|
||||
+ __ins_bit(CPUID_7_0_ECX, X86_FEATURE_AVX512_VBMI2) |
|
||||
+ __ins_bit(CPUID_7_0_ECX, X86_FEATURE_GFNI) |
|
||||
+ __ins_bit(CPUID_7_0_ECX, X86_FEATURE_VAES) |
|
||||
+ __ins_bit(CPUID_7_0_ECX, X86_FEATURE_VPCLMULQDQ) |
|
||||
+ __ins_bit(CPUID_7_0_ECX, X86_FEATURE_AVX512_VNNI) |
|
||||
+ __ins_bit(CPUID_7_0_ECX, X86_FEATURE_AVX512_BITALG) |
|
||||
+ __ins_bit(CPUID_7_0_ECX, X86_FEATURE_TME) |
|
||||
+ __ins_bit(CPUID_7_0_ECX, X86_FEATURE_AVX512_VPOPCNTDQ) |
|
||||
+ __ins_bit(CPUID_7_0_ECX, X86_FEATURE_RDPID),
|
||||
+
|
||||
+ [CPUID_8000_0008_EBX] =
|
||||
+ __ins_bit(CPUID_8000_0008_EBX, X86_FEATURE_CLZERO),
|
||||
+
|
||||
+ [CPUID_7_0_EDX] =
|
||||
+ __ins_bit(CPUID_7_0_EDX, X86_FEATURE_AVX512_4VNNIW) |
|
||||
+ __ins_bit(CPUID_7_0_EDX, X86_FEATURE_AVX512_4FMAPS),
|
||||
};
|
||||
+// clang-format on
|
||||
|
||||
#undef __ins_bit
|
||||
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,44 +0,0 @@
|
||||
From 685364f9766498c2f6640dd7882434dd10cd5119 Mon Sep 17 00:00:00 2001
|
||||
From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
|
||||
Date: Fri, 19 Nov 2021 10:08:37 +0300
|
||||
Subject: [PATCH 040/249] 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>
|
||||
---
|
||||
.cirrus.yml | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/.cirrus.yml b/.cirrus.yml
|
||||
index 671178d8b..235b9821e 100644
|
||||
--- a/.cirrus.yml
|
||||
+++ b/.cirrus.yml
|
||||
@@ -47,7 +47,7 @@ task:
|
||||
pip3 install junit_xml
|
||||
|
||||
build_script: |
|
||||
- make -C scripts/ci local SKIP_CI_PREP=1 CC=gcc CD_TO_TOP=1
|
||||
+ make -C scripts/ci local SKIP_CI_PREP=1 CC=gcc CD_TO_TOP=1 ZDTM_OPTS="-x zdtm/static/socket-raw"
|
||||
|
||||
task:
|
||||
name: CentOS 7 based test
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,60 +0,0 @@
|
||||
From ac4dcfc49b09e48e8b7cf6ffe25d6a717969ead2 Mon Sep 17 00:00:00 2001
|
||||
From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
|
||||
Date: Wed, 3 Nov 2021 18:34:11 +0300
|
||||
Subject: [PATCH 041/249] 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>
|
||||
---
|
||||
test/zdtm.py | 19 +++++++++++++++++--
|
||||
1 file changed, 17 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/test/zdtm.py b/test/zdtm.py
|
||||
index fc7b8a183..b62136e96 100755
|
||||
--- a/test/zdtm.py
|
||||
+++ b/test/zdtm.py
|
||||
@@ -1997,7 +1997,22 @@ class Launcher:
|
||||
raise Exception("The kernel is tainted: %r (%r)" %
|
||||
(taint, self.__taint))
|
||||
|
||||
- if test_flag(desc, 'excl'):
|
||||
+ '''
|
||||
+ The option --link-remap allows criu to hardlink open files back to the
|
||||
+ file-system on dump (should be removed on restore) and we have a sanity
|
||||
+ check in check_visible_state that they were actually removed at least
|
||||
+ from the root test directory after restore.
|
||||
+
|
||||
+ As zdtm runs all tests from the same cwd (e.g.: test/zdtm/static) in
|
||||
+ parallel, hardlinks from one test can mess up with sanity checks of
|
||||
+ another test or even one test can by mistake use hardlinks created by
|
||||
+ another test which is even worse.
|
||||
+
|
||||
+ So let's make all tests using --link-remap option non parallel.
|
||||
+ '''
|
||||
+ link_remap_excl = '--link-remap' in desc.get('opts', '').split() + desc.get('dopts', '').split() + desc.get('ropts', '').split()
|
||||
+
|
||||
+ if test_flag(desc, 'excl') or link_remap_excl:
|
||||
self.wait_all()
|
||||
|
||||
self.__nr += 1
|
||||
@@ -2030,7 +2045,7 @@ class Launcher:
|
||||
"start": time.time()
|
||||
}
|
||||
|
||||
- if test_flag(desc, 'excl'):
|
||||
+ if test_flag(desc, 'excl') or link_remap_excl:
|
||||
self.wait()
|
||||
|
||||
def __wait_one(self, flags):
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,108 +0,0 @@
|
||||
From e9c9a39b7e5ad461d47ecebfd8d9ba0d1edd6aeb Mon Sep 17 00:00:00 2001
|
||||
From: Nicolas Viennot <Nicolas.Viennot@twosigma.com>
|
||||
Date: Fri, 29 Oct 2021 03:01:14 +0000
|
||||
Subject: [PATCH 042/249] 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>
|
||||
---
|
||||
test/zdtm.py | 25 +++++++++++++++----------
|
||||
1 file changed, 15 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/test/zdtm.py b/test/zdtm.py
|
||||
index b62136e96..b98770079 100755
|
||||
--- a/test/zdtm.py
|
||||
+++ b/test/zdtm.py
|
||||
@@ -202,6 +202,8 @@ class ns_flavor:
|
||||
|
||||
def __copy_libs(self, binary):
|
||||
ldd = subprocess.Popen(["ldd", binary], stdout=subprocess.PIPE)
|
||||
+ stdout, _ = ldd.communicate()
|
||||
+
|
||||
xl = re.compile(
|
||||
r'^(linux-gate.so|linux-vdso(64)?.so|not a dynamic|.*\s*ldd\s)')
|
||||
|
||||
@@ -216,11 +218,9 @@ class ns_flavor:
|
||||
map(
|
||||
lambda x: str(x).strip(),
|
||||
filter(lambda x: str(x).startswith('\t'),
|
||||
- ldd.stdout.read().decode(
|
||||
+ stdout.decode(
|
||||
'ascii').splitlines())))))
|
||||
|
||||
- ldd.wait()
|
||||
-
|
||||
for lib in libs:
|
||||
if not os.access(lib, os.F_OK):
|
||||
raise test_fail_exc("Can't find lib %s required by %s" %
|
||||
@@ -331,8 +331,7 @@ def decode_flav(i):
|
||||
|
||||
def tail(path):
|
||||
p = subprocess.Popen(['tail', '-n1', path], stdout=subprocess.PIPE)
|
||||
- out = p.stdout.readline()
|
||||
- p.wait()
|
||||
+ out, _ = p.communicate()
|
||||
return out.decode()
|
||||
|
||||
|
||||
@@ -801,7 +800,7 @@ class groups_test(zdtm_test):
|
||||
if flavor.ns:
|
||||
self.__real_name = name
|
||||
with open(name) as fd:
|
||||
- self.__subs = map(lambda x: x.strip(), fd.readlines())
|
||||
+ self.__subs = list(map(lambda x: x.strip(), fd.readlines()))
|
||||
print("Subs:\n%s" % '\n'.join(self.__subs))
|
||||
else:
|
||||
self.__real_name = ''
|
||||
@@ -819,8 +818,8 @@ class groups_test(zdtm_test):
|
||||
subprocess.check_call(s_args + [tname + '.cleanout'])
|
||||
s = subprocess.Popen(s_args + ['--dry-run', tname + '.pid'],
|
||||
stdout=subprocess.PIPE)
|
||||
- cmd = s.stdout.readlines().pop().strip()
|
||||
- s.wait()
|
||||
+ out, _ = s.communicate()
|
||||
+ cmd = out.decode().splitlines()[-1].strip()
|
||||
|
||||
return 'cd /' + tdir + ' && ' + cmd
|
||||
|
||||
@@ -2045,6 +2044,9 @@ class Launcher:
|
||||
"start": time.time()
|
||||
}
|
||||
|
||||
+ if log:
|
||||
+ log.close()
|
||||
+
|
||||
if test_flag(desc, 'excl') or link_remap_excl:
|
||||
self.wait()
|
||||
|
||||
@@ -2068,6 +2070,9 @@ class Launcher:
|
||||
self.__runtest += 1
|
||||
if pid != 0:
|
||||
sub = self.__subs.pop(pid)
|
||||
+ # The following wait() is not useful for our domain logic.
|
||||
+ # It's useful for taming warnings in subprocess.Popen.__del__()
|
||||
+ sub['sub'].wait()
|
||||
tc = None
|
||||
if self.__junit_test_cases is not None:
|
||||
tc = TestCase(sub['name'],
|
||||
@@ -2168,9 +2173,9 @@ def all_tests(opts):
|
||||
continue
|
||||
files.append(fp)
|
||||
excl = list(map(lambda x: os.path.join(desc['dir'], x), desc['exclude']))
|
||||
- tlist = filter(
|
||||
+ tlist = list(filter(
|
||||
lambda x: not x.endswith('.checkskip') and not x.endswith('.hook') and
|
||||
- x not in excl, map(lambda x: x.strip(), files))
|
||||
+ x not in excl, map(lambda x: x.strip(), files)))
|
||||
return tlist
|
||||
|
||||
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,99 +0,0 @@
|
||||
From 044dd55e9585b9b2d1ac15e21cd6e6c08b4d8ee3 Mon Sep 17 00:00:00 2001
|
||||
From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
|
||||
Date: Tue, 23 Nov 2021 15:06:03 +0300
|
||||
Subject: [PATCH 043/249] 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>
|
||||
---
|
||||
test/zdtm/static/mprotect00.c | 16 ++++++++++------
|
||||
test/zdtm/static/shm-mp.c | 16 ++++++++++------
|
||||
2 files changed, 20 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/test/zdtm/static/mprotect00.c b/test/zdtm/static/mprotect00.c
|
||||
index 006b64772..717b7ddcf 100644
|
||||
--- a/test/zdtm/static/mprotect00.c
|
||||
+++ b/test/zdtm/static/mprotect00.c
|
||||
@@ -44,10 +44,12 @@ static int check_prot(char *ptr, int prot)
|
||||
fail("PROT_READ bypassed");
|
||||
return -1;
|
||||
}
|
||||
- } else /* we come here on return from SIGSEGV handler */
|
||||
+ } else {
|
||||
+ /* we come here on return from SIGSEGV handler */
|
||||
if (prot & PROT_READ) {
|
||||
- fail("PROT_READ rejected");
|
||||
- return -1;
|
||||
+ fail("PROT_READ rejected");
|
||||
+ return -1;
|
||||
+ }
|
||||
}
|
||||
|
||||
if (!sigsetjmp(segv_ret, 1)) {
|
||||
@@ -56,10 +58,12 @@ static int check_prot(char *ptr, int prot)
|
||||
fail("PROT_WRITE bypassed");
|
||||
return -1;
|
||||
}
|
||||
- } else /* we come here on return from SIGSEGV handler */
|
||||
+ } else {
|
||||
+ /* we come here on return from SIGSEGV handler */
|
||||
if (prot & PROT_WRITE) {
|
||||
- fail("PROT_WRITE rejected");
|
||||
- return -1;
|
||||
+ fail("PROT_WRITE rejected");
|
||||
+ return -1;
|
||||
+ }
|
||||
}
|
||||
|
||||
if (signal(SIGSEGV, SIG_DFL) == SIG_ERR) {
|
||||
diff --git a/test/zdtm/static/shm-mp.c b/test/zdtm/static/shm-mp.c
|
||||
index 1929dac19..c95f3d84c 100644
|
||||
--- a/test/zdtm/static/shm-mp.c
|
||||
+++ b/test/zdtm/static/shm-mp.c
|
||||
@@ -33,10 +33,12 @@ static int check_prot(char *ptr, char val, int prot)
|
||||
fail("PROT_READ bypassed");
|
||||
return -1;
|
||||
}
|
||||
- } else /* we come here on return from SIGSEGV handler */
|
||||
+ } else {
|
||||
+ /* we come here on return from SIGSEGV handler */
|
||||
if (prot & PROT_READ) {
|
||||
- fail("PROT_READ rejected");
|
||||
- return -1;
|
||||
+ fail("PROT_READ rejected");
|
||||
+ return -1;
|
||||
+ }
|
||||
}
|
||||
|
||||
if (!sigsetjmp(segv_ret, 1)) {
|
||||
@@ -45,10 +47,12 @@ static int check_prot(char *ptr, char val, int prot)
|
||||
fail("PROT_WRITE bypassed");
|
||||
return -1;
|
||||
}
|
||||
- } else /* we come here on return from SIGSEGV handler */
|
||||
+ } else {
|
||||
+ /* we come here on return from SIGSEGV handler */
|
||||
if (prot & PROT_WRITE) {
|
||||
- fail("PROT_WRITE rejected");
|
||||
- return -1;
|
||||
+ fail("PROT_WRITE rejected");
|
||||
+ return -1;
|
||||
+ }
|
||||
}
|
||||
|
||||
if (signal(SIGSEGV, SIG_DFL) == SIG_ERR) {
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,72 +0,0 @@
|
||||
From 716dba02dac88130918fd11628c81115a5bab586 Mon Sep 17 00:00:00 2001
|
||||
From: Liu Hua <weldonliu@tencent.com>
|
||||
Date: Fri, 5 Nov 2021 17:08:51 +0800
|
||||
Subject: [PATCH 044/249] 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>
|
||||
---
|
||||
criu/seize.c | 13 +++++++------
|
||||
1 file changed, 7 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/criu/seize.c b/criu/seize.c
|
||||
index 95bf9ef0c..58564ca74 100644
|
||||
--- a/criu/seize.c
|
||||
+++ b/criu/seize.c
|
||||
@@ -131,11 +131,11 @@ static enum freezer_state get_freezer_state(int fd)
|
||||
return get_freezer_v1_state(fd);
|
||||
}
|
||||
|
||||
-static bool freezer_thawed;
|
||||
+static enum freezer_state origin_freezer_state = FREEZER_ERROR;
|
||||
|
||||
const char *get_real_freezer_state(void)
|
||||
{
|
||||
- return freezer_thawed ? thawed : frozen;
|
||||
+ return origin_freezer_state == THAWED ? thawed : frozen;
|
||||
}
|
||||
|
||||
static int freezer_write_state(int fd, enum freezer_state new_state)
|
||||
@@ -192,7 +192,7 @@ static int freezer_restore_state(void)
|
||||
int fd;
|
||||
int ret;
|
||||
|
||||
- if (!opts.freeze_cgroup || freezer_thawed)
|
||||
+ if (!opts.freeze_cgroup || origin_freezer_state != FROZEN)
|
||||
return 0;
|
||||
|
||||
fd = freezer_open();
|
||||
@@ -481,9 +481,10 @@ static int freeze_processes(void)
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
- if (state == THAWED) {
|
||||
- freezer_thawed = true;
|
||||
|
||||
+ origin_freezer_state = state == FREEZING ? FROZEN : state;
|
||||
+
|
||||
+ if (state == THAWED) {
|
||||
if (freezer_write_state(fd, FROZEN)) {
|
||||
close(fd);
|
||||
return -1;
|
||||
@@ -534,7 +535,7 @@ static int freeze_processes(void)
|
||||
}
|
||||
|
||||
err:
|
||||
- if (exit_code == 0 || freezer_thawed)
|
||||
+ if (exit_code == 0 || origin_freezer_state == THAWED)
|
||||
exit_code = freezer_write_state(fd, THAWED);
|
||||
|
||||
if (close(fd)) {
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,30 +0,0 @@
|
||||
From 1b5cc130824dcbcef2467b7c513ace0dd6a41fe5 Mon Sep 17 00:00:00 2001
|
||||
From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
|
||||
Date: Wed, 24 Nov 2021 11:37:58 +0300
|
||||
Subject: [PATCH 045/249] 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>
|
||||
---
|
||||
.github/workflows/lint.yml | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
|
||||
index 49eb6aaac..50b241e9f 100644
|
||||
--- a/.github/workflows/lint.yml
|
||||
+++ b/.github/workflows/lint.yml
|
||||
@@ -6,7 +6,7 @@ jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
- image: registry.fedoraproject.org/fedora:34
|
||||
+ image: registry.fedoraproject.org/fedora:latest
|
||||
steps:
|
||||
- name: Install tools
|
||||
run: sudo dnf -y install git make python3-flake8 ShellCheck clang-tools-extra which findutils
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,72 +0,0 @@
|
||||
From da247673bf35506d48433627421c2d0192159b9c Mon Sep 17 00:00:00 2001
|
||||
From: Liu Hua <weldonliu@tencent.com>
|
||||
Date: Thu, 4 Nov 2021 10:04:22 +0800
|
||||
Subject: [PATCH 046/249] 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>
|
||||
---
|
||||
criu/crtools.c | 33 ++++++++++++++++++---------------
|
||||
1 file changed, 18 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/criu/crtools.c b/criu/crtools.c
|
||||
index 6a75cd1ea..81c0aa963 100644
|
||||
--- a/criu/crtools.c
|
||||
+++ b/criu/crtools.c
|
||||
@@ -106,6 +106,24 @@ int main(int argc, char *argv[], char *envp[])
|
||||
|
||||
log_set_loglevel(opts.log_level);
|
||||
|
||||
+ /*
|
||||
+ * There kernel might send us lethal signals in the following cases:
|
||||
+ * 1) Writing a pipe which reader has disappeared.
|
||||
+ * 2) Writing to a socket of type SOCK_STREAM which is no longer connected.
|
||||
+ * We deal with write()/Send() failures on our own, and prefer not to get killed.
|
||||
+ * So we ignore SIGPIPEs.
|
||||
+ *
|
||||
+ * Pipes are used in various places:
|
||||
+ * 1) Receiving application page data
|
||||
+ * 2) Transmitting data to the image streamer
|
||||
+ * 3) Emitting logs (potentially to a pipe).
|
||||
+ * Sockets are mainly used in transmitting memory data.
|
||||
+ */
|
||||
+ if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
|
||||
+ pr_perror("Failed to set a SIGPIPE signal ignore.");
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
if (optind < argc && !strcmp(argv[optind], "swrk")) {
|
||||
if (argc != optind + 2) {
|
||||
fprintf(stderr, "Usage: criu swrk <fd>\n");
|
||||
@@ -175,21 +193,6 @@ int main(int argc, char *argv[], char *envp[])
|
||||
}
|
||||
}
|
||||
|
||||
- /*
|
||||
- * The kernel might send us lethal signals when writing to a pipe
|
||||
- * which reader has disappeared. We deal with write() failures on our
|
||||
- * own, and prefer not to get killed. So we ignore SIGPIPEs.
|
||||
- *
|
||||
- * Pipes are used in various places:
|
||||
- * 1) Receiving application page data
|
||||
- * 2) Transmitting data to the image streamer
|
||||
- * 3) Emitting logs (potentially to a pipe).
|
||||
- */
|
||||
- if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
|
||||
- pr_perror("Failed to set a SIGPIPE signal ignore.");
|
||||
- return 1;
|
||||
- }
|
||||
-
|
||||
/*
|
||||
* When a process group becomes an orphan,
|
||||
* its processes are sent a SIGHUP signal
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,29 +0,0 @@
|
||||
From ecfef3dc95bd1293084916ff2c40250a4442796c Mon Sep 17 00:00:00 2001
|
||||
From: Adrian Reber <areber@redhat.com>
|
||||
Date: Wed, 24 Nov 2021 16:13:01 +0000
|
||||
Subject: [PATCH 047/249] 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>
|
||||
---
|
||||
.cirrus.yml | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/.cirrus.yml b/.cirrus.yml
|
||||
index 235b9821e..ef0de54e9 100644
|
||||
--- a/.cirrus.yml
|
||||
+++ b/.cirrus.yml
|
||||
@@ -27,7 +27,7 @@ task:
|
||||
|
||||
compute_engine_instance:
|
||||
image_project: centos-cloud
|
||||
- image: family/centos-8
|
||||
+ image: family/centos-stream-8
|
||||
platform: linux
|
||||
cpu: 4
|
||||
memory: 8G
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,68 +0,0 @@
|
||||
From 9e074610d7bc702b9220095691e4d138b0c0df09 Mon Sep 17 00:00:00 2001
|
||||
From: Nicolas Viennot <Nicolas.Viennot@twosigma.com>
|
||||
Date: Fri, 19 Nov 2021 20:58:13 +0000
|
||||
Subject: [PATCH 048/249] 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>
|
||||
---
|
||||
criu/cr-check.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/criu/cr-check.c b/criu/cr-check.c
|
||||
index e46c93815..0320b445a 100644
|
||||
--- a/criu/cr-check.c
|
||||
+++ b/criu/cr-check.c
|
||||
@@ -575,6 +575,7 @@ static pid_t fork_and_ptrace_attach(int (*child_setup)(void))
|
||||
if (read(sk, &c, 1) != 1) {
|
||||
close(sk);
|
||||
kill(pid, SIGKILL);
|
||||
+ waitpid(pid, NULL, 0);
|
||||
pr_perror("read");
|
||||
return -1;
|
||||
}
|
||||
@@ -584,6 +585,7 @@ static pid_t fork_and_ptrace_attach(int (*child_setup)(void))
|
||||
if (ptrace(PTRACE_ATTACH, pid, NULL, NULL) == -1) {
|
||||
pr_perror("Unable to ptrace the child");
|
||||
kill(pid, SIGKILL);
|
||||
+ waitpid(pid, NULL, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -618,6 +620,7 @@ static int check_ptrace_peeksiginfo(void)
|
||||
}
|
||||
|
||||
kill(pid, SIGKILL);
|
||||
+ waitpid(pid, NULL, 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -768,6 +771,7 @@ static int check_special_mapping_mremap(void)
|
||||
/* Probably, we're interrupted with a signal - cleanup */
|
||||
pr_err("Failed to wait for a child %d\n", errno);
|
||||
kill(child, SIGKILL);
|
||||
+ waitpid(child, NULL, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -806,6 +810,7 @@ static int check_ptrace_suspend_seccomp(void)
|
||||
}
|
||||
|
||||
kill(pid, SIGKILL);
|
||||
+ waitpid(pid, NULL, 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -846,6 +851,7 @@ static int check_ptrace_dump_seccomp_filters(void)
|
||||
}
|
||||
|
||||
kill(pid, SIGKILL);
|
||||
+ waitpid(pid, NULL, 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,156 +0,0 @@
|
||||
From e1485b8d58c4927f7cbd1ee0383c7d7f8580bade Mon Sep 17 00:00:00 2001
|
||||
From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
|
||||
Date: Thu, 13 Feb 2020 10:43:14 +0300
|
||||
Subject: [PATCH 049/249] 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>
|
||||
---
|
||||
criu/files-reg.c | 47 +++++++++++++++++++++++++++++++----------------
|
||||
1 file changed, 31 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/criu/files-reg.c b/criu/files-reg.c
|
||||
index e330466f6..96ec82c73 100644
|
||||
--- a/criu/files-reg.c
|
||||
+++ b/criu/files-reg.c
|
||||
@@ -1867,6 +1867,9 @@ out:
|
||||
* This routine properly resolves d's path handling ghost/link-remaps.
|
||||
* The open_cb is a routine that does actual open, it differs for
|
||||
* files, directories, fifos, etc.
|
||||
+ *
|
||||
+ * Return 0 on success, -1 on error and 1 to indicate soft error, which can be
|
||||
+ * retried.
|
||||
*/
|
||||
|
||||
static int rfi_remap(struct reg_file_info *rfi, int *level)
|
||||
@@ -1932,6 +1935,8 @@ out_root:
|
||||
int errno_saved = errno;
|
||||
rm_parent_dirs(mntns_root, path, *level);
|
||||
errno = errno_saved;
|
||||
+ if (errno == EEXIST)
|
||||
+ return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -2008,11 +2013,12 @@ static bool validate_file(const int fd, const struct stat *fd_status, const stru
|
||||
|
||||
int open_path(struct file_desc *d, int (*open_cb)(int mntns_root, struct reg_file_info *, void *), void *arg)
|
||||
{
|
||||
- int tmp, mntns_root, level = 0;
|
||||
+ int tmp = -1, mntns_root, level = 0;
|
||||
struct reg_file_info *rfi;
|
||||
char *orig_path = NULL;
|
||||
char path[PATH_MAX];
|
||||
int inh_fd = -1;
|
||||
+ int ret;
|
||||
|
||||
if (inherited_fd(d, &tmp))
|
||||
return tmp;
|
||||
@@ -2049,14 +2055,9 @@ int open_path(struct file_desc *d, int (*open_cb)(int mntns_root, struct reg_fil
|
||||
*/
|
||||
orig_path = rfi->path;
|
||||
rfi->path = rfi->remap->rpath;
|
||||
- } else if (rfi_remap(rfi, &level) < 0) {
|
||||
+ } else if ((ret = rfi_remap(rfi, &level)) == 1) {
|
||||
static char tmp_path[PATH_MAX];
|
||||
|
||||
- if (errno != EEXIST) {
|
||||
- pr_perror("Can't link %s -> %s", rfi->remap->rpath, rfi->path);
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
/*
|
||||
* The file whose name we're trying to create
|
||||
* exists. Need to pick some other one, we're
|
||||
@@ -2070,12 +2071,15 @@ int open_path(struct file_desc *d, int (*open_cb)(int mntns_root, struct reg_fil
|
||||
orig_path = rfi->path;
|
||||
rfi->path = tmp_path;
|
||||
snprintf(tmp_path, sizeof(tmp_path), "%s.cr_link", orig_path);
|
||||
- pr_debug("Fake %s -> %s link\n", rfi->path, rfi->remap->rpath);
|
||||
+ pr_debug("Fake %s -> %s link\n", rfi->remap->rpath, rfi->path);
|
||||
|
||||
- if (rfi_remap(rfi, &level) < 0) {
|
||||
+ if (rfi_remap(rfi, &level)) {
|
||||
pr_perror("Can't create even fake link!");
|
||||
- return -1;
|
||||
+ goto err;
|
||||
}
|
||||
+ } else if (ret < 0) {
|
||||
+ pr_perror("Can't link %s -> %s", rfi->remap->rpath, rfi->path);
|
||||
+ goto err;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2085,7 +2089,7 @@ ext:
|
||||
if (tmp < 0) {
|
||||
pr_perror("Can't open file %s", rfi->path);
|
||||
close_safe(&inh_fd);
|
||||
- return -1;
|
||||
+ goto err;
|
||||
}
|
||||
close_safe(&inh_fd);
|
||||
|
||||
@@ -2094,15 +2098,15 @@ ext:
|
||||
|
||||
if (fstat(tmp, &st) < 0) {
|
||||
pr_perror("Can't fstat opened file");
|
||||
- return -1;
|
||||
+ goto err;
|
||||
}
|
||||
|
||||
if (!validate_file(tmp, &st, rfi))
|
||||
- return -1;
|
||||
+ goto err;
|
||||
|
||||
if (rfi->rfe->has_mode && (st.st_mode != rfi->rfe->mode)) {
|
||||
pr_err("File %s has bad mode 0%o (expect 0%o)\n", rfi->path, (int)st.st_mode, rfi->rfe->mode);
|
||||
- return -1;
|
||||
+ goto err;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2115,7 +2119,11 @@ ext:
|
||||
|
||||
if (rfi->remap) {
|
||||
if (!rfi->remap->is_dir) {
|
||||
- unlinkat(mntns_root, rfi->path, 0);
|
||||
+ pr_debug("Unlink: %d:%s\n", rfi->rfe->mnt_id, rfi->path);
|
||||
+ if (unlinkat(mntns_root, rfi->path, 0)) {
|
||||
+ pr_perror("Failed to unlink the remap file");
|
||||
+ goto err;
|
||||
+ }
|
||||
rm_parent_dirs(mntns_root, rfi->path, level);
|
||||
}
|
||||
|
||||
@@ -2124,10 +2132,17 @@ ext:
|
||||
if (orig_path)
|
||||
rfi->path = orig_path;
|
||||
|
||||
- if (restore_fown(tmp, rfi->rfe->fown))
|
||||
+ if (restore_fown(tmp, rfi->rfe->fown)) {
|
||||
+ close(tmp);
|
||||
return -1;
|
||||
+ }
|
||||
|
||||
return tmp;
|
||||
+err:
|
||||
+ if (rfi->remap)
|
||||
+ mutex_unlock(remap_open_lock);
|
||||
+ close_safe(&tmp);
|
||||
+ return -1;
|
||||
}
|
||||
|
||||
int do_open_reg_noseek_flags(int ns_root_fd, struct reg_file_info *rfi, void *arg)
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,116 +0,0 @@
|
||||
From e7c9c5c08d4289962d56ec74bb4b554f5ed42f7e Mon Sep 17 00:00:00 2001
|
||||
From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
|
||||
Date: Thu, 13 Feb 2020 13:03:12 +0300
|
||||
Subject: [PATCH 050/249] 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>
|
||||
---
|
||||
criu/files-reg.c | 45 ++++++++++++++++++++++++++++++---------------
|
||||
1 file changed, 30 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/criu/files-reg.c b/criu/files-reg.c
|
||||
index 96ec82c73..6a2ea2fe4 100644
|
||||
--- a/criu/files-reg.c
|
||||
+++ b/criu/files-reg.c
|
||||
@@ -1792,30 +1792,42 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
-static void rm_parent_dirs(int mntns_root, char *path, int count)
|
||||
+static int rm_parent_dirs(int mntns_root, char *path, int count)
|
||||
{
|
||||
char *p, *prev = NULL;
|
||||
+ int ret = -1;
|
||||
|
||||
- if (!count)
|
||||
- return;
|
||||
-
|
||||
- while (count > 0) {
|
||||
- count -= 1;
|
||||
+ while (count-- > 0) {
|
||||
p = strrchr(path, '/');
|
||||
- if (p)
|
||||
+ if (p) {
|
||||
+ /* We don't handle "//" in path */
|
||||
+ BUG_ON(prev && (prev - p == 1));
|
||||
*p = '\0';
|
||||
+ } else {
|
||||
+ /* Inconsistent path and count */
|
||||
+ pr_perror("Can't strrchr \"/\" in \"%s\"/\"%s\"]"
|
||||
+ " left count=%d\n",
|
||||
+ path, prev ? prev + 1 : "", count + 1);
|
||||
+ goto err;
|
||||
+ }
|
||||
+
|
||||
if (prev)
|
||||
*prev = '/';
|
||||
+ prev = p;
|
||||
|
||||
- if (unlinkat(mntns_root, path, AT_REMOVEDIR))
|
||||
+ if (unlinkat(mntns_root, path, AT_REMOVEDIR)) {
|
||||
pr_perror("Can't remove %s AT %d", path, mntns_root);
|
||||
- else
|
||||
- pr_debug("Unlinked parent dir: %s AT %d\n", path, mntns_root);
|
||||
- prev = p;
|
||||
+ goto err;
|
||||
+ }
|
||||
+ pr_debug("Unlinked parent dir: %s AT %d\n", path, mntns_root);
|
||||
}
|
||||
|
||||
+ ret = 0;
|
||||
+err:
|
||||
if (prev)
|
||||
*prev = '/';
|
||||
+
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
/* Construct parent dir name and mkdir parent/grandparents if they're not exist */
|
||||
@@ -1847,6 +1859,7 @@ static int make_parent_dirs_if_need(int mntns_root, char *path)
|
||||
err = mkdirat(mntns_root, path, 0777);
|
||||
if (err && errno != EEXIST) {
|
||||
pr_perror("Can't create dir: %s AT %d", path, mntns_root);
|
||||
+ /* Failing anyway -> no retcode check */
|
||||
rm_parent_dirs(mntns_root, path, count);
|
||||
count = -1;
|
||||
goto out;
|
||||
@@ -1933,10 +1946,11 @@ out_root:
|
||||
|
||||
if (linkat_hard(mntns_root, rpath, mntns_root, path, rfi->remap->uid, rfi->remap->gid, 0) < 0) {
|
||||
int errno_saved = errno;
|
||||
- rm_parent_dirs(mntns_root, path, *level);
|
||||
- errno = errno_saved;
|
||||
- if (errno == EEXIST)
|
||||
+
|
||||
+ if (!rm_parent_dirs(mntns_root, path, *level) && errno_saved == EEXIST) {
|
||||
+ errno = errno_saved;
|
||||
return 1;
|
||||
+ }
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -2124,7 +2138,8 @@ ext:
|
||||
pr_perror("Failed to unlink the remap file");
|
||||
goto err;
|
||||
}
|
||||
- rm_parent_dirs(mntns_root, rfi->path, level);
|
||||
+ if (rm_parent_dirs(mntns_root, rfi->path, level))
|
||||
+ goto err;
|
||||
}
|
||||
|
||||
mutex_unlock(remap_open_lock);
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,180 +0,0 @@
|
||||
From 90855f58bae7aa9560868403fac00d5bd14be971 Mon Sep 17 00:00:00 2001
|
||||
From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
|
||||
Date: Thu, 13 Feb 2020 18:28:15 +0300
|
||||
Subject: [PATCH 051/249] 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>
|
||||
---
|
||||
criu/include/mount.h | 4 ++--
|
||||
criu/mount.c | 32 ++++++++++++++++++++++----------
|
||||
criu/proc_parse.c | 2 +-
|
||||
3 files changed, 25 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/criu/include/mount.h b/criu/include/mount.h
|
||||
index 833a75ca0..7705279e4 100644
|
||||
--- a/criu/include/mount.h
|
||||
+++ b/criu/include/mount.h
|
||||
@@ -84,7 +84,7 @@ struct mount_info {
|
||||
struct list_head postpone;
|
||||
|
||||
int is_overmounted;
|
||||
- int remounted_rw;
|
||||
+ int *remounted_rw;
|
||||
|
||||
void *private; /* associated filesystem data */
|
||||
};
|
||||
@@ -100,7 +100,7 @@ static inline int collect_binfmt_misc(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
-extern struct mount_info *mnt_entry_alloc(void);
|
||||
+extern struct mount_info *mnt_entry_alloc(bool rst);
|
||||
extern void mnt_entry_free(struct mount_info *mi);
|
||||
|
||||
extern int __mntns_get_root_fd(pid_t pid);
|
||||
diff --git a/criu/mount.c b/criu/mount.c
|
||||
index 93725e526..d75ca5598 100644
|
||||
--- a/criu/mount.c
|
||||
+++ b/criu/mount.c
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "external.h"
|
||||
#include "clone-noasan.h"
|
||||
#include "fdstore.h"
|
||||
+#include "rst-malloc.h"
|
||||
|
||||
#include "images/mnt.pb-c.h"
|
||||
|
||||
@@ -1415,7 +1416,8 @@ err:
|
||||
return -1;
|
||||
}
|
||||
|
||||
-static __maybe_unused int add_cr_time_mount(struct mount_info *root, char *fsname, const char *path, unsigned int s_dev)
|
||||
+static __maybe_unused int add_cr_time_mount(struct mount_info *root, char *fsname, const char *path, unsigned int s_dev,
|
||||
+ bool rst)
|
||||
{
|
||||
struct mount_info *mi, *t, *parent;
|
||||
bool add_slash = false;
|
||||
@@ -1434,7 +1436,7 @@ static __maybe_unused int add_cr_time_mount(struct mount_info *root, char *fsnam
|
||||
}
|
||||
}
|
||||
|
||||
- mi = mnt_entry_alloc();
|
||||
+ mi = mnt_entry_alloc(rst);
|
||||
if (!mi)
|
||||
return -1;
|
||||
|
||||
@@ -2723,7 +2725,7 @@ err_root:
|
||||
return exit_code;
|
||||
}
|
||||
|
||||
-struct mount_info *mnt_entry_alloc()
|
||||
+struct mount_info *mnt_entry_alloc(bool rst)
|
||||
{
|
||||
struct mount_info *new;
|
||||
|
||||
@@ -2734,6 +2736,13 @@ struct mount_info *mnt_entry_alloc()
|
||||
|
||||
new = xzalloc(sizeof(struct mount_info));
|
||||
if (new) {
|
||||
+ if (rst) {
|
||||
+ new->remounted_rw = shmalloc(sizeof(int));
|
||||
+ if (!new->remounted_rw) {
|
||||
+ xfree(new);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ }
|
||||
new->fd = -1;
|
||||
new->is_overmounted = -1;
|
||||
INIT_LIST_HEAD(&new->children);
|
||||
@@ -2956,7 +2965,7 @@ static int collect_mnt_from_image(struct mount_info **head, struct mount_info **
|
||||
if (ret <= 0)
|
||||
break;
|
||||
|
||||
- pm = mnt_entry_alloc();
|
||||
+ pm = mnt_entry_alloc(true);
|
||||
if (!pm)
|
||||
goto err;
|
||||
|
||||
@@ -3234,7 +3243,7 @@ static int populate_mnt_ns(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
- root_yard_mp = mnt_entry_alloc();
|
||||
+ root_yard_mp = mnt_entry_alloc(true);
|
||||
if (!root_yard_mp)
|
||||
return -1;
|
||||
|
||||
@@ -3247,7 +3256,7 @@ static int populate_mnt_ns(void)
|
||||
#ifdef CONFIG_BINFMT_MISC_VIRTUALIZED
|
||||
if (!opts.has_binfmt_misc && !list_empty(&binfmt_misc_list)) {
|
||||
/* Add to mount tree. Generic code will mount it later */
|
||||
- ret = add_cr_time_mount(root_yard_mp, "binfmt_misc", BINFMT_MISC_HOME, 0);
|
||||
+ ret = add_cr_time_mount(root_yard_mp, "binfmt_misc", BINFMT_MISC_HOME, 0, true);
|
||||
if (ret)
|
||||
return -1;
|
||||
}
|
||||
@@ -3697,7 +3706,7 @@ int collect_mnt_namespaces(bool for_dump)
|
||||
ret = -1;
|
||||
goto err;
|
||||
} else if (ret > 0 && add_cr_time_mount(ns->mnt.mntinfo_tree, "binfmt_misc", BINFMT_MISC_HOME,
|
||||
- s_dev) < 0) {
|
||||
+ s_dev, false) < 0) {
|
||||
ret = -1;
|
||||
goto err;
|
||||
}
|
||||
@@ -3838,7 +3847,10 @@ int try_remount_writable(struct mount_info *mi, bool ns)
|
||||
if (!ns)
|
||||
remounted = REMOUNTED_RW_SERVICE;
|
||||
|
||||
- if (mi->flags & MS_RDONLY && !(mi->remounted_rw & remounted)) {
|
||||
+ /* All mounts in mntinfo list should have it on restore */
|
||||
+ BUG_ON(mi->remounted_rw == NULL);
|
||||
+
|
||||
+ if (mi->flags & MS_RDONLY && !(*mi->remounted_rw & remounted)) {
|
||||
if (mnt_is_overmounted(mi)) {
|
||||
pr_err("The mount %d is overmounted so paths are invisible\n", mi->mnt_id);
|
||||
return -1;
|
||||
@@ -3861,7 +3873,7 @@ int try_remount_writable(struct mount_info *mi, bool ns)
|
||||
if (call_helper_process(ns_remount_writable, mi))
|
||||
return -1;
|
||||
}
|
||||
- mi->remounted_rw |= remounted;
|
||||
+ *mi->remounted_rw |= remounted;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -3876,7 +3888,7 @@ static int __remount_readonly_mounts(struct ns_id *ns)
|
||||
if (ns && mi->nsid != ns)
|
||||
continue;
|
||||
|
||||
- if (!(mi->remounted_rw && REMOUNTED_RW))
|
||||
+ if (!(*mi->remounted_rw && REMOUNTED_RW))
|
||||
continue;
|
||||
|
||||
/*
|
||||
diff --git a/criu/proc_parse.c b/criu/proc_parse.c
|
||||
index f3491e781..c734fc24a 100644
|
||||
--- a/criu/proc_parse.c
|
||||
+++ b/criu/proc_parse.c
|
||||
@@ -1506,7 +1506,7 @@ struct mount_info *parse_mountinfo(pid_t pid, struct ns_id *nsid, bool for_dump)
|
||||
int ret = -1;
|
||||
char *fsname = NULL;
|
||||
|
||||
- new = mnt_entry_alloc();
|
||||
+ new = mnt_entry_alloc(false);
|
||||
if (!new)
|
||||
goto end;
|
||||
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,46 +0,0 @@
|
||||
From d30c2c86f6f9a81de004a129661ad7aa5d9fcddb Mon Sep 17 00:00:00 2001
|
||||
From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
|
||||
Date: Thu, 13 Feb 2020 18:26:52 +0300
|
||||
Subject: [PATCH 052/249] 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>
|
||||
---
|
||||
criu/files-reg.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/criu/files-reg.c b/criu/files-reg.c
|
||||
index 6a2ea2fe4..1224b6ac2 100644
|
||||
--- a/criu/files-reg.c
|
||||
+++ b/criu/files-reg.c
|
||||
@@ -2133,6 +2133,11 @@ ext:
|
||||
|
||||
if (rfi->remap) {
|
||||
if (!rfi->remap->is_dir) {
|
||||
+ struct mount_info *mi = lookup_mnt_id(rfi->rfe->mnt_id);
|
||||
+
|
||||
+ if (mi && try_remount_writable(mi, true))
|
||||
+ goto err;
|
||||
+
|
||||
pr_debug("Unlink: %d:%s\n", rfi->rfe->mnt_id, rfi->path);
|
||||
if (unlinkat(mntns_root, rfi->path, 0)) {
|
||||
pr_perror("Failed to unlink the remap file");
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,47 +0,0 @@
|
||||
From dff6911878ee62f7cd757a0a8e3ecc3fe4ee6ac7 Mon Sep 17 00:00:00 2001
|
||||
From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
|
||||
Date: Tue, 30 Nov 2021 19:03:29 +0300
|
||||
Subject: [PATCH 053/249] 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>
|
||||
---
|
||||
test/zdtm/static/mntns_ghost01.c | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/test/zdtm/static/mntns_ghost01.c b/test/zdtm/static/mntns_ghost01.c
|
||||
index 20397d543..2cc2270dd 100644
|
||||
--- a/test/zdtm/static/mntns_ghost01.c
|
||||
+++ b/test/zdtm/static/mntns_ghost01.c
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <sched.h>
|
||||
#include <sys/wait.h>
|
||||
#include <limits.h>
|
||||
+#include <errno.h>
|
||||
|
||||
#include "zdtmtst.h"
|
||||
|
||||
@@ -89,6 +90,13 @@ int main(int argc, char **argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
+ fd = open(ghost_path, O_CREAT | O_WRONLY, 0600);
|
||||
+ if (fd >= 0 || errno != EROFS) {
|
||||
+ pr_perror("open for write on rofs -> %d", fd);
|
||||
+ close(fd);
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,115 +0,0 @@
|
||||
From 3174e7ee7e85be9db58373ddceea98e9984f3808 Mon Sep 17 00:00:00 2001
|
||||
From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
|
||||
Date: Thu, 25 Nov 2021 16:51:55 +0300
|
||||
Subject: [PATCH 054/249] 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>
|
||||
---
|
||||
criu/fdstore.c | 4 +++-
|
||||
test/zdtm/lib/test.c | 4 +++-
|
||||
test/zdtm/static/child_subreaper_and_reparent.c | 4 +++-
|
||||
test/zdtm/static/child_subreaper_existing_child.c | 4 +++-
|
||||
test/zdtm/static/file_fown.c | 4 +++-
|
||||
5 files changed, 15 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/criu/fdstore.c b/criu/fdstore.c
|
||||
index 77935484f..65264a511 100644
|
||||
--- a/criu/fdstore.c
|
||||
+++ b/criu/fdstore.c
|
||||
@@ -13,10 +13,12 @@
|
||||
#include "rst-malloc.h"
|
||||
#include "log.h"
|
||||
|
||||
+/* clang-format off */
|
||||
static struct fdstore_desc {
|
||||
int next_id;
|
||||
mutex_t lock; /* to protect a peek offset */
|
||||
-} * desc;
|
||||
+} *desc;
|
||||
+/* clang-format on */
|
||||
|
||||
int fdstore_init(void)
|
||||
{
|
||||
diff --git a/test/zdtm/lib/test.c b/test/zdtm/lib/test.c
|
||||
index 81da81eba..57eb42046 100644
|
||||
--- a/test/zdtm/lib/test.c
|
||||
+++ b/test/zdtm/lib/test.c
|
||||
@@ -20,9 +20,11 @@
|
||||
#include "ns.h"
|
||||
|
||||
futex_t sig_received;
|
||||
+/* clang-format off */
|
||||
static struct {
|
||||
futex_t stage;
|
||||
-} * test_shared_state;
|
||||
+} *test_shared_state;
|
||||
+/* clang-format on */
|
||||
|
||||
enum {
|
||||
TEST_INIT_STAGE = 0,
|
||||
diff --git a/test/zdtm/static/child_subreaper_and_reparent.c b/test/zdtm/static/child_subreaper_and_reparent.c
|
||||
index ba03517ba..c71778ae9 100644
|
||||
--- a/test/zdtm/static/child_subreaper_and_reparent.c
|
||||
+++ b/test/zdtm/static/child_subreaper_and_reparent.c
|
||||
@@ -19,11 +19,13 @@ enum {
|
||||
TEST_EXIT,
|
||||
};
|
||||
|
||||
+/* clang-format off */
|
||||
struct shared {
|
||||
futex_t fstate;
|
||||
int parent_before_cr;
|
||||
int parent_after_cr;
|
||||
-} * sh;
|
||||
+} *sh;
|
||||
+/* clang-format on */
|
||||
|
||||
int orphan(void)
|
||||
{
|
||||
diff --git a/test/zdtm/static/child_subreaper_existing_child.c b/test/zdtm/static/child_subreaper_existing_child.c
|
||||
index 4805aa41d..92d22bc4a 100644
|
||||
--- a/test/zdtm/static/child_subreaper_existing_child.c
|
||||
+++ b/test/zdtm/static/child_subreaper_existing_child.c
|
||||
@@ -18,10 +18,12 @@ enum {
|
||||
TEST_EXIT,
|
||||
};
|
||||
|
||||
+/* clang-format off */
|
||||
struct shared {
|
||||
futex_t fstate;
|
||||
int ppid_after_reparent;
|
||||
-} * sh;
|
||||
+} *sh;
|
||||
+/* clang-format on */
|
||||
|
||||
int orphan(void)
|
||||
{
|
||||
diff --git a/test/zdtm/static/file_fown.c b/test/zdtm/static/file_fown.c
|
||||
index eb42a826e..2c5ba82c2 100644
|
||||
--- a/test/zdtm/static/file_fown.c
|
||||
+++ b/test/zdtm/static/file_fown.c
|
||||
@@ -22,12 +22,14 @@
|
||||
const char *test_doc = "Check for signal delivery on file owners";
|
||||
const char *test_author = "Cyrill Gorcunov <gorcunov@openvz.org>";
|
||||
|
||||
+/* clang-format off */
|
||||
struct params {
|
||||
int sigio;
|
||||
int pipe_flags[2];
|
||||
int pipe_pid[2];
|
||||
int pipe_sig[2];
|
||||
-} * shared;
|
||||
+} *shared;
|
||||
+/* clang-format on */
|
||||
|
||||
static void signal_handler_io(int status)
|
||||
{
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,181 +0,0 @@
|
||||
From b223773cd4ffd0fe8cf6e1384ad95b4c4d1b4109 Mon Sep 17 00:00:00 2001
|
||||
From: Radostin Stoyanov <radostin@redhat.com>
|
||||
Date: Sat, 4 Dec 2021 16:18:26 +0000
|
||||
Subject: [PATCH 055/249] 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>
|
||||
---
|
||||
.github/workflows/cross-compile-daily.yml | 2 +-
|
||||
.github/workflows/cross-compile.yml | 2 +-
|
||||
scripts/build/Dockerfile.aarch64-cross.tmpl | 1 -
|
||||
...aarch64-cross.hdr => Dockerfile.aarch64-stable-cross.hdr} | 0
|
||||
scripts/build/Dockerfile.aarch64-stable-cross.tmpl | 1 +
|
||||
scripts/build/Dockerfile.armv7-cross.tmpl | 1 -
|
||||
...ile.armv7-cross.hdr => Dockerfile.armv7-stable-cross.hdr} | 0
|
||||
scripts/build/Dockerfile.armv7-stable-cross.tmpl | 1 +
|
||||
scripts/build/Dockerfile.mips64el-cross.tmpl | 1 -
|
||||
...ps64el-cross.hdr => Dockerfile.mips64el-stable-cross.hdr} | 0
|
||||
scripts/build/Dockerfile.mips64el-stable-cross.tmpl | 1 +
|
||||
scripts/build/Dockerfile.ppc64-cross.tmpl | 1 -
|
||||
...ile.ppc64-cross.hdr => Dockerfile.ppc64-stable-cross.hdr} | 0
|
||||
scripts/build/Dockerfile.ppc64-stable-cross.tmpl | 1 +
|
||||
.../{Dockerfile.cross.tmpl => Dockerfile.stable-cross.tmpl} | 5 ++---
|
||||
scripts/build/Makefile | 2 +-
|
||||
16 files changed, 9 insertions(+), 10 deletions(-)
|
||||
delete mode 120000 scripts/build/Dockerfile.aarch64-cross.tmpl
|
||||
rename scripts/build/{Dockerfile.aarch64-cross.hdr => Dockerfile.aarch64-stable-cross.hdr} (100%)
|
||||
create mode 120000 scripts/build/Dockerfile.aarch64-stable-cross.tmpl
|
||||
delete mode 120000 scripts/build/Dockerfile.armv7-cross.tmpl
|
||||
rename scripts/build/{Dockerfile.armv7-cross.hdr => Dockerfile.armv7-stable-cross.hdr} (100%)
|
||||
create mode 120000 scripts/build/Dockerfile.armv7-stable-cross.tmpl
|
||||
delete mode 120000 scripts/build/Dockerfile.mips64el-cross.tmpl
|
||||
rename scripts/build/{Dockerfile.mips64el-cross.hdr => Dockerfile.mips64el-stable-cross.hdr} (100%)
|
||||
create mode 120000 scripts/build/Dockerfile.mips64el-stable-cross.tmpl
|
||||
delete mode 120000 scripts/build/Dockerfile.ppc64-cross.tmpl
|
||||
rename scripts/build/{Dockerfile.ppc64-cross.hdr => Dockerfile.ppc64-stable-cross.hdr} (100%)
|
||||
create mode 120000 scripts/build/Dockerfile.ppc64-stable-cross.tmpl
|
||||
rename scripts/build/{Dockerfile.cross.tmpl => Dockerfile.stable-cross.tmpl} (88%)
|
||||
|
||||
diff --git a/.github/workflows/cross-compile-daily.yml b/.github/workflows/cross-compile-daily.yml
|
||||
index 701213276..927ddced2 100644
|
||||
--- a/.github/workflows/cross-compile-daily.yml
|
||||
+++ b/.github/workflows/cross-compile-daily.yml
|
||||
@@ -10,7 +10,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
- target: [armv7-cross, aarch64-cross, ppc64-cross, mips64el-cross]
|
||||
+ target: [armv7-stable-cross, aarch64-stable-cross, ppc64-stable-cross, mips64el-stable-cross]
|
||||
branches: [criu-dev, master]
|
||||
|
||||
steps:
|
||||
diff --git a/.github/workflows/cross-compile.yml b/.github/workflows/cross-compile.yml
|
||||
index 90862e7ab..c6745d43e 100644
|
||||
--- a/.github/workflows/cross-compile.yml
|
||||
+++ b/.github/workflows/cross-compile.yml
|
||||
@@ -8,7 +8,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
- target: [armv7-cross, aarch64-cross, ppc64-cross, mips64el-cross]
|
||||
+ target: [armv7-stable-cross, aarch64-stable-cross, ppc64-stable-cross, mips64el-stable-cross]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
diff --git a/scripts/build/Dockerfile.aarch64-cross.tmpl b/scripts/build/Dockerfile.aarch64-cross.tmpl
|
||||
deleted file mode 120000
|
||||
index 50eff9213..000000000
|
||||
--- a/scripts/build/Dockerfile.aarch64-cross.tmpl
|
||||
+++ /dev/null
|
||||
@@ -1 +0,0 @@
|
||||
-Dockerfile.cross.tmpl
|
||||
\ No newline at end of file
|
||||
diff --git a/scripts/build/Dockerfile.aarch64-cross.hdr b/scripts/build/Dockerfile.aarch64-stable-cross.hdr
|
||||
similarity index 100%
|
||||
rename from scripts/build/Dockerfile.aarch64-cross.hdr
|
||||
rename to scripts/build/Dockerfile.aarch64-stable-cross.hdr
|
||||
diff --git a/scripts/build/Dockerfile.aarch64-stable-cross.tmpl b/scripts/build/Dockerfile.aarch64-stable-cross.tmpl
|
||||
new file mode 120000
|
||||
index 000000000..81ef22980
|
||||
--- /dev/null
|
||||
+++ b/scripts/build/Dockerfile.aarch64-stable-cross.tmpl
|
||||
@@ -0,0 +1 @@
|
||||
+Dockerfile.stable-cross.tmpl
|
||||
\ No newline at end of file
|
||||
diff --git a/scripts/build/Dockerfile.armv7-cross.tmpl b/scripts/build/Dockerfile.armv7-cross.tmpl
|
||||
deleted file mode 120000
|
||||
index 50eff9213..000000000
|
||||
--- a/scripts/build/Dockerfile.armv7-cross.tmpl
|
||||
+++ /dev/null
|
||||
@@ -1 +0,0 @@
|
||||
-Dockerfile.cross.tmpl
|
||||
\ No newline at end of file
|
||||
diff --git a/scripts/build/Dockerfile.armv7-cross.hdr b/scripts/build/Dockerfile.armv7-stable-cross.hdr
|
||||
similarity index 100%
|
||||
rename from scripts/build/Dockerfile.armv7-cross.hdr
|
||||
rename to scripts/build/Dockerfile.armv7-stable-cross.hdr
|
||||
diff --git a/scripts/build/Dockerfile.armv7-stable-cross.tmpl b/scripts/build/Dockerfile.armv7-stable-cross.tmpl
|
||||
new file mode 120000
|
||||
index 000000000..81ef22980
|
||||
--- /dev/null
|
||||
+++ b/scripts/build/Dockerfile.armv7-stable-cross.tmpl
|
||||
@@ -0,0 +1 @@
|
||||
+Dockerfile.stable-cross.tmpl
|
||||
\ No newline at end of file
|
||||
diff --git a/scripts/build/Dockerfile.mips64el-cross.tmpl b/scripts/build/Dockerfile.mips64el-cross.tmpl
|
||||
deleted file mode 120000
|
||||
index 50eff9213..000000000
|
||||
--- a/scripts/build/Dockerfile.mips64el-cross.tmpl
|
||||
+++ /dev/null
|
||||
@@ -1 +0,0 @@
|
||||
-Dockerfile.cross.tmpl
|
||||
\ No newline at end of file
|
||||
diff --git a/scripts/build/Dockerfile.mips64el-cross.hdr b/scripts/build/Dockerfile.mips64el-stable-cross.hdr
|
||||
similarity index 100%
|
||||
rename from scripts/build/Dockerfile.mips64el-cross.hdr
|
||||
rename to scripts/build/Dockerfile.mips64el-stable-cross.hdr
|
||||
diff --git a/scripts/build/Dockerfile.mips64el-stable-cross.tmpl b/scripts/build/Dockerfile.mips64el-stable-cross.tmpl
|
||||
new file mode 120000
|
||||
index 000000000..81ef22980
|
||||
--- /dev/null
|
||||
+++ b/scripts/build/Dockerfile.mips64el-stable-cross.tmpl
|
||||
@@ -0,0 +1 @@
|
||||
+Dockerfile.stable-cross.tmpl
|
||||
\ No newline at end of file
|
||||
diff --git a/scripts/build/Dockerfile.ppc64-cross.tmpl b/scripts/build/Dockerfile.ppc64-cross.tmpl
|
||||
deleted file mode 120000
|
||||
index 50eff9213..000000000
|
||||
--- a/scripts/build/Dockerfile.ppc64-cross.tmpl
|
||||
+++ /dev/null
|
||||
@@ -1 +0,0 @@
|
||||
-Dockerfile.cross.tmpl
|
||||
\ No newline at end of file
|
||||
diff --git a/scripts/build/Dockerfile.ppc64-cross.hdr b/scripts/build/Dockerfile.ppc64-stable-cross.hdr
|
||||
similarity index 100%
|
||||
rename from scripts/build/Dockerfile.ppc64-cross.hdr
|
||||
rename to scripts/build/Dockerfile.ppc64-stable-cross.hdr
|
||||
diff --git a/scripts/build/Dockerfile.ppc64-stable-cross.tmpl b/scripts/build/Dockerfile.ppc64-stable-cross.tmpl
|
||||
new file mode 120000
|
||||
index 000000000..81ef22980
|
||||
--- /dev/null
|
||||
+++ b/scripts/build/Dockerfile.ppc64-stable-cross.tmpl
|
||||
@@ -0,0 +1 @@
|
||||
+Dockerfile.stable-cross.tmpl
|
||||
\ No newline at end of file
|
||||
diff --git a/scripts/build/Dockerfile.cross.tmpl b/scripts/build/Dockerfile.stable-cross.tmpl
|
||||
similarity index 88%
|
||||
rename from scripts/build/Dockerfile.cross.tmpl
|
||||
rename to scripts/build/Dockerfile.stable-cross.tmpl
|
||||
index 8b95fbb1c..6a68cd1ca 100644
|
||||
--- a/scripts/build/Dockerfile.cross.tmpl
|
||||
+++ b/scripts/build/Dockerfile.stable-cross.tmpl
|
||||
@@ -1,9 +1,8 @@
|
||||
COPY scripts/ci/apt-install /bin/apt-install
|
||||
|
||||
# Add the cross compiler sources
|
||||
-RUN echo "deb http://deb.debian.org/debian/ buster main" >> /etc/apt/sources.list && \
|
||||
- dpkg --add-architecture ${DEBIAN_ARCH} && \
|
||||
- apt-install emdebian-archive-keyring
|
||||
+RUN echo "deb http://deb.debian.org/debian/ stable main" >> /etc/apt/sources.list && \
|
||||
+ dpkg --add-architecture ${DEBIAN_ARCH}
|
||||
|
||||
RUN apt-install \
|
||||
crossbuild-essential-${DEBIAN_ARCH} \
|
||||
diff --git a/scripts/build/Makefile b/scripts/build/Makefile
|
||||
index 62e3a9920..a436c2839 100644
|
||||
--- a/scripts/build/Makefile
|
||||
+++ b/scripts/build/Makefile
|
||||
@@ -1,5 +1,5 @@
|
||||
ARCHES := x86_64 fedora-asan fedora-rawhide centos7 armv7hf centos8
|
||||
-NON_CLANG := armv7-cross aarch64-cross ppc64-cross mips64el-cross
|
||||
+NON_CLANG := armv7-stable-cross aarch64-stable-cross ppc64-stable-cross mips64el-stable-cross
|
||||
CREATE_DOCKERFILES := $(ARCHES) $(NON_CLANG)
|
||||
TARGETS := $(ARCHES) alpine archlinux
|
||||
TARGETS_CLANG := $(addsuffix $(TARGETS),-clang)
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,197 +0,0 @@
|
||||
From 5aaf82b4d8bd6c89f7e6b0f639c79b3a2d21eeef Mon Sep 17 00:00:00 2001
|
||||
From: Radostin Stoyanov <radostin@redhat.com>
|
||||
Date: Sat, 4 Dec 2021 16:31:34 +0000
|
||||
Subject: [PATCH 056/249] 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>
|
||||
---
|
||||
.github/workflows/cross-compile.yml | 11 ++++-
|
||||
.../Dockerfile.aarch64-testing-cross.hdr | 5 +++
|
||||
.../Dockerfile.aarch64-testing-cross.tmpl | 1 +
|
||||
.../build/Dockerfile.armv7-testing-cross.hdr | 6 +++
|
||||
.../build/Dockerfile.armv7-testing-cross.tmpl | 1 +
|
||||
.../Dockerfile.mips64el-testing-cross.hdr | 6 +++
|
||||
.../Dockerfile.mips64el-testing-cross.tmpl | 1 +
|
||||
.../build/Dockerfile.ppc64-testing-cross.hdr | 5 +++
|
||||
.../build/Dockerfile.ppc64-testing-cross.tmpl | 1 +
|
||||
scripts/build/Dockerfile.testing-cross.tmpl | 42 +++++++++++++++++++
|
||||
scripts/build/Makefile | 4 +-
|
||||
11 files changed, 81 insertions(+), 2 deletions(-)
|
||||
create mode 100644 scripts/build/Dockerfile.aarch64-testing-cross.hdr
|
||||
create mode 120000 scripts/build/Dockerfile.aarch64-testing-cross.tmpl
|
||||
create mode 100644 scripts/build/Dockerfile.armv7-testing-cross.hdr
|
||||
create mode 120000 scripts/build/Dockerfile.armv7-testing-cross.tmpl
|
||||
create mode 100644 scripts/build/Dockerfile.mips64el-testing-cross.hdr
|
||||
create mode 120000 scripts/build/Dockerfile.mips64el-testing-cross.tmpl
|
||||
create mode 100644 scripts/build/Dockerfile.ppc64-testing-cross.hdr
|
||||
create mode 120000 scripts/build/Dockerfile.ppc64-testing-cross.tmpl
|
||||
create mode 100644 scripts/build/Dockerfile.testing-cross.tmpl
|
||||
|
||||
diff --git a/.github/workflows/cross-compile.yml b/.github/workflows/cross-compile.yml
|
||||
index c6745d43e..eec6eb577 100644
|
||||
--- a/.github/workflows/cross-compile.yml
|
||||
+++ b/.github/workflows/cross-compile.yml
|
||||
@@ -8,7 +8,16 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
- target: [armv7-stable-cross, aarch64-stable-cross, ppc64-stable-cross, mips64el-stable-cross]
|
||||
+ target: [
|
||||
+ armv7-stable-cross,
|
||||
+ armv7-testing-cross,
|
||||
+ aarch64-stable-cross,
|
||||
+ aarch64-testing-cross,
|
||||
+ ppc64-stable-cross,
|
||||
+ ppc64-testing-cross,
|
||||
+ mips64el-stable-cross,
|
||||
+ mips64el-testing-cross
|
||||
+ ]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
diff --git a/scripts/build/Dockerfile.aarch64-testing-cross.hdr b/scripts/build/Dockerfile.aarch64-testing-cross.hdr
|
||||
new file mode 100644
|
||||
index 000000000..c61d2af27
|
||||
--- /dev/null
|
||||
+++ b/scripts/build/Dockerfile.aarch64-testing-cross.hdr
|
||||
@@ -0,0 +1,5 @@
|
||||
+FROM docker.io/dockcross/base:latest
|
||||
+
|
||||
+ENV ARCH=aarch64
|
||||
+ENV DEBIAN_ARCH=arm64
|
||||
+ENV CROSS_TRIPLET=aarch64-linux-gnu
|
||||
diff --git a/scripts/build/Dockerfile.aarch64-testing-cross.tmpl b/scripts/build/Dockerfile.aarch64-testing-cross.tmpl
|
||||
new file mode 120000
|
||||
index 000000000..c1dd38b21
|
||||
--- /dev/null
|
||||
+++ b/scripts/build/Dockerfile.aarch64-testing-cross.tmpl
|
||||
@@ -0,0 +1 @@
|
||||
+Dockerfile.testing-cross.tmpl
|
||||
\ No newline at end of file
|
||||
diff --git a/scripts/build/Dockerfile.armv7-testing-cross.hdr b/scripts/build/Dockerfile.armv7-testing-cross.hdr
|
||||
new file mode 100644
|
||||
index 000000000..f96dc51f7
|
||||
--- /dev/null
|
||||
+++ b/scripts/build/Dockerfile.armv7-testing-cross.hdr
|
||||
@@ -0,0 +1,6 @@
|
||||
+FROM docker.io/dockcross/base:latest
|
||||
+
|
||||
+ENV ARCH=arm
|
||||
+ENV SUBARCH=armv7
|
||||
+ENV DEBIAN_ARCH=armhf
|
||||
+ENV CROSS_TRIPLET=arm-linux-gnueabihf
|
||||
diff --git a/scripts/build/Dockerfile.armv7-testing-cross.tmpl b/scripts/build/Dockerfile.armv7-testing-cross.tmpl
|
||||
new file mode 120000
|
||||
index 000000000..c1dd38b21
|
||||
--- /dev/null
|
||||
+++ b/scripts/build/Dockerfile.armv7-testing-cross.tmpl
|
||||
@@ -0,0 +1 @@
|
||||
+Dockerfile.testing-cross.tmpl
|
||||
\ No newline at end of file
|
||||
diff --git a/scripts/build/Dockerfile.mips64el-testing-cross.hdr b/scripts/build/Dockerfile.mips64el-testing-cross.hdr
|
||||
new file mode 100644
|
||||
index 000000000..e78c94aa5
|
||||
--- /dev/null
|
||||
+++ b/scripts/build/Dockerfile.mips64el-testing-cross.hdr
|
||||
@@ -0,0 +1,6 @@
|
||||
+FROM dockcross/base:latest
|
||||
+
|
||||
+ENV ARCH=mips
|
||||
+ENV SUBARCH=mips
|
||||
+ENV DEBIAN_ARCH=mips64el
|
||||
+ENV CROSS_TRIPLET=mips64el-linux-gnuabi64
|
||||
diff --git a/scripts/build/Dockerfile.mips64el-testing-cross.tmpl b/scripts/build/Dockerfile.mips64el-testing-cross.tmpl
|
||||
new file mode 120000
|
||||
index 000000000..c1dd38b21
|
||||
--- /dev/null
|
||||
+++ b/scripts/build/Dockerfile.mips64el-testing-cross.tmpl
|
||||
@@ -0,0 +1 @@
|
||||
+Dockerfile.testing-cross.tmpl
|
||||
\ No newline at end of file
|
||||
diff --git a/scripts/build/Dockerfile.ppc64-testing-cross.hdr b/scripts/build/Dockerfile.ppc64-testing-cross.hdr
|
||||
new file mode 100644
|
||||
index 000000000..38547ac55
|
||||
--- /dev/null
|
||||
+++ b/scripts/build/Dockerfile.ppc64-testing-cross.hdr
|
||||
@@ -0,0 +1,5 @@
|
||||
+FROM dockcross/base:latest
|
||||
+
|
||||
+ENV ARCH=ppc64
|
||||
+ENV DEBIAN_ARCH=ppc64el
|
||||
+ENV CROSS_TRIPLET=powerpc64le-linux-gnu
|
||||
diff --git a/scripts/build/Dockerfile.ppc64-testing-cross.tmpl b/scripts/build/Dockerfile.ppc64-testing-cross.tmpl
|
||||
new file mode 120000
|
||||
index 000000000..c1dd38b21
|
||||
--- /dev/null
|
||||
+++ b/scripts/build/Dockerfile.ppc64-testing-cross.tmpl
|
||||
@@ -0,0 +1 @@
|
||||
+Dockerfile.testing-cross.tmpl
|
||||
\ No newline at end of file
|
||||
diff --git a/scripts/build/Dockerfile.testing-cross.tmpl b/scripts/build/Dockerfile.testing-cross.tmpl
|
||||
new file mode 100644
|
||||
index 000000000..1d5565310
|
||||
--- /dev/null
|
||||
+++ b/scripts/build/Dockerfile.testing-cross.tmpl
|
||||
@@ -0,0 +1,42 @@
|
||||
+COPY scripts/ci/apt-install /bin/apt-install
|
||||
+
|
||||
+# Add the cross compiler sources
|
||||
+RUN echo "deb http://deb.debian.org/debian/ testing main" >> /etc/apt/sources.list && \
|
||||
+ dpkg --add-architecture ${DEBIAN_ARCH}
|
||||
+
|
||||
+RUN apt-install \
|
||||
+ crossbuild-essential-${DEBIAN_ARCH} \
|
||||
+ libc6-dev-${DEBIAN_ARCH}-cross \
|
||||
+ libc6-${DEBIAN_ARCH}-cross \
|
||||
+ libbz2-dev:${DEBIAN_ARCH} \
|
||||
+ libexpat1-dev:${DEBIAN_ARCH} \
|
||||
+ ncurses-dev:${DEBIAN_ARCH} \
|
||||
+ libssl-dev:${DEBIAN_ARCH} \
|
||||
+ protobuf-c-compiler \
|
||||
+ protobuf-compiler \
|
||||
+ python3-protobuf \
|
||||
+ libnl-3-dev:${DEBIAN_ARCH} \
|
||||
+ libprotobuf-dev:${DEBIAN_ARCH} \
|
||||
+ libnet-dev:${DEBIAN_ARCH} \
|
||||
+ libprotobuf-c-dev:${DEBIAN_ARCH} \
|
||||
+ libcap-dev:${DEBIAN_ARCH} \
|
||||
+ libaio-dev:${DEBIAN_ARCH} \
|
||||
+ libnl-route-3-dev:${DEBIAN_ARCH}
|
||||
+
|
||||
+ENV CROSS_COMPILE=${CROSS_TRIPLET}- \
|
||||
+ CROSS_ROOT=/usr/${CROSS_TRIPLET} \
|
||||
+ AS=/usr/bin/${CROSS_TRIPLET}-as \
|
||||
+ AR=/usr/bin/${CROSS_TRIPLET}-ar \
|
||||
+ CC=/usr/bin/${CROSS_TRIPLET}-gcc \
|
||||
+ CPP=/usr/bin/${CROSS_TRIPLET}-cpp \
|
||||
+ CXX=/usr/bin/${CROSS_TRIPLET}-g++ \
|
||||
+ LD=/usr/bin/${CROSS_TRIPLET}-ld \
|
||||
+ FC=/usr/bin/${CROSS_TRIPLET}-gfortran
|
||||
+
|
||||
+ENV PATH="${PATH}:${CROSS_ROOT}/bin" \
|
||||
+ PKG_CONFIG_PATH=/usr/lib/${CROSS_TRIPLET}/pkgconfig
|
||||
+
|
||||
+COPY . /criu
|
||||
+WORKDIR /criu
|
||||
+
|
||||
+RUN make mrproper && date && make -j $(nproc) zdtm && date
|
||||
diff --git a/scripts/build/Makefile b/scripts/build/Makefile
|
||||
index a436c2839..b24fc80ea 100644
|
||||
--- a/scripts/build/Makefile
|
||||
+++ b/scripts/build/Makefile
|
||||
@@ -1,5 +1,7 @@
|
||||
ARCHES := x86_64 fedora-asan fedora-rawhide centos7 armv7hf centos8
|
||||
-NON_CLANG := armv7-stable-cross aarch64-stable-cross ppc64-stable-cross mips64el-stable-cross
|
||||
+STABLE_CROSS_ARCHES := armv7-stable-cross aarch64-stable-cross ppc64-stable-cross mips64el-stable-cross
|
||||
+TESTING_CROSS_ARCHES := armv7-testing-cross aarch64-testing-cross ppc64-testing-cross mips64el-testing-cross
|
||||
+NON_CLANG := $(TESTING_CROSS_ARCHES) $(STABLE_CROSS_ARCHES)
|
||||
CREATE_DOCKERFILES := $(ARCHES) $(NON_CLANG)
|
||||
TARGETS := $(ARCHES) alpine archlinux
|
||||
TARGETS_CLANG := $(addsuffix $(TARGETS),-clang)
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,48 +0,0 @@
|
||||
From 2ff0ffafa7e23b8a0e64ecd5da9d32e59782e2ee Mon Sep 17 00:00:00 2001
|
||||
From: Salvatore Bonaccorso <carnil@debian.org>
|
||||
Date: Sat, 4 Dec 2021 16:59:51 +0000
|
||||
Subject: [PATCH 057/249] 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>
|
||||
---
|
||||
Makefile | 2 +-
|
||||
test/zdtm/Makefile.inc | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index c0b8b7e54..f08d9be3a 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -39,7 +39,7 @@ ifeq ($(ARCH),arm)
|
||||
endif
|
||||
|
||||
ifeq ($(ARMV),7)
|
||||
- USERCFLAGS += -march=armv7-a
|
||||
+ USERCFLAGS += -march=armv7-a+fp
|
||||
endif
|
||||
|
||||
ifeq ($(ARMV),8)
|
||||
diff --git a/test/zdtm/Makefile.inc b/test/zdtm/Makefile.inc
|
||||
index 69154fdc9..d34523315 100644
|
||||
--- a/test/zdtm/Makefile.inc
|
||||
+++ b/test/zdtm/Makefile.inc
|
||||
@@ -25,7 +25,7 @@ ifeq ($(ARCH),arm)
|
||||
ifeq ($(ARMV),6)
|
||||
USERCFLAGS += -march=armv6
|
||||
else ifeq ($(ARMV),7)
|
||||
- USERCFLAGS += -march=armv7-a
|
||||
+ USERCFLAGS += -march=armv7-a+fp
|
||||
else ifeq ($(ARMV),8)
|
||||
# To build aarch32 on armv8 Travis-CI (see criu Makefile)
|
||||
USERCFLAGS += -march=armv7-a
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,59 +0,0 @@
|
||||
From 02eb97d17b8cf91831dd0a63e431b1399a4be42a Mon Sep 17 00:00:00 2001
|
||||
From: Adrian Reber <areber@redhat.com>
|
||||
Date: Fri, 3 Dec 2021 16:48:36 +0000
|
||||
Subject: [PATCH 058/249] 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>
|
||||
---
|
||||
scripts/ci/vagrant.sh | 6 +++---
|
||||
test/jenkins/criu-fault.sh | 8 ++++++++
|
||||
2 files changed, 11 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/scripts/ci/vagrant.sh b/scripts/ci/vagrant.sh
|
||||
index 839b100c8..25343f96c 100755
|
||||
--- a/scripts/ci/vagrant.sh
|
||||
+++ b/scripts/ci/vagrant.sh
|
||||
@@ -50,9 +50,9 @@ fedora-no-vdso() {
|
||||
vagrant reload
|
||||
ssh default cat /proc/cmdline
|
||||
ssh default 'cd /vagrant; tar xf criu.tar; cd criu; make -j 4'
|
||||
- # BPF tests are failing see: https://github.com/checkpoint-restore/criu/issues/1354
|
||||
- # Needs to be fixed, skip for now
|
||||
- ssh default 'cd /vagrant/criu/test; sudo ./zdtm.py run -a --keep-going -x zdtm/static/bpf_hash -x zdtm/static/bpf_array'
|
||||
+ # Disabling tests which are broken on 5.15
|
||||
+ # https://github.com/checkpoint-restore/criu/issues/1669
|
||||
+ ssh default 'cd /vagrant/criu/test; sudo ./zdtm.py run -a --keep-going -x zdtm/static/socket_close_data -x zdtm/static/socket_close_data01 -x zdtm/static/fifo_upon_unix_socket01 -x zdtm/static/sk-unix-mntns -x zdtm/static/fifo_upon_unix_socket00 -x zdtm/static/socket-ext -x zdtm/static/sk-unix01 -x zdtm/static/socket_dgram_data -x zdtm/static/sockets_dgram -x zdtm/static/sk-unix-dgram-ghost'
|
||||
# This test (pidfd_store_sk) requires pidfd_getfd syscall which is guaranteed in Fedora 33.
|
||||
# It is also skipped from -a because it runs in RPC mode only
|
||||
ssh default 'cd /vagrant/criu/test; sudo ./zdtm.py run -t zdtm/transition/pidfd_store_sk --rpc --pre 2'
|
||||
diff --git a/test/jenkins/criu-fault.sh b/test/jenkins/criu-fault.sh
|
||||
index a8c3a5cf7..bff40aed5 100755
|
||||
--- a/test/jenkins/criu-fault.sh
|
||||
+++ b/test/jenkins/criu-fault.sh
|
||||
@@ -28,6 +28,14 @@ fi
|
||||
./test/zdtm.py run -t zdtm/static/maps04 --fault 131 --keep-going --report report --pre 2:1 || fail
|
||||
./test/zdtm.py run -t zdtm/transition/maps008 --fault 131 --keep-going --report report --pre 2:1 || fail
|
||||
./test/zdtm.py run -t zdtm/static/maps01 --fault 132 -f h || fail
|
||||
+
|
||||
+# Error injection with --fault 134 fails on newer CPUs used in Circle CI on EC2
|
||||
+# Skip the --fault 134 tests
|
||||
+# https://github.com/checkpoint-restore/criu/issues/1635
|
||||
+if [ -n "$CIRCLECI" ]; then
|
||||
+ exit 0
|
||||
+fi
|
||||
+
|
||||
# 134 is corrupting extended registers set, should run in a sub-thread (fpu03)
|
||||
# without restore (that will check if parasite corrupts extended registers)
|
||||
./test/zdtm.py run -t zdtm/static/fpu03 --fault 134 -f h --norst || fail
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,101 +0,0 @@
|
||||
From 0c6248725ee00d152226d710f9f31362025acdc6 Mon Sep 17 00:00:00 2001
|
||||
From: Adrian Reber <areber@redhat.com>
|
||||
Date: Sun, 5 Dec 2021 16:45:20 +0000
|
||||
Subject: [PATCH 059/249] 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>
|
||||
---
|
||||
test/jenkins/criu-dedup.sh | 10 +++++-----
|
||||
test/jenkins/criu-fault.sh | 18 +++++++++---------
|
||||
test/jenkins/criu-fcg.sh | 12 ++++++------
|
||||
3 files changed, 20 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/test/jenkins/criu-dedup.sh b/test/jenkins/criu-dedup.sh
|
||||
index 0041496d8..edb1b653d 100755
|
||||
--- a/test/jenkins/criu-dedup.sh
|
||||
+++ b/test/jenkins/criu-dedup.sh
|
||||
@@ -9,8 +9,8 @@ prep
|
||||
# Additionally run these tests as they touch a lot of
|
||||
# memory and it makes sense to additionally check it
|
||||
# with delays between iterations
|
||||
-./test/zdtm.py run -t zdtm/transition/maps007 --keep-going --report report -f h --pre 8:.1 --dedup || fail
|
||||
-./test/zdtm.py run -t zdtm/static/mem-touch --keep-going --report report -f h --pre 8:.1 --dedup || fail
|
||||
-./test/zdtm.py run -t zdtm/transition/maps008 --keep-going --report report -f h --pre 8:.1 --dedup || fail
|
||||
-./test/zdtm.py run -t zdtm/transition/maps007 --keep-going --report report -f h --pre 8:.1 --noauto-dedup || fail
|
||||
-./test/zdtm.py run -t zdtm/static/mem-touch --keep-going --report report -f h --pre 8:.1 --noauto-dedup || fail
|
||||
+./test/zdtm.py run -t zdtm/transition/maps007 --report report -f h --pre 8:.1 --dedup || fail
|
||||
+./test/zdtm.py run -t zdtm/static/mem-touch --report report -f h --pre 8:.1 --dedup || fail
|
||||
+./test/zdtm.py run -t zdtm/transition/maps008 --report report -f h --pre 8:.1 --dedup || fail
|
||||
+./test/zdtm.py run -t zdtm/transition/maps007 --report report -f h --pre 8:.1 --noauto-dedup || fail
|
||||
+./test/zdtm.py run -t zdtm/static/mem-touch --report report -f h --pre 8:.1 --noauto-dedup || fail
|
||||
diff --git a/test/jenkins/criu-fault.sh b/test/jenkins/criu-fault.sh
|
||||
index bff40aed5..0c5c180e9 100755
|
||||
--- a/test/jenkins/criu-fault.sh
|
||||
+++ b/test/jenkins/criu-fault.sh
|
||||
@@ -4,10 +4,10 @@
|
||||
set -e
|
||||
source `dirname $0`/criu-lib.sh
|
||||
prep
|
||||
-./test/zdtm.py run -t zdtm/static/env00 --fault 1 --keep-going --report report -f h || fail
|
||||
-./test/zdtm.py run -t zdtm/static/unlink_fstat00 --fault 2 --keep-going --report report -f h || fail
|
||||
-./test/zdtm.py run -t zdtm/static/maps00 --fault 3 --keep-going --report report -f h || fail
|
||||
-./test/zdtm.py run -t zdtm/static/inotify_irmap --fault 128 --keep-going --pre 2 -f uns || fail
|
||||
+./test/zdtm.py run -t zdtm/static/env00 --fault 1 --report report -f h || fail
|
||||
+./test/zdtm.py run -t zdtm/static/unlink_fstat00 --fault 2 --report report -f h || fail
|
||||
+./test/zdtm.py run -t zdtm/static/maps00 --fault 3 --report report -f h || fail
|
||||
+./test/zdtm.py run -t zdtm/static/inotify_irmap --fault 128 --pre 2 -f uns || fail
|
||||
./test/zdtm.py run -t zdtm/static/env00 --fault 129 -f uns || fail
|
||||
./test/zdtm.py run -t zdtm/transition/fork --fault 130 -f h || fail
|
||||
./test/zdtm.py run -t zdtm/static/vdso01 --fault 127 || fail
|
||||
@@ -17,16 +17,16 @@ if [ "${COMPAT_TEST}" != "y" ] ; then
|
||||
./test/zdtm.py run -t zdtm/static/vdso01 --fault 133 -f h || fail
|
||||
fi
|
||||
|
||||
-./test/zdtm.py run -t zdtm/static/mntns_ghost --fault 2 --keep-going --report report || fail
|
||||
-./test/zdtm.py run -t zdtm/static/mntns_ghost --fault 4 --keep-going --report report || fail
|
||||
+./test/zdtm.py run -t zdtm/static/mntns_ghost --fault 2 --report report || fail
|
||||
+./test/zdtm.py run -t zdtm/static/mntns_ghost --fault 4 --report report || fail
|
||||
|
||||
./test/zdtm.py run -t zdtm/static/mntns_ghost --fault 6 --report report || fail
|
||||
./test/zdtm.py run -t zdtm/static/mntns_link_remap --fault 6 --report report || fail
|
||||
./test/zdtm.py run -t zdtm/static/unlink_fstat03 --fault 6 --report report || fail
|
||||
|
||||
-./test/zdtm.py run -t zdtm/static/env00 --fault 5 --keep-going --report report || fail
|
||||
-./test/zdtm.py run -t zdtm/static/maps04 --fault 131 --keep-going --report report --pre 2:1 || fail
|
||||
-./test/zdtm.py run -t zdtm/transition/maps008 --fault 131 --keep-going --report report --pre 2:1 || fail
|
||||
+./test/zdtm.py run -t zdtm/static/env00 --fault 5 --report report || fail
|
||||
+./test/zdtm.py run -t zdtm/static/maps04 --fault 131 --report report --pre 2:1 || fail
|
||||
+./test/zdtm.py run -t zdtm/transition/maps008 --fault 131 --report report --pre 2:1 || fail
|
||||
./test/zdtm.py run -t zdtm/static/maps01 --fault 132 -f h || fail
|
||||
|
||||
# Error injection with --fault 134 fails on newer CPUs used in Circle CI on EC2
|
||||
diff --git a/test/jenkins/criu-fcg.sh b/test/jenkins/criu-fcg.sh
|
||||
index ca5054f5e..81395b7ba 100755
|
||||
--- a/test/jenkins/criu-fcg.sh
|
||||
+++ b/test/jenkins/criu-fcg.sh
|
||||
@@ -6,10 +6,10 @@ source `dirname $0`/criu-lib.sh
|
||||
prep
|
||||
mount_tmpfs_to_dump
|
||||
|
||||
-./test/zdtm.py run -t zdtm/transition/thread-bomb -f h --keep-going --report report --freezecg zdtm:f || fail
|
||||
-./test/zdtm.py run -t zdtm/transition/thread-bomb -f h --keep-going --report report --freezecg zdtm:f --pre 3 || fail
|
||||
-./test/zdtm.py run -t zdtm/transition/thread-bomb -f h --keep-going --report report --freezecg zdtm:f --norst || fail
|
||||
+./test/zdtm.py run -t zdtm/transition/thread-bomb -f h --report report --freezecg zdtm:f || fail
|
||||
+./test/zdtm.py run -t zdtm/transition/thread-bomb -f h --report report --freezecg zdtm:f --pre 3 || fail
|
||||
+./test/zdtm.py run -t zdtm/transition/thread-bomb -f h --report report --freezecg zdtm:f --norst || fail
|
||||
|
||||
-./test/zdtm.py run -t zdtm/transition/thread-bomb -f h --keep-going --report report --freezecg zdtm:t || fail
|
||||
-./test/zdtm.py run -t zdtm/transition/thread-bomb -f h --keep-going --report report --freezecg zdtm:t --pre 3 || fail
|
||||
-./test/zdtm.py run -t zdtm/transition/thread-bomb -f h --keep-going --report report --freezecg zdtm:t --norst || fail
|
||||
+./test/zdtm.py run -t zdtm/transition/thread-bomb -f h --report report --freezecg zdtm:t || fail
|
||||
+./test/zdtm.py run -t zdtm/transition/thread-bomb -f h --report report --freezecg zdtm:t --pre 3 || fail
|
||||
+./test/zdtm.py run -t zdtm/transition/thread-bomb -f h --report report --freezecg zdtm:t --norst || fail
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,137 +0,0 @@
|
||||
From a446b513ccd5e91078cbc30cecfd4aa0634119f4 Mon Sep 17 00:00:00 2001
|
||||
From: ianlang <ianlang@tencent.com>
|
||||
Date: Fri, 3 Dec 2021 15:15:30 +0800
|
||||
Subject: [PATCH 060/249] 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>
|
||||
---
|
||||
criu/files-reg.c | 42 +++++++++++++++++++++++++++++++++++------
|
||||
criu/include/fs-magic.h | 4 ++++
|
||||
2 files changed, 40 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/criu/files-reg.c b/criu/files-reg.c
|
||||
index 1224b6ac2..141843a7a 100644
|
||||
--- a/criu/files-reg.c
|
||||
+++ b/criu/files-reg.c
|
||||
@@ -959,7 +959,25 @@ void free_link_remaps(void)
|
||||
}
|
||||
static int linkat_hard(int odir, char *opath, int ndir, char *npath, uid_t uid, gid_t gid, int flags);
|
||||
|
||||
-static int create_link_remap(char *path, int len, int lfd, u32 *idp, struct ns_id *nsid, const struct stat *st)
|
||||
+static void check_overlayfs_fallback(char *path, const struct fd_parms *parms, bool *fallback)
|
||||
+{
|
||||
+ if (!fallback || parms->fs_type != OVERLAYFS_SUPER_MAGIC)
|
||||
+ return;
|
||||
+
|
||||
+ /*
|
||||
+ * In overlayFS, linkat() fails with ENOENT if the removed file is
|
||||
+ * originated from lower layer. The cause of failure is that linkat()
|
||||
+ * sees the file has st_nlink=0, which is different than st_nlink=1 we
|
||||
+ * got from earlier fstat() on lfd. By setting *fb=true, we will fall
|
||||
+ * back to dump_ghost_remap() as it is what should have been done to
|
||||
+ * removed files with st_nlink=0.
|
||||
+ */
|
||||
+ pr_info("Unable to link-remap %s on overlayFS, fall back to dump_ghost_remap\n", path);
|
||||
+ *fallback = true;
|
||||
+}
|
||||
+
|
||||
+static int create_link_remap(char *path, int len, int lfd, u32 *idp, struct ns_id *nsid, const struct fd_parms *parms,
|
||||
+ bool *fallback)
|
||||
{
|
||||
char link_name[PATH_MAX], *tmp;
|
||||
FileEntry fe = FILE_ENTRY__INIT;
|
||||
@@ -967,6 +985,7 @@ static int create_link_remap(char *path, int len, int lfd, u32 *idp, struct ns_i
|
||||
FownEntry fwn = FOWN_ENTRY__INIT;
|
||||
int mntns_root;
|
||||
int ret;
|
||||
+ const struct stat *ost = &parms->stat;
|
||||
|
||||
if (!opts.link_remap_ok) {
|
||||
pr_err("Can't create link remap for %s. "
|
||||
@@ -1005,11 +1024,12 @@ static int create_link_remap(char *path, int len, int lfd, u32 *idp, struct ns_i
|
||||
mntns_root = mntns_get_root_fd(nsid);
|
||||
|
||||
again:
|
||||
- ret = linkat_hard(lfd, "", mntns_root, link_name, st->st_uid, st->st_gid, AT_EMPTY_PATH);
|
||||
+ ret = linkat_hard(lfd, "", mntns_root, link_name, ost->st_uid, ost->st_gid, AT_EMPTY_PATH);
|
||||
if (ret < 0 && errno == ENOENT) {
|
||||
/* Use grand parent, if parent directory does not exist. */
|
||||
if (trim_last_parent(link_name) < 0) {
|
||||
pr_err("trim failed: @%s@\n", link_name);
|
||||
+ check_overlayfs_fallback(path, parms, fallback);
|
||||
return -1;
|
||||
}
|
||||
goto again;
|
||||
@@ -1028,12 +1048,13 @@ again:
|
||||
return pb_write_one(img_from_set(glob_imgset, CR_FD_FILES), &fe, PB_FILE);
|
||||
}
|
||||
|
||||
-static int dump_linked_remap(char *path, int len, const struct stat *ost, int lfd, u32 id, struct ns_id *nsid)
|
||||
+static int dump_linked_remap(char *path, int len, const struct fd_parms *parms, int lfd, u32 id, struct ns_id *nsid,
|
||||
+ bool *fallback)
|
||||
{
|
||||
u32 lid;
|
||||
RemapFilePathEntry rpe = REMAP_FILE_PATH_ENTRY__INIT;
|
||||
|
||||
- if (create_link_remap(path, len, lfd, &lid, nsid, ost))
|
||||
+ if (create_link_remap(path, len, lfd, &lid, nsid, parms, fallback))
|
||||
return -1;
|
||||
|
||||
rpe.orig_id = id;
|
||||
@@ -1150,6 +1171,7 @@ static int check_path_remap(struct fd_link *link, const struct fd_parms *parms,
|
||||
struct stat pst;
|
||||
const struct stat *ost = &parms->stat;
|
||||
int flags = 0;
|
||||
+ bool fallback = false;
|
||||
|
||||
if (parms->fs_type == PROC_SUPER_MAGIC) {
|
||||
/* The file points to /proc/pid/<foo> where pid is a dead
|
||||
@@ -1239,7 +1261,7 @@ static int check_path_remap(struct fd_link *link, const struct fd_parms *parms,
|
||||
* links on it) to have some persistent name at hands.
|
||||
*/
|
||||
pr_debug("Dump silly-rename linked remap for %x\n", id);
|
||||
- return dump_linked_remap(rpath + 1, plen - 1, ost, lfd, id, nsid);
|
||||
+ return dump_linked_remap(rpath + 1, plen - 1, parms, lfd, id, nsid, NULL);
|
||||
}
|
||||
|
||||
mntns_root = mntns_get_root_fd(nsid);
|
||||
@@ -1260,7 +1282,15 @@ static int check_path_remap(struct fd_link *link, const struct fd_parms *parms,
|
||||
|
||||
if (errno == ENOENT) {
|
||||
link_strip_deleted(link);
|
||||
- return dump_linked_remap(rpath + 1, plen - 1, ost, lfd, id, nsid);
|
||||
+ ret = dump_linked_remap(rpath + 1, plen - 1, parms, lfd, id, nsid, &fallback);
|
||||
+ if (ret < 0 && fallback) {
|
||||
+ /* fallback is true only if following conditions are true:
|
||||
+ * 1. linkat() inside dump_linked_remap() failed with ENOENT
|
||||
+ * 2. parms->fs_type == overlayFS
|
||||
+ */
|
||||
+ return dump_ghost_remap(rpath + 1, ost, lfd, id, nsid);
|
||||
+ }
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
pr_perror("Can't stat path");
|
||||
diff --git a/criu/include/fs-magic.h b/criu/include/fs-magic.h
|
||||
index 46ac8aa27..ad34f4891 100644
|
||||
--- a/criu/include/fs-magic.h
|
||||
+++ b/criu/include/fs-magic.h
|
||||
@@ -53,4 +53,8 @@
|
||||
#define AUTOFS_SUPER_MAGIC 0x0187
|
||||
#endif
|
||||
|
||||
+#ifndef OVERLAYFS_SUPER_MAGIC
|
||||
+#define OVERLAYFS_SUPER_MAGIC 0x794c7630
|
||||
+#endif
|
||||
+
|
||||
#endif /* __CR_FS_MAGIC_H__ */
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,63 +0,0 @@
|
||||
From 0eed6f740c3f1efc580b62d59ee3efff64276077 Mon Sep 17 00:00:00 2001
|
||||
From: Adrian Reber <areber@redhat.com>
|
||||
Date: Tue, 7 Dec 2021 09:10:14 +0000
|
||||
Subject: [PATCH 061/249] 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>
|
||||
---
|
||||
criu/util.c | 15 +++++++++++----
|
||||
1 file changed, 11 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/criu/util.c b/criu/util.c
|
||||
index 2917102fd..822822186 100644
|
||||
--- a/criu/util.c
|
||||
+++ b/criu/util.c
|
||||
@@ -1107,7 +1107,7 @@ out:
|
||||
int run_tcp_server(bool daemon_mode, int *ask, int cfd, int sk)
|
||||
{
|
||||
int ret;
|
||||
- struct sockaddr_in caddr;
|
||||
+ struct sockaddr_storage caddr;
|
||||
socklen_t clen = sizeof(caddr);
|
||||
|
||||
if (daemon_mode) {
|
||||
@@ -1135,13 +1135,20 @@ int run_tcp_server(bool daemon_mode, int *ask, int cfd, int sk)
|
||||
return -1;
|
||||
|
||||
if (sk >= 0) {
|
||||
+ char port[6];
|
||||
+ char address[INET6_ADDRSTRLEN];
|
||||
*ask = accept(sk, (struct sockaddr *)&caddr, &clen);
|
||||
if (*ask < 0) {
|
||||
pr_perror("Can't accept connection to server");
|
||||
goto err;
|
||||
- } else
|
||||
- pr_info("Accepted connection from %s:%u\n", inet_ntoa(caddr.sin_addr),
|
||||
- (int)ntohs(caddr.sin_port));
|
||||
+ }
|
||||
+ ret = getnameinfo((struct sockaddr *)&caddr, clen, address, sizeof(address), port, sizeof(port),
|
||||
+ NI_NUMERICHOST | NI_NUMERICSERV);
|
||||
+ if (ret) {
|
||||
+ pr_err("Failed converting address: %s\n", gai_strerror(ret));
|
||||
+ goto err;
|
||||
+ }
|
||||
+ pr_info("Accepted connection from %s:%s\n", address, port);
|
||||
close(sk);
|
||||
}
|
||||
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,48 +0,0 @@
|
||||
From 7360c8d2a013f17c9cccad8305e63321b05f651d Mon Sep 17 00:00:00 2001
|
||||
From: Bui Quang Minh <minhquangbui99@gmail.com>
|
||||
Date: Thu, 2 Dec 2021 23:01:33 +0700
|
||||
Subject: [PATCH 062/249] 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>
|
||||
---
|
||||
criu/sk-unix.c | 10 +++-------
|
||||
1 file changed, 3 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/criu/sk-unix.c b/criu/sk-unix.c
|
||||
index a819473b4..d3402c3ac 100644
|
||||
--- a/criu/sk-unix.c
|
||||
+++ b/criu/sk-unix.c
|
||||
@@ -460,7 +460,7 @@ static int dump_one_unix_fd(int lfd, uint32_t id, const struct fd_parms *p)
|
||||
pr_warn("Shutdown mismatch %u:%d -> %u:%d\n", ue->ino, ue->shutdown, peer->sd.ino,
|
||||
peer->shutdown);
|
||||
}
|
||||
- } else if (ue->state == TCP_ESTABLISHED) {
|
||||
+ } else if (ue->state == TCP_ESTABLISHED && ue->type != SOCK_DGRAM) {
|
||||
const struct unix_sk_listen_icon *e;
|
||||
|
||||
e = lookup_unix_listen_icons(ue->ino);
|
||||
@@ -1851,14 +1851,10 @@ static int open_unixsk_standalone(struct unix_sk_info *ui, int *new_fd)
|
||||
|
||||
close(sks[1]);
|
||||
sk = sks[0];
|
||||
- } else if (ui->ue->state == TCP_ESTABLISHED && queuer && queuer->ue->ino == FAKE_INO) {
|
||||
+ } else if ((ui->ue->state == TCP_ESTABLISHED && ui->ue->type == SOCK_STREAM) && queuer &&
|
||||
+ queuer->ue->ino == FAKE_INO) {
|
||||
int ret, sks[2];
|
||||
|
||||
- if (ui->ue->type != SOCK_STREAM) {
|
||||
- pr_err("Non-stream socket %u in established state\n", ui->ue->ino);
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
if (ui->ue->shutdown != SK_SHUTDOWN__BOTH) {
|
||||
pr_err("Wrong shutdown/peer state for %u\n", ui->ue->ino);
|
||||
return -1;
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,34 +0,0 @@
|
||||
From 1d4d1d36e6b01b0ec7d87e3f0c6e6464929f9e21 Mon Sep 17 00:00:00 2001
|
||||
From: Bui Quang Minh <minhquangbui99@gmail.com>
|
||||
Date: Tue, 7 Dec 2021 23:40:12 +0700
|
||||
Subject: [PATCH 063/249] 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>
|
||||
---
|
||||
scripts/ci/vagrant.sh | 4 +---
|
||||
1 file changed, 1 insertion(+), 3 deletions(-)
|
||||
|
||||
diff --git a/scripts/ci/vagrant.sh b/scripts/ci/vagrant.sh
|
||||
index 25343f96c..40c8416e1 100755
|
||||
--- a/scripts/ci/vagrant.sh
|
||||
+++ b/scripts/ci/vagrant.sh
|
||||
@@ -50,9 +50,7 @@ fedora-no-vdso() {
|
||||
vagrant reload
|
||||
ssh default cat /proc/cmdline
|
||||
ssh default 'cd /vagrant; tar xf criu.tar; cd criu; make -j 4'
|
||||
- # Disabling tests which are broken on 5.15
|
||||
- # https://github.com/checkpoint-restore/criu/issues/1669
|
||||
- ssh default 'cd /vagrant/criu/test; sudo ./zdtm.py run -a --keep-going -x zdtm/static/socket_close_data -x zdtm/static/socket_close_data01 -x zdtm/static/fifo_upon_unix_socket01 -x zdtm/static/sk-unix-mntns -x zdtm/static/fifo_upon_unix_socket00 -x zdtm/static/socket-ext -x zdtm/static/sk-unix01 -x zdtm/static/socket_dgram_data -x zdtm/static/sockets_dgram -x zdtm/static/sk-unix-dgram-ghost'
|
||||
+ ssh default 'cd /vagrant/criu/test; sudo ./zdtm.py run -a --keep-going'
|
||||
# This test (pidfd_store_sk) requires pidfd_getfd syscall which is guaranteed in Fedora 33.
|
||||
# It is also skipped from -a because it runs in RPC mode only
|
||||
ssh default 'cd /vagrant/criu/test; sudo ./zdtm.py run -t zdtm/transition/pidfd_store_sk --rpc --pre 2'
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,29 +0,0 @@
|
||||
From 6ed22ff628c5cca460584b25be6c5bc7a241b01c Mon Sep 17 00:00:00 2001
|
||||
From: Radostin Stoyanov <radostin@redhat.com>
|
||||
Date: Fri, 10 Dec 2021 15:35:29 +0000
|
||||
Subject: [PATCH 064/249] 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>
|
||||
---
|
||||
scripts/build/Dockerfile.alpine | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/scripts/build/Dockerfile.alpine b/scripts/build/Dockerfile.alpine
|
||||
index a6579c0bb..cab72e8a1 100644
|
||||
--- a/scripts/build/Dockerfile.alpine
|
||||
+++ b/scripts/build/Dockerfile.alpine
|
||||
@@ -6,6 +6,7 @@ RUN apk update && apk add \
|
||||
bash \
|
||||
build-base \
|
||||
coreutils \
|
||||
+ procps \
|
||||
git \
|
||||
gnutls-dev \
|
||||
libaio-dev \
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,34 +0,0 @@
|
||||
From afa186872a305406482e8d1ff02aae092a9dfdc0 Mon Sep 17 00:00:00 2001
|
||||
From: Adrian Reber <areber@redhat.com>
|
||||
Date: Fri, 3 Dec 2021 16:59:56 +0000
|
||||
Subject: [PATCH 065/249] test: another try to correctly fix the kernel version
|
||||
|
||||
We try to disable time namespace based testing for kernels older than
|
||||
5.11. But we fail to come up with the correct if condition.
|
||||
|
||||
This changes (major <= 5) to (major < 5). There are no kernels with
|
||||
major > 5 so currently the time namespace based are never run. This
|
||||
should finally change it to run time namespace based tests on kernel
|
||||
versions newer than 5.10.
|
||||
|
||||
Signed-off-by: Adrian Reber <areber@redhat.com>
|
||||
---
|
||||
test/zdtm_ct.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/test/zdtm_ct.c b/test/zdtm_ct.c
|
||||
index e8d45a9e7..e4b17a512 100644
|
||||
--- a/test/zdtm_ct.c
|
||||
+++ b/test/zdtm_ct.c
|
||||
@@ -61,7 +61,7 @@ static int create_timens()
|
||||
if (sscanf(buf.release, "%u.%u", &major, &minor) != 2)
|
||||
return -1;
|
||||
|
||||
- if ((major <= 5) || (major == 5 && minor < 11)) {
|
||||
+ if ((major < 5) || (major == 5 && minor < 11)) {
|
||||
fprintf(stderr, "timens isn't supported on %s\n", buf.release);
|
||||
return 0;
|
||||
}
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,59 +0,0 @@
|
||||
From 80cabb69fb7bc028e632796a48b930c2238ddd08 Mon Sep 17 00:00:00 2001
|
||||
From: Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com>
|
||||
Date: Mon, 13 Dec 2021 15:19:50 +0300
|
||||
Subject: [PATCH 066/249] x86/compel/fault-inject: bound xsave features set
|
||||
|
||||
Since
|
||||
e2e8be37 ("x86/compel/fault-inject: Add a fault-injection for corrupting extended regset")
|
||||
we doing fault-injection test for C/R of threads register set by filling tasks
|
||||
xsave structures with the garbage. But there are some features for which that's not
|
||||
safe. It leads to failures like described in #1635
|
||||
|
||||
In this particular case we meet the problem with PKRU feature, the problem
|
||||
that after corrupting pkru registers we may restrict access to some vma areas,
|
||||
so, after that process with the parasite injected get's segfault and crashes.
|
||||
|
||||
Let's manually specify which features is save to fill with the garbage by
|
||||
keeping proper XFEATURE_MASK_FAULTINJ mask value.
|
||||
|
||||
Fixes: e2e8be37 ("x86/compel/fault-inject: Add a fault-injection for corrupting extended regset")
|
||||
|
||||
https://github.com/checkpoint-restore/criu/issues/1635
|
||||
|
||||
Signed-off-by: Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com>
|
||||
---
|
||||
compel/arch/x86/src/lib/include/uapi/asm/fpu.h | 5 +++++
|
||||
compel/arch/x86/src/lib/infect.c | 1 +
|
||||
2 files changed, 6 insertions(+)
|
||||
|
||||
diff --git a/compel/arch/x86/src/lib/include/uapi/asm/fpu.h b/compel/arch/x86/src/lib/include/uapi/asm/fpu.h
|
||||
index a16b658af..c8ebda097 100644
|
||||
--- a/compel/arch/x86/src/lib/include/uapi/asm/fpu.h
|
||||
+++ b/compel/arch/x86/src/lib/include/uapi/asm/fpu.h
|
||||
@@ -80,6 +80,11 @@ enum xfeature {
|
||||
(XFEATURE_MASK_FP | XFEATURE_MASK_SSE | XFEATURE_MASK_YMM | XFEATURE_MASK_OPMASK | XFEATURE_MASK_ZMM_Hi256 | \
|
||||
XFEATURE_MASK_Hi16_ZMM | XFEATURE_MASK_PKRU | XFEATURE_MASK_BNDREGS | XFEATURE_MASK_BNDCSR)
|
||||
|
||||
+/* xsave structure features which is safe to fill with garbage (see validate_random_xstate()) */
|
||||
+#define XFEATURE_MASK_FAULTINJ \
|
||||
+ (XFEATURE_MASK_FP | XFEATURE_MASK_SSE | XFEATURE_MASK_YMM | XFEATURE_MASK_OPMASK | XFEATURE_MASK_ZMM_Hi256 | \
|
||||
+ XFEATURE_MASK_Hi16_ZMM)
|
||||
+
|
||||
struct fpx_sw_bytes {
|
||||
uint32_t magic1;
|
||||
uint32_t extended_size;
|
||||
diff --git a/compel/arch/x86/src/lib/infect.c b/compel/arch/x86/src/lib/infect.c
|
||||
index 2f6c557d0..37b0ee327 100644
|
||||
--- a/compel/arch/x86/src/lib/infect.c
|
||||
+++ b/compel/arch/x86/src/lib/infect.c
|
||||
@@ -254,6 +254,7 @@ static void validate_random_xstate(struct xsave_struct *xsave)
|
||||
/* No unknown or supervisor features may be set */
|
||||
hdr->xstate_bv &= XFEATURE_MASK_USER;
|
||||
hdr->xstate_bv &= ~XFEATURE_MASK_SUPERVISOR;
|
||||
+ hdr->xstate_bv &= XFEATURE_MASK_FAULTINJ;
|
||||
|
||||
for (i = 0; i < XFEATURE_MAX; i++) {
|
||||
if (!compel_fpu_has_feature(i))
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,41 +0,0 @@
|
||||
From efd0cc2c4fba3bc72133f022e3fe393a0346cb51 Mon Sep 17 00:00:00 2001
|
||||
From: Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com>
|
||||
Date: Mon, 13 Dec 2021 15:32:00 +0300
|
||||
Subject: [PATCH 067/249] x86/compel/fault-inject: print the initial seed
|
||||
|
||||
Fixes: e2e8be37 ("x86/compel/fault-inject: Add a fault-injection for corrupting extended regset")
|
||||
|
||||
Signed-off-by: Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com>
|
||||
---
|
||||
compel/arch/x86/src/lib/infect.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/compel/arch/x86/src/lib/infect.c b/compel/arch/x86/src/lib/infect.c
|
||||
index 37b0ee327..de9013c27 100644
|
||||
--- a/compel/arch/x86/src/lib/infect.c
|
||||
+++ b/compel/arch/x86/src/lib/infect.c
|
||||
@@ -283,10 +283,10 @@ static int corrupt_extregs(pid_t pid)
|
||||
bool use_xsave = compel_cpu_has_feature(X86_FEATURE_OSXSAVE);
|
||||
user_fpregs_struct_t ext_regs;
|
||||
int *rand_to = (int *)&ext_regs;
|
||||
- unsigned int seed;
|
||||
+ unsigned int seed, init_seed;
|
||||
size_t i;
|
||||
|
||||
- seed = time(NULL);
|
||||
+ init_seed = seed = time(NULL);
|
||||
for (i = 0; i < sizeof(ext_regs) / sizeof(int); i++)
|
||||
*rand_to++ = rand_r(&seed);
|
||||
|
||||
@@ -296,7 +296,7 @@ static int corrupt_extregs(pid_t pid)
|
||||
* - zdtm.py will grep it auto-magically from logs
|
||||
* (and the seed will be known from an automatical testing)
|
||||
*/
|
||||
- pr_err("Corrupting %s for %d, seed %u\n", use_xsave ? "xsave" : "fpuregs", pid, seed);
|
||||
+ pr_err("Corrupting %s for %d, seed %u\n", use_xsave ? "xsave" : "fpuregs", pid, init_seed);
|
||||
|
||||
if (!use_xsave) {
|
||||
if (ptrace(PTRACE_SETFPREGS, pid, NULL, &ext_regs)) {
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,32 +0,0 @@
|
||||
From e92aca9152507f3800cb39a8d9a1acc7ca5e130a Mon Sep 17 00:00:00 2001
|
||||
From: Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com>
|
||||
Date: Mon, 13 Dec 2021 15:46:47 +0300
|
||||
Subject: [PATCH 068/249] ci: enable x86 xsave fault injection tests back
|
||||
|
||||
Signed-off-by: Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com>
|
||||
---
|
||||
test/jenkins/criu-fault.sh | 8 --------
|
||||
1 file changed, 8 deletions(-)
|
||||
|
||||
diff --git a/test/jenkins/criu-fault.sh b/test/jenkins/criu-fault.sh
|
||||
index 0c5c180e9..9f20091cc 100755
|
||||
--- a/test/jenkins/criu-fault.sh
|
||||
+++ b/test/jenkins/criu-fault.sh
|
||||
@@ -28,14 +28,6 @@ fi
|
||||
./test/zdtm.py run -t zdtm/static/maps04 --fault 131 --report report --pre 2:1 || fail
|
||||
./test/zdtm.py run -t zdtm/transition/maps008 --fault 131 --report report --pre 2:1 || fail
|
||||
./test/zdtm.py run -t zdtm/static/maps01 --fault 132 -f h || fail
|
||||
-
|
||||
-# Error injection with --fault 134 fails on newer CPUs used in Circle CI on EC2
|
||||
-# Skip the --fault 134 tests
|
||||
-# https://github.com/checkpoint-restore/criu/issues/1635
|
||||
-if [ -n "$CIRCLECI" ]; then
|
||||
- exit 0
|
||||
-fi
|
||||
-
|
||||
# 134 is corrupting extended registers set, should run in a sub-thread (fpu03)
|
||||
# without restore (that will check if parasite corrupts extended registers)
|
||||
./test/zdtm.py run -t zdtm/static/fpu03 --fault 134 -f h --norst || fail
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,48 +0,0 @@
|
||||
From b1c13f61a2012f35466768be1de0b3761934fc3a Mon Sep 17 00:00:00 2001
|
||||
From: Radostin Stoyanov <radostin@redhat.com>
|
||||
Date: Tue, 14 Dec 2021 12:54:19 +0000
|
||||
Subject: [PATCH 069/249] Add documentation for --timeout option
|
||||
|
||||
The --timeout option was introduced in [1] to prevent criu dump from
|
||||
being able to hang indefinitely and allow users to adjust the time limit
|
||||
in seconds for collecting tasks during the dump operation.
|
||||
|
||||
[1] https://github.com/checkpoint-restore/criu/commit/d0ff730
|
||||
|
||||
Signed-off-by: Radostin Stoyanov <radostin@redhat.com>
|
||||
---
|
||||
Documentation/criu.txt | 4 ++++
|
||||
criu/crtools.c | 2 ++
|
||||
2 files changed, 6 insertions(+)
|
||||
|
||||
diff --git a/Documentation/criu.txt b/Documentation/criu.txt
|
||||
index 4c6885fc9..f41b1898c 100644
|
||||
--- a/Documentation/criu.txt
|
||||
+++ b/Documentation/criu.txt
|
||||
@@ -367,6 +367,10 @@ mount -t cgroup -o devices,freezer none devices,freezer
|
||||
Allows to link unlinked files back, if possible (modifies filesystem
|
||||
during *restore*).
|
||||
|
||||
+*--timeout* 'number'::
|
||||
+ Set a time limit in seconds for collecting tasks during the
|
||||
+ dump operation. The timeout is 10 seconds by default.
|
||||
+
|
||||
*--ghost-limit* 'size'::
|
||||
Set the maximum size of deleted file to be carried inside image.
|
||||
By default, up to 1M file is allowed. Using this
|
||||
diff --git a/criu/crtools.c b/criu/crtools.c
|
||||
index 81c0aa963..da47bd684 100644
|
||||
--- a/criu/crtools.c
|
||||
+++ b/criu/crtools.c
|
||||
@@ -391,6 +391,8 @@ usage:
|
||||
" -j|--" OPT_SHELL_JOB " allow one to dump and restore shell jobs\n"
|
||||
" -l|--" OPT_FILE_LOCKS " handle file locks, for safety, only used for container\n"
|
||||
" -L|--libdir path to a plugin directory (by default " CR_PLUGIN_DEFAULT ")\n"
|
||||
+ " --timeout NUM a timeout (in seconds) on collecting tasks during dump\n"
|
||||
+ " (default 10 seconds)\n"
|
||||
" --force-irmap force resolving names for inotify/fsnotify watches\n"
|
||||
" --irmap-scan-path FILE\n"
|
||||
" add a path the irmap hints to scan\n"
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,32 +0,0 @@
|
||||
From a03504744be5e55913c690bf1ed26b0f0182af1d Mon Sep 17 00:00:00 2001
|
||||
From: Andrei Vagin <avagin@google.com>
|
||||
Date: Tue, 14 Dec 2021 08:19:16 -0800
|
||||
Subject: [PATCH 070/249] usernsd: UNS_FDOUT should not require an input
|
||||
descriptor
|
||||
|
||||
UNS_FDOUT means only that a userns call will return a file descriptor.
|
||||
|
||||
Signed-off-by: Andrei Vagin <avagin@google.com>
|
||||
---
|
||||
criu/namespaces.c | 5 -----
|
||||
1 file changed, 5 deletions(-)
|
||||
|
||||
diff --git a/criu/namespaces.c b/criu/namespaces.c
|
||||
index 7fa58682b..c36e631cf 100644
|
||||
--- a/criu/namespaces.c
|
||||
+++ b/criu/namespaces.c
|
||||
@@ -1330,11 +1330,6 @@ static int usernsd(int sk)
|
||||
unsc_msg_pid_fd(&um, &pid, &fd);
|
||||
pr_debug("uns: daemon calls %p (%d, %d, %x)\n", call, pid, fd, flags);
|
||||
|
||||
- if (fd < 0 && flags & UNS_FDOUT) {
|
||||
- pr_err("uns: bad flags/fd %p %d %x\n", call, fd, flags);
|
||||
- BUG();
|
||||
- }
|
||||
-
|
||||
/*
|
||||
* Caller has sent us bare address of the routine it
|
||||
* wants to call. Since the caller is fork()-ed from the
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,67 +0,0 @@
|
||||
From c94a71639925fd56fa59bdf74ba416f3306c1a72 Mon Sep 17 00:00:00 2001
|
||||
From: Adrian Reber <areber@redhat.com>
|
||||
Date: Wed, 1 Dec 2021 11:08:53 +0000
|
||||
Subject: [PATCH 071/249] libcriu: add setting lsm-mount-context to libcriu
|
||||
|
||||
Signed-off-by: Adrian Reber <areber@redhat.com>
|
||||
---
|
||||
lib/c/criu.c | 15 +++++++++++++++
|
||||
lib/c/criu.h | 2 ++
|
||||
2 files changed, 17 insertions(+)
|
||||
|
||||
diff --git a/lib/c/criu.c b/lib/c/criu.c
|
||||
index ddc6e0731..4ee189aca 100644
|
||||
--- a/lib/c/criu.c
|
||||
+++ b/lib/c/criu.c
|
||||
@@ -238,6 +238,7 @@ void criu_local_free_opts(criu_opts *opts)
|
||||
free(opts->rpc->freeze_cgroup);
|
||||
free(opts->rpc->log_file);
|
||||
free(opts->rpc->lsm_profile);
|
||||
+ free(opts->rpc->lsm_mount_context);
|
||||
free(opts->rpc);
|
||||
criu_free_service(opts);
|
||||
free(opts);
|
||||
@@ -651,6 +652,20 @@ int criu_set_lsm_profile(const char *name)
|
||||
return criu_local_set_lsm_profile(global_opts, name);
|
||||
}
|
||||
|
||||
+int criu_local_set_lsm_mount_context(criu_opts *opts, const char *name)
|
||||
+{
|
||||
+ opts->rpc->lsm_mount_context = strdup(name);
|
||||
+ if (opts->rpc->lsm_mount_context == NULL) {
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int criu_set_lsm_mount_context(const char *name)
|
||||
+{
|
||||
+ return criu_local_set_lsm_mount_context(global_opts, name);
|
||||
+}
|
||||
+
|
||||
void criu_local_set_timeout(criu_opts *opts, unsigned int timeout)
|
||||
{
|
||||
opts->rpc->timeout = timeout;
|
||||
diff --git a/lib/c/criu.h b/lib/c/criu.h
|
||||
index 949902f55..a374b37f8 100644
|
||||
--- a/lib/c/criu.h
|
||||
+++ b/lib/c/criu.h
|
||||
@@ -92,6 +92,7 @@ void criu_set_manage_cgroups(bool manage);
|
||||
void criu_set_manage_cgroups_mode(enum criu_cg_mode mode);
|
||||
int criu_set_freeze_cgroup(const char *name);
|
||||
int criu_set_lsm_profile(const char *name);
|
||||
+int criu_set_lsm_mount_context(const char *name);
|
||||
void criu_set_timeout(unsigned int timeout);
|
||||
void criu_set_auto_ext_mnt(bool val);
|
||||
void criu_set_ext_sharing(bool val);
|
||||
@@ -249,6 +250,7 @@ void criu_local_set_manage_cgroups(criu_opts *opts, bool manage);
|
||||
void criu_local_set_manage_cgroups_mode(criu_opts *opts, enum criu_cg_mode mode);
|
||||
int criu_local_set_freeze_cgroup(criu_opts *opts, const char *name);
|
||||
int criu_local_set_lsm_profile(criu_opts *opts, const char *name);
|
||||
+int criu_local_set_lsm_mount_context(criu_opts *opts, const char *name);
|
||||
void criu_local_set_timeout(criu_opts *opts, unsigned int timeout);
|
||||
void criu_local_set_auto_ext_mnt(criu_opts *opts, bool val);
|
||||
void criu_local_set_ext_sharing(criu_opts *opts, bool val);
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,182 +0,0 @@
|
||||
From eb0323c25ea6d3ddab0e85c9f24d29154155ae4f Mon Sep 17 00:00:00 2001
|
||||
From: Radostin Stoyanov <rstoyanov@fedoraproject.org>
|
||||
Date: Sat, 18 Dec 2021 17:25:17 +0000
|
||||
Subject: [PATCH 072/249] ci: use unstable release for cross-compile
|
||||
|
||||
We added cross-compile tests with testing debian release to be able to
|
||||
replicate the error reported in #1653, however, installing build
|
||||
dependencies in this release currently fails with the following error:
|
||||
|
||||
libc6-dev:armhf : Breaks: libc6-dev-armhf-cross (< 2.33~) but 2.32-1cross4 is to be installed
|
||||
|
||||
This is not something we can fix, therefore using the debian unstable
|
||||
release (instead of testing) could be more reliable option for our CI.
|
||||
This would still replicate the problem reported in #1653.
|
||||
|
||||
Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
|
||||
---
|
||||
.github/workflows/cross-compile.yml | 8 ++++----
|
||||
scripts/build/Dockerfile.aarch64-testing-cross.tmpl | 1 -
|
||||
...ng-cross.hdr => Dockerfile.aarch64-unstable-cross.hdr} | 0
|
||||
scripts/build/Dockerfile.aarch64-unstable-cross.tmpl | 1 +
|
||||
scripts/build/Dockerfile.armv7-testing-cross.tmpl | 1 -
|
||||
...ting-cross.hdr => Dockerfile.armv7-unstable-cross.hdr} | 0
|
||||
scripts/build/Dockerfile.armv7-unstable-cross.tmpl | 1 +
|
||||
scripts/build/Dockerfile.mips64el-testing-cross.tmpl | 1 -
|
||||
...g-cross.hdr => Dockerfile.mips64el-unstable-cross.hdr} | 0
|
||||
scripts/build/Dockerfile.mips64el-unstable-cross.tmpl | 1 +
|
||||
scripts/build/Dockerfile.ppc64-testing-cross.tmpl | 1 -
|
||||
...ting-cross.hdr => Dockerfile.ppc64-unstable-cross.hdr} | 0
|
||||
scripts/build/Dockerfile.ppc64-unstable-cross.tmpl | 1 +
|
||||
....testing-cross.tmpl => Dockerfile.unstable-cross.tmpl} | 2 +-
|
||||
scripts/build/Makefile | 4 ++--
|
||||
15 files changed, 11 insertions(+), 11 deletions(-)
|
||||
delete mode 120000 scripts/build/Dockerfile.aarch64-testing-cross.tmpl
|
||||
rename scripts/build/{Dockerfile.aarch64-testing-cross.hdr => Dockerfile.aarch64-unstable-cross.hdr} (100%)
|
||||
create mode 120000 scripts/build/Dockerfile.aarch64-unstable-cross.tmpl
|
||||
delete mode 120000 scripts/build/Dockerfile.armv7-testing-cross.tmpl
|
||||
rename scripts/build/{Dockerfile.armv7-testing-cross.hdr => Dockerfile.armv7-unstable-cross.hdr} (100%)
|
||||
create mode 120000 scripts/build/Dockerfile.armv7-unstable-cross.tmpl
|
||||
delete mode 120000 scripts/build/Dockerfile.mips64el-testing-cross.tmpl
|
||||
rename scripts/build/{Dockerfile.mips64el-testing-cross.hdr => Dockerfile.mips64el-unstable-cross.hdr} (100%)
|
||||
create mode 120000 scripts/build/Dockerfile.mips64el-unstable-cross.tmpl
|
||||
delete mode 120000 scripts/build/Dockerfile.ppc64-testing-cross.tmpl
|
||||
rename scripts/build/{Dockerfile.ppc64-testing-cross.hdr => Dockerfile.ppc64-unstable-cross.hdr} (100%)
|
||||
create mode 120000 scripts/build/Dockerfile.ppc64-unstable-cross.tmpl
|
||||
rename scripts/build/{Dockerfile.testing-cross.tmpl => Dockerfile.unstable-cross.tmpl} (93%)
|
||||
|
||||
diff --git a/.github/workflows/cross-compile.yml b/.github/workflows/cross-compile.yml
|
||||
index eec6eb577..461a6e618 100644
|
||||
--- a/.github/workflows/cross-compile.yml
|
||||
+++ b/.github/workflows/cross-compile.yml
|
||||
@@ -10,13 +10,13 @@ jobs:
|
||||
matrix:
|
||||
target: [
|
||||
armv7-stable-cross,
|
||||
- armv7-testing-cross,
|
||||
+ armv7-unstable-cross,
|
||||
aarch64-stable-cross,
|
||||
- aarch64-testing-cross,
|
||||
+ aarch64-unstable-cross,
|
||||
ppc64-stable-cross,
|
||||
- ppc64-testing-cross,
|
||||
+ ppc64-unstable-cross,
|
||||
mips64el-stable-cross,
|
||||
- mips64el-testing-cross
|
||||
+ mips64el-unstable-cross
|
||||
]
|
||||
|
||||
steps:
|
||||
diff --git a/scripts/build/Dockerfile.aarch64-testing-cross.tmpl b/scripts/build/Dockerfile.aarch64-testing-cross.tmpl
|
||||
deleted file mode 120000
|
||||
index c1dd38b21..000000000
|
||||
--- a/scripts/build/Dockerfile.aarch64-testing-cross.tmpl
|
||||
+++ /dev/null
|
||||
@@ -1 +0,0 @@
|
||||
-Dockerfile.testing-cross.tmpl
|
||||
\ No newline at end of file
|
||||
diff --git a/scripts/build/Dockerfile.aarch64-testing-cross.hdr b/scripts/build/Dockerfile.aarch64-unstable-cross.hdr
|
||||
similarity index 100%
|
||||
rename from scripts/build/Dockerfile.aarch64-testing-cross.hdr
|
||||
rename to scripts/build/Dockerfile.aarch64-unstable-cross.hdr
|
||||
diff --git a/scripts/build/Dockerfile.aarch64-unstable-cross.tmpl b/scripts/build/Dockerfile.aarch64-unstable-cross.tmpl
|
||||
new file mode 120000
|
||||
index 000000000..955ae1fd4
|
||||
--- /dev/null
|
||||
+++ b/scripts/build/Dockerfile.aarch64-unstable-cross.tmpl
|
||||
@@ -0,0 +1 @@
|
||||
+Dockerfile.unstable-cross.tmpl
|
||||
\ No newline at end of file
|
||||
diff --git a/scripts/build/Dockerfile.armv7-testing-cross.tmpl b/scripts/build/Dockerfile.armv7-testing-cross.tmpl
|
||||
deleted file mode 120000
|
||||
index c1dd38b21..000000000
|
||||
--- a/scripts/build/Dockerfile.armv7-testing-cross.tmpl
|
||||
+++ /dev/null
|
||||
@@ -1 +0,0 @@
|
||||
-Dockerfile.testing-cross.tmpl
|
||||
\ No newline at end of file
|
||||
diff --git a/scripts/build/Dockerfile.armv7-testing-cross.hdr b/scripts/build/Dockerfile.armv7-unstable-cross.hdr
|
||||
similarity index 100%
|
||||
rename from scripts/build/Dockerfile.armv7-testing-cross.hdr
|
||||
rename to scripts/build/Dockerfile.armv7-unstable-cross.hdr
|
||||
diff --git a/scripts/build/Dockerfile.armv7-unstable-cross.tmpl b/scripts/build/Dockerfile.armv7-unstable-cross.tmpl
|
||||
new file mode 120000
|
||||
index 000000000..955ae1fd4
|
||||
--- /dev/null
|
||||
+++ b/scripts/build/Dockerfile.armv7-unstable-cross.tmpl
|
||||
@@ -0,0 +1 @@
|
||||
+Dockerfile.unstable-cross.tmpl
|
||||
\ No newline at end of file
|
||||
diff --git a/scripts/build/Dockerfile.mips64el-testing-cross.tmpl b/scripts/build/Dockerfile.mips64el-testing-cross.tmpl
|
||||
deleted file mode 120000
|
||||
index c1dd38b21..000000000
|
||||
--- a/scripts/build/Dockerfile.mips64el-testing-cross.tmpl
|
||||
+++ /dev/null
|
||||
@@ -1 +0,0 @@
|
||||
-Dockerfile.testing-cross.tmpl
|
||||
\ No newline at end of file
|
||||
diff --git a/scripts/build/Dockerfile.mips64el-testing-cross.hdr b/scripts/build/Dockerfile.mips64el-unstable-cross.hdr
|
||||
similarity index 100%
|
||||
rename from scripts/build/Dockerfile.mips64el-testing-cross.hdr
|
||||
rename to scripts/build/Dockerfile.mips64el-unstable-cross.hdr
|
||||
diff --git a/scripts/build/Dockerfile.mips64el-unstable-cross.tmpl b/scripts/build/Dockerfile.mips64el-unstable-cross.tmpl
|
||||
new file mode 120000
|
||||
index 000000000..955ae1fd4
|
||||
--- /dev/null
|
||||
+++ b/scripts/build/Dockerfile.mips64el-unstable-cross.tmpl
|
||||
@@ -0,0 +1 @@
|
||||
+Dockerfile.unstable-cross.tmpl
|
||||
\ No newline at end of file
|
||||
diff --git a/scripts/build/Dockerfile.ppc64-testing-cross.tmpl b/scripts/build/Dockerfile.ppc64-testing-cross.tmpl
|
||||
deleted file mode 120000
|
||||
index c1dd38b21..000000000
|
||||
--- a/scripts/build/Dockerfile.ppc64-testing-cross.tmpl
|
||||
+++ /dev/null
|
||||
@@ -1 +0,0 @@
|
||||
-Dockerfile.testing-cross.tmpl
|
||||
\ No newline at end of file
|
||||
diff --git a/scripts/build/Dockerfile.ppc64-testing-cross.hdr b/scripts/build/Dockerfile.ppc64-unstable-cross.hdr
|
||||
similarity index 100%
|
||||
rename from scripts/build/Dockerfile.ppc64-testing-cross.hdr
|
||||
rename to scripts/build/Dockerfile.ppc64-unstable-cross.hdr
|
||||
diff --git a/scripts/build/Dockerfile.ppc64-unstable-cross.tmpl b/scripts/build/Dockerfile.ppc64-unstable-cross.tmpl
|
||||
new file mode 120000
|
||||
index 000000000..955ae1fd4
|
||||
--- /dev/null
|
||||
+++ b/scripts/build/Dockerfile.ppc64-unstable-cross.tmpl
|
||||
@@ -0,0 +1 @@
|
||||
+Dockerfile.unstable-cross.tmpl
|
||||
\ No newline at end of file
|
||||
diff --git a/scripts/build/Dockerfile.testing-cross.tmpl b/scripts/build/Dockerfile.unstable-cross.tmpl
|
||||
similarity index 93%
|
||||
rename from scripts/build/Dockerfile.testing-cross.tmpl
|
||||
rename to scripts/build/Dockerfile.unstable-cross.tmpl
|
||||
index 1d5565310..dacfd96ef 100644
|
||||
--- a/scripts/build/Dockerfile.testing-cross.tmpl
|
||||
+++ b/scripts/build/Dockerfile.unstable-cross.tmpl
|
||||
@@ -1,7 +1,7 @@
|
||||
COPY scripts/ci/apt-install /bin/apt-install
|
||||
|
||||
# Add the cross compiler sources
|
||||
-RUN echo "deb http://deb.debian.org/debian/ testing main" >> /etc/apt/sources.list && \
|
||||
+RUN echo "deb http://deb.debian.org/debian/ unstable main" >> /etc/apt/sources.list && \
|
||||
dpkg --add-architecture ${DEBIAN_ARCH}
|
||||
|
||||
RUN apt-install \
|
||||
diff --git a/scripts/build/Makefile b/scripts/build/Makefile
|
||||
index b24fc80ea..2c006ad87 100644
|
||||
--- a/scripts/build/Makefile
|
||||
+++ b/scripts/build/Makefile
|
||||
@@ -1,7 +1,7 @@
|
||||
ARCHES := x86_64 fedora-asan fedora-rawhide centos7 armv7hf centos8
|
||||
STABLE_CROSS_ARCHES := armv7-stable-cross aarch64-stable-cross ppc64-stable-cross mips64el-stable-cross
|
||||
-TESTING_CROSS_ARCHES := armv7-testing-cross aarch64-testing-cross ppc64-testing-cross mips64el-testing-cross
|
||||
-NON_CLANG := $(TESTING_CROSS_ARCHES) $(STABLE_CROSS_ARCHES)
|
||||
+UNSTABLE_CROSS_ARCHES := armv7-unstable-cross aarch64-unstable-cross ppc64-unstable-cross mips64el-unstable-cross
|
||||
+NON_CLANG := $(UNSTABLE_CROSS_ARCHES) $(STABLE_CROSS_ARCHES)
|
||||
CREATE_DOCKERFILES := $(ARCHES) $(NON_CLANG)
|
||||
TARGETS := $(ARCHES) alpine archlinux
|
||||
TARGETS_CLANG := $(addsuffix $(TARGETS),-clang)
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,55 +0,0 @@
|
||||
From 23ad9ca9074fdf8adc6d155c665853bee0e2190b Mon Sep 17 00:00:00 2001
|
||||
From: Radostin Stoyanov <rstoyanov@fedoraproject.org>
|
||||
Date: Fri, 17 Dec 2021 03:01:49 +0000
|
||||
Subject: [PATCH 073/249] ci: disable glibc rseq support
|
||||
|
||||
This patch sets the glibc.pthread.rseq tunable [1] to disable rseq
|
||||
support in glibc as a temporary solution for the problem described in
|
||||
[2]. This would allow us to run CI tests until CRIU has rseq support.
|
||||
|
||||
This commit also disables the rpc tests as they fail even
|
||||
when GLIBC_TUNABLES is set.
|
||||
|
||||
[1] https://sourceware.org/git/?p=glibc.git;a=commit;h=e3e589829d16af9f7e73c7b70f74f3c5d5003e45
|
||||
[2] https://github.com/checkpoint-restore/criu/issues/1696
|
||||
|
||||
Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
|
||||
---
|
||||
scripts/build/Dockerfile.fedora.tmpl | 3 +++
|
||||
scripts/ci/run-ci-tests.sh | 7 ++++++-
|
||||
2 files changed, 9 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/scripts/build/Dockerfile.fedora.tmpl b/scripts/build/Dockerfile.fedora.tmpl
|
||||
index 9d3bb0f87..fd4ba4aef 100644
|
||||
--- a/scripts/build/Dockerfile.fedora.tmpl
|
||||
+++ b/scripts/build/Dockerfile.fedora.tmpl
|
||||
@@ -1,5 +1,8 @@
|
||||
ARG CC=gcc
|
||||
|
||||
+# FIXME: Temporary solution for https://github.com/checkpoint-restore/criu/issues/1696
|
||||
+ENV GLIBC_TUNABLES=glibc.pthread.rseq=0
|
||||
+
|
||||
COPY scripts/ci/prepare-for-fedora-rawhide.sh /bin/prepare-for-fedora-rawhide.sh
|
||||
RUN /bin/prepare-for-fedora-rawhide.sh
|
||||
|
||||
diff --git a/scripts/ci/run-ci-tests.sh b/scripts/ci/run-ci-tests.sh
|
||||
index 096f907fb..bf7331142 100755
|
||||
--- a/scripts/ci/run-ci-tests.sh
|
||||
+++ b/scripts/ci/run-ci-tests.sh
|
||||
@@ -235,7 +235,12 @@ if [ -n "$TRAVIS" ] || [ -n "$CIRCLECI" ]; then
|
||||
# Error (criu/tty.c:1014): tty: Don't have tty to inherit session from, aborting
|
||||
make -C test/others/shell-job/ run
|
||||
fi
|
||||
-make -C test/others/rpc/ run
|
||||
+
|
||||
+# FIXME: rpc tests fail even with set glibc tunable
|
||||
+# https://github.com/checkpoint-restore/criu/issues/1696
|
||||
+if [ "$GLIBC_TUNABLES" != "glibc.pthread.rseq=0" ]; then
|
||||
+ make -C test/others/rpc/ run
|
||||
+fi
|
||||
|
||||
./test/zdtm.py run -t zdtm/static/env00 --sibling
|
||||
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,185 +0,0 @@
|
||||
From 3c27c8d7a494bcf59b08f9fe203d1e408d1b6a1f Mon Sep 17 00:00:00 2001
|
||||
From: Adrian Reber <areber@redhat.com>
|
||||
Date: Fri, 3 Dec 2021 14:32:33 +0000
|
||||
Subject: [PATCH 074/249] libcriu: add single pre-dump support
|
||||
|
||||
In contrast to the CLI it is not possible to do a single pre-dump via
|
||||
RPC and thus libcriu. In cr-service.c pre-dump always goes into a
|
||||
pre-dump loop followed by a final dump. runc already works around this
|
||||
to only do a single pre-dump by killing the CRIU process waiting for the
|
||||
message for the final dump.
|
||||
|
||||
Trying to implement pre-dump in crun via libcriu it is not as easy to
|
||||
work around CRIU's pre-dump loop expectations as with runc that directly
|
||||
talks to CRIU via RPC.
|
||||
|
||||
We know that LXC/LXD also does single pre-dumps using the CLI and runc
|
||||
also only does single pre-dumps by misusing the pre-dump loop interface.
|
||||
|
||||
With this commit it is possible to trigger a single pre-dump via RPC and
|
||||
libcriu without misusing the interface provided via cr-service.c. So
|
||||
this commit basically updates CRIU to the existing use cases.
|
||||
|
||||
The existing pre-dump loop still sounds like a very good idea, but so
|
||||
far most tools have decided to implement the pre-dump loop themselves.
|
||||
|
||||
With this change we can implement pre-dump in crun to match what is
|
||||
currently implemented in runc.
|
||||
|
||||
Signed-off-by: Adrian Reber <areber@redhat.com>
|
||||
---
|
||||
criu/cr-service.c | 13 ++++++++-----
|
||||
images/rpc.proto | 2 ++
|
||||
lib/c/criu.c | 21 ++++++++++++++++++---
|
||||
lib/c/criu.h | 2 ++
|
||||
4 files changed, 30 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/criu/cr-service.c b/criu/cr-service.c
|
||||
index 0f8bc4cc1..80d12c7b0 100644
|
||||
--- a/criu/cr-service.c
|
||||
+++ b/criu/cr-service.c
|
||||
@@ -169,11 +169,11 @@ int send_criu_dump_resp(int socket_fd, bool success, bool restored)
|
||||
return send_criu_msg(socket_fd, &msg);
|
||||
}
|
||||
|
||||
-static int send_criu_pre_dump_resp(int socket_fd, bool success)
|
||||
+static int send_criu_pre_dump_resp(int socket_fd, bool success, bool single)
|
||||
{
|
||||
CriuResp msg = CRIU_RESP__INIT;
|
||||
|
||||
- msg.type = CRIU_REQ_TYPE__PRE_DUMP;
|
||||
+ msg.type = single ? CRIU_REQ_TYPE__SINGLE_PRE_DUMP : CRIU_REQ_TYPE__PRE_DUMP;
|
||||
msg.success = success;
|
||||
set_resp_err(&msg);
|
||||
|
||||
@@ -845,7 +845,7 @@ out:
|
||||
return send_criu_msg(sk, &resp);
|
||||
}
|
||||
|
||||
-static int pre_dump_using_req(int sk, CriuOpts *req)
|
||||
+static int pre_dump_using_req(int sk, CriuOpts *req, bool single)
|
||||
{
|
||||
int pid, status;
|
||||
bool success = false;
|
||||
@@ -886,7 +886,7 @@ static int pre_dump_using_req(int sk, CriuOpts *req)
|
||||
|
||||
success = true;
|
||||
out:
|
||||
- if (send_criu_pre_dump_resp(sk, success) == -1) {
|
||||
+ if (send_criu_pre_dump_resp(sk, success, single) == -1) {
|
||||
pr_perror("Can't send pre-dump resp");
|
||||
success = false;
|
||||
}
|
||||
@@ -899,7 +899,7 @@ static int pre_dump_loop(int sk, CriuReq *msg)
|
||||
int ret;
|
||||
|
||||
do {
|
||||
- ret = pre_dump_using_req(sk, msg->opts);
|
||||
+ ret = pre_dump_using_req(sk, msg->opts, false);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@@ -1271,6 +1271,9 @@ more:
|
||||
case CRIU_REQ_TYPE__VERSION:
|
||||
ret = handle_version(sk, msg);
|
||||
break;
|
||||
+ case CRIU_REQ_TYPE__SINGLE_PRE_DUMP:
|
||||
+ ret = pre_dump_using_req(sk, msg->opts, true);
|
||||
+ break;
|
||||
|
||||
default:
|
||||
send_criu_err(sk, "Invalid req");
|
||||
diff --git a/images/rpc.proto b/images/rpc.proto
|
||||
index a9f51ac4b..1d3befd23 100644
|
||||
--- a/images/rpc.proto
|
||||
+++ b/images/rpc.proto
|
||||
@@ -172,6 +172,8 @@ enum criu_req_type {
|
||||
|
||||
WAIT_PID = 11;
|
||||
PAGE_SERVER_CHLD = 12;
|
||||
+
|
||||
+ SINGLE_PRE_DUMP = 13;
|
||||
}
|
||||
|
||||
/*
|
||||
diff --git a/lib/c/criu.c b/lib/c/criu.c
|
||||
index 4ee189aca..500574e33 100644
|
||||
--- a/lib/c/criu.c
|
||||
+++ b/lib/c/criu.c
|
||||
@@ -1527,7 +1527,7 @@ int criu_check(void)
|
||||
return criu_local_check(global_opts);
|
||||
}
|
||||
|
||||
-int criu_local_dump(criu_opts *opts)
|
||||
+static int dump(bool pre_dump, criu_opts *opts)
|
||||
{
|
||||
int ret = -1;
|
||||
CriuReq req = CRIU_REQ__INIT;
|
||||
@@ -1535,7 +1535,7 @@ int criu_local_dump(criu_opts *opts)
|
||||
|
||||
saved_errno = 0;
|
||||
|
||||
- req.type = CRIU_REQ_TYPE__DUMP;
|
||||
+ req.type = pre_dump ? CRIU_REQ_TYPE__SINGLE_PRE_DUMP : CRIU_REQ_TYPE__DUMP;
|
||||
req.opts = opts->rpc;
|
||||
|
||||
ret = send_req_and_recv_resp(opts, &req, &resp);
|
||||
@@ -1543,7 +1543,7 @@ int criu_local_dump(criu_opts *opts)
|
||||
goto exit;
|
||||
|
||||
if (resp->success) {
|
||||
- if (resp->dump->has_restored && resp->dump->restored)
|
||||
+ if (!pre_dump && resp->dump->has_restored && resp->dump->restored)
|
||||
ret = 1;
|
||||
else
|
||||
ret = 0;
|
||||
@@ -1561,11 +1561,26 @@ exit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
+int criu_local_dump(criu_opts *opts)
|
||||
+{
|
||||
+ return dump(false, opts);
|
||||
+}
|
||||
+
|
||||
int criu_dump(void)
|
||||
{
|
||||
return criu_local_dump(global_opts);
|
||||
}
|
||||
|
||||
+int criu_local_pre_dump(criu_opts *opts)
|
||||
+{
|
||||
+ return dump(true, opts);
|
||||
+}
|
||||
+
|
||||
+int criu_pre_dump(void)
|
||||
+{
|
||||
+ return criu_local_pre_dump(global_opts);
|
||||
+}
|
||||
+
|
||||
int criu_local_dump_iters(criu_opts *opts, int (*more)(criu_predump_info pi))
|
||||
{
|
||||
int ret = -1, fd = -1, uret;
|
||||
diff --git a/lib/c/criu.h b/lib/c/criu.h
|
||||
index a374b37f8..c6d4f50a8 100644
|
||||
--- a/lib/c/criu.h
|
||||
+++ b/lib/c/criu.h
|
||||
@@ -161,6 +161,7 @@ int criu_get_orphan_pts_master_fd(void);
|
||||
*/
|
||||
int criu_check(void);
|
||||
int criu_dump(void);
|
||||
+int criu_pre_dump(void);
|
||||
int criu_restore(void);
|
||||
int criu_restore_child(void);
|
||||
|
||||
@@ -279,6 +280,7 @@ void criu_local_set_notify_cb(criu_opts *opts, int (*cb)(char *action, criu_noti
|
||||
|
||||
int criu_local_check(criu_opts *opts);
|
||||
int criu_local_dump(criu_opts *opts);
|
||||
+int criu_local_pre_dump(criu_opts *opts);
|
||||
int criu_local_restore(criu_opts *opts);
|
||||
int criu_local_restore_child(criu_opts *opts);
|
||||
int criu_local_dump_iters(criu_opts *opts, int (*more)(criu_predump_info pi));
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,262 +0,0 @@
|
||||
From 871feecbc5f200ddf7c9c18e0dc8eaa0544d0688 Mon Sep 17 00:00:00 2001
|
||||
From: Adrian Reber <areber@redhat.com>
|
||||
Date: Tue, 14 Dec 2021 13:09:19 +0000
|
||||
Subject: [PATCH 075/249] tests: added test for single pre-dump support
|
||||
|
||||
Signed-off-by: Adrian Reber <areber@redhat.com>
|
||||
---
|
||||
test/others/libcriu/.gitignore | 1 +
|
||||
test/others/libcriu/Makefile | 1 +
|
||||
test/others/libcriu/lib.h | 2 +
|
||||
test/others/libcriu/run.sh | 1 +
|
||||
test/others/libcriu/test_iters.c | 2 -
|
||||
test/others/libcriu/test_notify.c | 2 -
|
||||
test/others/libcriu/test_pre_dump.c | 151 ++++++++++++++++++++++++++++
|
||||
test/others/libcriu/test_sub.c | 2 -
|
||||
8 files changed, 156 insertions(+), 6 deletions(-)
|
||||
create mode 100644 test/others/libcriu/test_pre_dump.c
|
||||
|
||||
diff --git a/test/others/libcriu/.gitignore b/test/others/libcriu/.gitignore
|
||||
index cf1342de2..15abf07ac 100644
|
||||
--- a/test/others/libcriu/.gitignore
|
||||
+++ b/test/others/libcriu/.gitignore
|
||||
@@ -4,5 +4,6 @@ test_notify
|
||||
test_self
|
||||
test_sub
|
||||
test_join_ns
|
||||
+test_pre_dump
|
||||
output/
|
||||
libcriu.so.*
|
||||
diff --git a/test/others/libcriu/Makefile b/test/others/libcriu/Makefile
|
||||
index 734e66c1a..581574da0 100644
|
||||
--- a/test/others/libcriu/Makefile
|
||||
+++ b/test/others/libcriu/Makefile
|
||||
@@ -6,6 +6,7 @@ TESTS += test_notify
|
||||
TESTS += test_iters
|
||||
TESTS += test_errno
|
||||
TESTS += test_join_ns
|
||||
+TESTS += test_pre_dump
|
||||
|
||||
all: $(TESTS)
|
||||
.PHONY: all
|
||||
diff --git a/test/others/libcriu/lib.h b/test/others/libcriu/lib.h
|
||||
index 6fdf8aef2..59372fca5 100644
|
||||
--- a/test/others/libcriu/lib.h
|
||||
+++ b/test/others/libcriu/lib.h
|
||||
@@ -1,3 +1,5 @@
|
||||
void what_err_ret_mean(int ret);
|
||||
int chk_exit(int status, int want);
|
||||
int get_version(void);
|
||||
+
|
||||
+#define SUCC_ECODE 42
|
||||
diff --git a/test/others/libcriu/run.sh b/test/others/libcriu/run.sh
|
||||
index 48f25a5f6..1b6c73448 100755
|
||||
--- a/test/others/libcriu/run.sh
|
||||
+++ b/test/others/libcriu/run.sh
|
||||
@@ -58,6 +58,7 @@ run_test test_notify
|
||||
if [ "$(uname -m)" = "x86_64" ]; then
|
||||
# Skip this on aarch64 as aarch64 has no dirty page tracking
|
||||
run_test test_iters
|
||||
+ run_test test_pre_dump
|
||||
fi
|
||||
run_test test_errno
|
||||
run_test test_join_ns
|
||||
diff --git a/test/others/libcriu/test_iters.c b/test/others/libcriu/test_iters.c
|
||||
index b7e325abb..edbaf87f6 100644
|
||||
--- a/test/others/libcriu/test_iters.c
|
||||
+++ b/test/others/libcriu/test_iters.c
|
||||
@@ -46,8 +46,6 @@ static int next_iter(criu_predump_info pi)
|
||||
return cur_iter < MAX_ITERS;
|
||||
}
|
||||
|
||||
-#define SUCC_ECODE 42
|
||||
-
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int pid, ret, p[2];
|
||||
diff --git a/test/others/libcriu/test_notify.c b/test/others/libcriu/test_notify.c
|
||||
index 9a54b812a..80ad3ffdc 100644
|
||||
--- a/test/others/libcriu/test_notify.c
|
||||
+++ b/test/others/libcriu/test_notify.c
|
||||
@@ -10,8 +10,6 @@
|
||||
|
||||
#include "lib.h"
|
||||
|
||||
-#define SUCC_ECODE 42
|
||||
-
|
||||
static int actions_called = 0;
|
||||
static int notify(char *action, criu_notify_arg_t na)
|
||||
{
|
||||
diff --git a/test/others/libcriu/test_pre_dump.c b/test/others/libcriu/test_pre_dump.c
|
||||
new file mode 100644
|
||||
index 000000000..ed9cd2125
|
||||
--- /dev/null
|
||||
+++ b/test/others/libcriu/test_pre_dump.c
|
||||
@@ -0,0 +1,151 @@
|
||||
+#include "criu.h"
|
||||
+#include <fcntl.h>
|
||||
+#include <stdio.h>
|
||||
+#include <errno.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <signal.h>
|
||||
+#include <fcntl.h>
|
||||
+#include <sys/stat.h>
|
||||
+#include <sys/wait.h>
|
||||
+#include <unistd.h>
|
||||
+#include "lib.h"
|
||||
+
|
||||
+static int wdir_fd, cur_imgdir = -1;
|
||||
+
|
||||
+static int stop = 0;
|
||||
+static void sh(int sig)
|
||||
+{
|
||||
+ stop = 1;
|
||||
+}
|
||||
+
|
||||
+static void open_imgdir(void)
|
||||
+{
|
||||
+ char p[10];
|
||||
+ static int id = 0;
|
||||
+
|
||||
+ if (id > 0) {
|
||||
+ sprintf(p, "../dir-%d", id);
|
||||
+ criu_set_parent_images(p);
|
||||
+ }
|
||||
+ if (cur_imgdir != -1)
|
||||
+ close(cur_imgdir);
|
||||
+ sprintf(p, "dir-%d", ++id);
|
||||
+ mkdirat(wdir_fd, p, 0700);
|
||||
+ cur_imgdir = openat(wdir_fd, p, O_DIRECTORY);
|
||||
+ criu_set_images_dir_fd(cur_imgdir);
|
||||
+}
|
||||
+
|
||||
+int main(int argc, char **argv)
|
||||
+{
|
||||
+ int pid, ret, p[2];
|
||||
+
|
||||
+ wdir_fd = open(argv[2], O_DIRECTORY);
|
||||
+ if (wdir_fd < 0) {
|
||||
+ perror("Can't open wdir");
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ printf("--- Start loop ---\n");
|
||||
+ pipe(p);
|
||||
+ pid = fork();
|
||||
+ if (pid < 0) {
|
||||
+ perror("Can't");
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if (!pid) {
|
||||
+ printf(" `- loop: initializing\n");
|
||||
+ if (setsid() < 0)
|
||||
+ exit(1);
|
||||
+ if (signal(SIGUSR1, sh) == SIG_ERR)
|
||||
+ exit(1);
|
||||
+
|
||||
+ close(0);
|
||||
+ close(1);
|
||||
+ close(2);
|
||||
+ close(p[0]);
|
||||
+
|
||||
+ ret = SUCC_ECODE;
|
||||
+ write(p[1], &ret, sizeof(ret));
|
||||
+ close(p[1]);
|
||||
+
|
||||
+ while (!stop)
|
||||
+ sleep(1);
|
||||
+ exit(SUCC_ECODE);
|
||||
+ }
|
||||
+
|
||||
+ close(p[1]);
|
||||
+
|
||||
+ /* Wait for kid to start */
|
||||
+ ret = -1;
|
||||
+ read(p[0], &ret, sizeof(ret));
|
||||
+ if (ret != SUCC_ECODE) {
|
||||
+ printf("Error starting loop\n");
|
||||
+ goto err;
|
||||
+ }
|
||||
+
|
||||
+ /* Wait for pipe to get closed, then dump */
|
||||
+ read(p[0], &ret, 1);
|
||||
+ close(p[0]);
|
||||
+
|
||||
+ printf("--- Dump loop ---\n");
|
||||
+ criu_init_opts();
|
||||
+ criu_set_service_binary(argv[1]);
|
||||
+ criu_set_pid(pid);
|
||||
+ criu_set_log_file("dump.log");
|
||||
+ criu_set_log_level(CRIU_LOG_DEBUG);
|
||||
+ criu_set_track_mem(true);
|
||||
+
|
||||
+ open_imgdir();
|
||||
+ ret = criu_pre_dump();
|
||||
+ if (ret < 0) {
|
||||
+ what_err_ret_mean(ret);
|
||||
+ kill(pid, SIGKILL);
|
||||
+ goto err;
|
||||
+ }
|
||||
+
|
||||
+ printf(" `- Pre Dump 1 succeeded\n");
|
||||
+
|
||||
+ open_imgdir();
|
||||
+ ret = criu_pre_dump();
|
||||
+ if (ret < 0) {
|
||||
+ what_err_ret_mean(ret);
|
||||
+ kill(pid, SIGKILL);
|
||||
+ goto err;
|
||||
+ }
|
||||
+
|
||||
+ printf(" `- Pre Dump 2 succeeded\n");
|
||||
+
|
||||
+ open_imgdir();
|
||||
+ ret = criu_dump();
|
||||
+ if (ret < 0) {
|
||||
+ what_err_ret_mean(ret);
|
||||
+ kill(pid, SIGKILL);
|
||||
+ goto err;
|
||||
+ }
|
||||
+
|
||||
+ printf(" `- Final Dump succeeded\n");
|
||||
+ waitpid(pid, NULL, 0);
|
||||
+
|
||||
+ printf("--- Restore ---\n");
|
||||
+ criu_init_opts();
|
||||
+ criu_set_log_level(CRIU_LOG_DEBUG);
|
||||
+ criu_set_log_file("restore.log");
|
||||
+ criu_set_images_dir_fd(cur_imgdir);
|
||||
+
|
||||
+ pid = criu_restore_child();
|
||||
+ if (pid <= 0) {
|
||||
+ what_err_ret_mean(pid);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ printf(" `- Restore returned pid %d\n", pid);
|
||||
+ kill(pid, SIGUSR1);
|
||||
+err:
|
||||
+ if (waitpid(pid, &ret, 0) < 0) {
|
||||
+ perror(" Can't wait kid");
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ return chk_exit(ret, SUCC_ECODE);
|
||||
+}
|
||||
diff --git a/test/others/libcriu/test_sub.c b/test/others/libcriu/test_sub.c
|
||||
index 697abf5d5..af1e09408 100644
|
||||
--- a/test/others/libcriu/test_sub.c
|
||||
+++ b/test/others/libcriu/test_sub.c
|
||||
@@ -15,8 +15,6 @@ static void sh(int sig)
|
||||
stop = 1;
|
||||
}
|
||||
|
||||
-#define SUCC_ECODE 42
|
||||
-
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int pid, ret, fd, p[2];
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,56 +0,0 @@
|
||||
From 05b155f1f46eb98e38ad1a0d8a332ab3326323ff Mon Sep 17 00:00:00 2001
|
||||
From: Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com>
|
||||
Date: Sat, 18 Dec 2021 10:40:11 +0300
|
||||
Subject: [PATCH 076/249] zdtm.py: clean up MAKEFLAGS env variable before
|
||||
running make instance
|
||||
|
||||
In most cases we run tests as:
|
||||
./test/zdtm.py run -a
|
||||
|
||||
But it's also possible to run tests from root makefile:
|
||||
make test
|
||||
|
||||
In this case, if criu tree have no ./test/umount2 binary
|
||||
built we get the error like:
|
||||
make[3]: *** No rule to make target 'umount2'. Stop.
|
||||
|
||||
It's worth to mention this "3". That's because we have
|
||||
build process tree like this:
|
||||
make -> make -> make -> zdtm.py -> make umount2
|
||||
and also we have MAKEFLAGS variable set to:
|
||||
build=-r -R -f ...
|
||||
|
||||
And that's bad because "-r" option means no builtin
|
||||
rules and -R means no builtin variables. That makes
|
||||
`make umount2` not working. Let's just cleanup this
|
||||
variable to make things work properly.
|
||||
|
||||
Fixes: #1699
|
||||
https://github.com/checkpoint-restore/criu/issues/1699
|
||||
|
||||
Signed-off-by: Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com>
|
||||
---
|
||||
test/zdtm.py | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/test/zdtm.py b/test/zdtm.py
|
||||
index b98770079..086ae0285 100755
|
||||
--- a/test/zdtm.py
|
||||
+++ b/test/zdtm.py
|
||||
@@ -607,9 +607,11 @@ class zdtm_test:
|
||||
@staticmethod
|
||||
def available():
|
||||
if not os.access("umount2", os.X_OK):
|
||||
- subprocess.check_call(["make", "umount2"])
|
||||
+ subprocess.check_call(
|
||||
+ ["make", "umount2"], env=dict(os.environ, MAKEFLAGS=""))
|
||||
if not os.access("zdtm_ct", os.X_OK):
|
||||
- subprocess.check_call(["make", "zdtm_ct"])
|
||||
+ subprocess.check_call(
|
||||
+ ["make", "zdtm_ct"], env=dict(os.environ, MAKEFLAGS=""))
|
||||
if not os.access("zdtm/lib/libzdtmtst.a", os.F_OK):
|
||||
subprocess.check_call(["make", "-C", "zdtm/"])
|
||||
subprocess.check_call(
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,33 +0,0 @@
|
||||
From ffb3cfd38ccc307a8c8171220cd744578a679195 Mon Sep 17 00:00:00 2001
|
||||
From: Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com>
|
||||
Date: Sat, 18 Dec 2021 11:03:53 +0300
|
||||
Subject: [PATCH 077/249] zdtm: zdtm_ct fix compilation error with
|
||||
strict-prototypes on
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
zdtm_ct.c:44:12: error: function declaration isn’t a prototype [-Werror=strict-prototypes]
|
||||
44 | static int create_timens()
|
||||
|
||||
Signed-off-by: Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com>
|
||||
---
|
||||
test/zdtm_ct.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/test/zdtm_ct.c b/test/zdtm_ct.c
|
||||
index e4b17a512..0e8eeff8a 100644
|
||||
--- a/test/zdtm_ct.c
|
||||
+++ b/test/zdtm_ct.c
|
||||
@@ -41,7 +41,7 @@ static inline int _settime(clockid_t clk_id, time_t offset)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int create_timens()
|
||||
+static int create_timens(void)
|
||||
{
|
||||
struct utsname buf;
|
||||
unsigned major, minor;
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,21 +0,0 @@
|
||||
From 6bb67ad114a16bcabe3fe349309093f00c6f39da Mon Sep 17 00:00:00 2001
|
||||
From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
|
||||
Date: Fri, 17 Dec 2021 15:33:55 +0300
|
||||
Subject: [PATCH 078/249] zdtm: remove mntns-deleted-dst test leftover from git
|
||||
|
||||
Looks like in commit [1] we've non-intentionally added this tmp file to
|
||||
git, let's remove it.
|
||||
|
||||
Fixes: 01ee29702 ("s390:zdtm: Enable zdtm for s390") [1]
|
||||
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
|
||||
---
|
||||
test/zdtm/static/mntns-deleted-dst | 0
|
||||
1 file changed, 0 insertions(+), 0 deletions(-)
|
||||
delete mode 100644 test/zdtm/static/mntns-deleted-dst
|
||||
|
||||
diff --git a/test/zdtm/static/mntns-deleted-dst b/test/zdtm/static/mntns-deleted-dst
|
||||
deleted file mode 100644
|
||||
index e69de29bb..000000000
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,29 +0,0 @@
|
||||
From 8950d844260c91535ce1bbfc670ee547ca7c3b85 Mon Sep 17 00:00:00 2001
|
||||
From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
|
||||
Date: Fri, 10 Dec 2021 15:34:19 +0300
|
||||
Subject: [PATCH 079/249] crtools: remove excess always true condition
|
||||
|
||||
Several lines above if (optind >= argc) we go to usage label and fail,
|
||||
thus we don't need to check (optind < argc) here as it is always true.
|
||||
|
||||
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
|
||||
---
|
||||
criu/crtools.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/criu/crtools.c b/criu/crtools.c
|
||||
index da47bd684..3adfb190f 100644
|
||||
--- a/criu/crtools.c
|
||||
+++ b/criu/crtools.c
|
||||
@@ -124,7 +124,7 @@ int main(int argc, char *argv[], char *envp[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
- if (optind < argc && !strcmp(argv[optind], "swrk")) {
|
||||
+ if (!strcmp(argv[optind], "swrk")) {
|
||||
if (argc != optind + 2) {
|
||||
fprintf(stderr, "Usage: criu swrk <fd>\n");
|
||||
return 1;
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,309 +0,0 @@
|
||||
From 9192d6b38b6ed5ddd9c2a89bd384e25f93bb13d6 Mon Sep 17 00:00:00 2001
|
||||
From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
|
||||
Date: Fri, 10 Dec 2021 12:13:06 +0300
|
||||
Subject: [PATCH 080/249] crtools/rpc: export current criu mode to opts.mode
|
||||
|
||||
We have multiple options which are valid only on restore or only on dump
|
||||
or in any other specific criu mode, so it would be useful to have info
|
||||
about current mode in opts so that we can validate other options against
|
||||
current mode.
|
||||
|
||||
Plan is to use it for mount-v2 option as it is only valid on restore,
|
||||
and this would make handling of different types mountpoints much easier.
|
||||
|
||||
Realization is a bit different for general code and rpc:
|
||||
|
||||
- When criu mode is set from main() we just parse mode from argv[optind]
|
||||
just after parse_options() found optind of the command. Note that
|
||||
opts.mode is available before check_options().
|
||||
|
||||
- For rpc service we reset opts.mode to CR_SWRK each time we restart
|
||||
cr_service_work(), in the original service process we still have
|
||||
CR_SERVICE to differentiate between them, and each request handling
|
||||
function which does setup_opts_from_req sets opts.mode in accordance
|
||||
with the processed request type. And it is also available before
|
||||
check_options().
|
||||
|
||||
Now in check_options we can add filters on one mode only options.
|
||||
|
||||
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
|
||||
---
|
||||
criu/cr-service.c | 8 +++++
|
||||
criu/crtools.c | 73 +++++++++++++++++++++++++++++----------
|
||||
criu/include/cr_options.h | 19 ++++++++++
|
||||
3 files changed, 82 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/criu/cr-service.c b/criu/cr-service.c
|
||||
index 80d12c7b0..59f46b320 100644
|
||||
--- a/criu/cr-service.c
|
||||
+++ b/criu/cr-service.c
|
||||
@@ -735,6 +735,7 @@ static int dump_using_req(int sk, CriuOpts *req)
|
||||
bool success = false;
|
||||
bool self_dump = !req->pid;
|
||||
|
||||
+ opts.mode = CR_DUMP;
|
||||
if (setup_opts_from_req(sk, req))
|
||||
goto exit;
|
||||
|
||||
@@ -777,6 +778,7 @@ static int restore_using_req(int sk, CriuOpts *req)
|
||||
|
||||
opts.restore_detach = true;
|
||||
|
||||
+ opts.mode = CR_RESTORE;
|
||||
if (setup_opts_from_req(sk, req))
|
||||
goto exit;
|
||||
|
||||
@@ -828,6 +830,7 @@ static int check(int sk, CriuOpts *req)
|
||||
if (pid == 0) {
|
||||
setproctitle("check --rpc");
|
||||
|
||||
+ opts.mode = CR_CHECK;
|
||||
if (setup_opts_from_req(sk, req))
|
||||
exit(1);
|
||||
|
||||
@@ -859,6 +862,7 @@ static int pre_dump_using_req(int sk, CriuOpts *req, bool single)
|
||||
if (pid == 0) {
|
||||
int ret = 1;
|
||||
|
||||
+ opts.mode = CR_PRE_DUMP;
|
||||
if (setup_opts_from_req(sk, req))
|
||||
goto cout;
|
||||
|
||||
@@ -936,6 +940,7 @@ static int start_page_server_req(int sk, CriuOpts *req, bool daemon_mode)
|
||||
if (pid == 0) {
|
||||
close(start_pipe[0]);
|
||||
|
||||
+ opts.mode = CR_PAGE_SERVER;
|
||||
if (setup_opts_from_req(sk, req))
|
||||
goto out_ch;
|
||||
|
||||
@@ -1182,6 +1187,7 @@ static int handle_cpuinfo(int sk, CriuReq *msg)
|
||||
if (pid == 0) {
|
||||
int ret = 1;
|
||||
|
||||
+ opts.mode = CR_CPUINFO;
|
||||
if (setup_opts_from_req(sk, msg->opts))
|
||||
goto cout;
|
||||
|
||||
@@ -1231,6 +1237,8 @@ int cr_service_work(int sk)
|
||||
CriuReq *msg = 0;
|
||||
|
||||
more:
|
||||
+ opts.mode = CR_SWRK;
|
||||
+
|
||||
if (recv_criu_msg(sk, &msg) != 0) {
|
||||
pr_perror("Can't recv request");
|
||||
goto err;
|
||||
diff --git a/criu/crtools.c b/criu/crtools.c
|
||||
index 3adfb190f..d10d7f7d0 100644
|
||||
--- a/criu/crtools.c
|
||||
+++ b/criu/crtools.c
|
||||
@@ -67,6 +67,38 @@ static int image_dir_mode(char *argv[], int optind)
|
||||
return -1;
|
||||
}
|
||||
|
||||
+static int parse_criu_mode(char *mode)
|
||||
+{
|
||||
+ if (!strcmp(mode, "dump"))
|
||||
+ opts.mode = CR_DUMP;
|
||||
+ else if (!strcmp(mode, "pre-dump"))
|
||||
+ opts.mode = CR_PRE_DUMP;
|
||||
+ else if (!strcmp(mode, "restore"))
|
||||
+ opts.mode = CR_RESTORE;
|
||||
+ else if (!strcmp(mode, "lazy-pages"))
|
||||
+ opts.mode = CR_LAZY_PAGES;
|
||||
+ else if (!strcmp(mode, "check"))
|
||||
+ opts.mode = CR_CHECK;
|
||||
+ else if (!strcmp(mode, "page-server"))
|
||||
+ opts.mode = CR_PAGE_SERVER;
|
||||
+ else if (!strcmp(mode, "service"))
|
||||
+ opts.mode = CR_SERVICE;
|
||||
+ else if (!strcmp(mode, "swrk"))
|
||||
+ opts.mode = CR_SWRK;
|
||||
+ else if (!strcmp(mode, "dedup"))
|
||||
+ opts.mode = CR_DEDUP;
|
||||
+ else if (!strcmp(mode, "cpuinfo"))
|
||||
+ opts.mode = CR_CPUINFO;
|
||||
+ else if (!strcmp(mode, "exec"))
|
||||
+ opts.mode = CR_EXEC_DEPRECATED;
|
||||
+ else if (!strcmp(mode, "show"))
|
||||
+ opts.mode = CR_SHOW_DEPRECATED;
|
||||
+ else
|
||||
+ return -1;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
int main(int argc, char *argv[], char *envp[])
|
||||
{
|
||||
int ret = -1;
|
||||
@@ -124,7 +156,12 @@ int main(int argc, char *argv[], char *envp[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
- if (!strcmp(argv[optind], "swrk")) {
|
||||
+ if (parse_criu_mode(argv[optind])) {
|
||||
+ pr_err("unknown command: %s\n", argv[optind]);
|
||||
+ goto usage;
|
||||
+ }
|
||||
+
|
||||
+ if (opts.mode == CR_SWRK) {
|
||||
if (argc != optind + 2) {
|
||||
fprintf(stderr, "Usage: criu swrk <fd>\n");
|
||||
return 1;
|
||||
@@ -156,7 +193,7 @@ int main(int argc, char *argv[], char *envp[])
|
||||
goto usage;
|
||||
}
|
||||
|
||||
- if (strcmp(argv[optind], "restore")) {
|
||||
+ if (opts.mode != CR_RESTORE) {
|
||||
pr_err("--exec-cmd is available for the restore command only\n");
|
||||
goto usage;
|
||||
}
|
||||
@@ -173,7 +210,7 @@ int main(int argc, char *argv[], char *envp[])
|
||||
opts.exec_cmd[argc - optind - 1] = NULL;
|
||||
} else {
|
||||
/* No subcommands except for cpuinfo and restore --exec-cmd */
|
||||
- if (strcmp(argv[optind], "cpuinfo") && has_sub_command) {
|
||||
+ if (opts.mode != CR_CPUINFO && has_sub_command) {
|
||||
pr_err("excessive parameter%s for command %s\n", (argc - optind) > 2 ? "s" : "", argv[optind]);
|
||||
goto usage;
|
||||
}
|
||||
@@ -185,7 +222,7 @@ int main(int argc, char *argv[], char *envp[])
|
||||
}
|
||||
|
||||
/* We must not open imgs dir, if service is called */
|
||||
- if (strcmp(argv[optind], "service")) {
|
||||
+ if (opts.mode != CR_SERVICE) {
|
||||
ret = open_image_dir(opts.imgs_dir, image_dir_mode(argv, optind));
|
||||
if (ret < 0) {
|
||||
pr_err("Couldn't open image dir %s\n", opts.imgs_dir);
|
||||
@@ -197,8 +234,7 @@ int main(int argc, char *argv[], char *envp[])
|
||||
* When a process group becomes an orphan,
|
||||
* its processes are sent a SIGHUP signal
|
||||
*/
|
||||
- if (!strcmp(argv[optind], "restore") && opts.restore_detach && opts.final_state == TASK_STOPPED &&
|
||||
- opts.shell_job)
|
||||
+ if (opts.mode == CR_RESTORE && opts.restore_detach && opts.final_state == TASK_STOPPED && opts.shell_job)
|
||||
pr_warn("Stopped and detached shell job will get SIGHUP from OS.\n");
|
||||
|
||||
if (chdir(opts.work_dir)) {
|
||||
@@ -218,7 +254,7 @@ int main(int argc, char *argv[], char *envp[])
|
||||
kdat.can_map_vdso = 0;
|
||||
|
||||
if (!list_empty(&opts.inherit_fds)) {
|
||||
- if (strcmp(argv[optind], "restore")) {
|
||||
+ if (opts.mode != CR_RESTORE) {
|
||||
pr_err("--inherit-fd is restore-only option\n");
|
||||
return 1;
|
||||
}
|
||||
@@ -229,13 +265,14 @@ int main(int argc, char *argv[], char *envp[])
|
||||
if (opts.img_parent)
|
||||
pr_info("Will do snapshot from %s\n", opts.img_parent);
|
||||
|
||||
- if (!strcmp(argv[optind], "dump")) {
|
||||
+ if (opts.mode == CR_DUMP) {
|
||||
if (!opts.tree_id)
|
||||
goto opt_pid_missing;
|
||||
+
|
||||
return cr_dump_tasks(opts.tree_id);
|
||||
}
|
||||
|
||||
- if (!strcmp(argv[optind], "pre-dump")) {
|
||||
+ if (opts.mode == CR_PRE_DUMP) {
|
||||
if (!opts.tree_id)
|
||||
goto opt_pid_missing;
|
||||
|
||||
@@ -247,7 +284,7 @@ int main(int argc, char *argv[], char *envp[])
|
||||
return cr_pre_dump_tasks(opts.tree_id) != 0;
|
||||
}
|
||||
|
||||
- if (!strcmp(argv[optind], "restore")) {
|
||||
+ if (opts.mode == CR_RESTORE) {
|
||||
if (opts.tree_id)
|
||||
pr_warn("Using -t with criu restore is obsoleted\n");
|
||||
|
||||
@@ -262,22 +299,22 @@ int main(int argc, char *argv[], char *envp[])
|
||||
return ret != 0;
|
||||
}
|
||||
|
||||
- if (!strcmp(argv[optind], "lazy-pages"))
|
||||
+ if (opts.mode == CR_LAZY_PAGES)
|
||||
return cr_lazy_pages(opts.daemon_mode) != 0;
|
||||
|
||||
- if (!strcmp(argv[optind], "check"))
|
||||
+ if (opts.mode == CR_CHECK)
|
||||
return cr_check() != 0;
|
||||
|
||||
- if (!strcmp(argv[optind], "page-server"))
|
||||
+ if (opts.mode == CR_PAGE_SERVER)
|
||||
return cr_page_server(opts.daemon_mode, false, -1) != 0;
|
||||
|
||||
- if (!strcmp(argv[optind], "service"))
|
||||
+ if (opts.mode == CR_SERVICE)
|
||||
return cr_service(opts.daemon_mode);
|
||||
|
||||
- if (!strcmp(argv[optind], "dedup"))
|
||||
+ if (opts.mode == CR_DEDUP)
|
||||
return cr_dedup() != 0;
|
||||
|
||||
- if (!strcmp(argv[optind], "cpuinfo")) {
|
||||
+ if (opts.mode == CR_CPUINFO) {
|
||||
if (!argv[optind + 1]) {
|
||||
pr_err("cpuinfo requires an action: dump or check\n");
|
||||
goto usage;
|
||||
@@ -288,12 +325,12 @@ int main(int argc, char *argv[], char *envp[])
|
||||
return cpuinfo_check();
|
||||
}
|
||||
|
||||
- if (!strcmp(argv[optind], "exec")) {
|
||||
+ if (opts.mode == CR_EXEC_DEPRECATED) {
|
||||
pr_err("The \"exec\" action is deprecated by the Compel library.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
- if (!strcmp(argv[optind], "show")) {
|
||||
+ if (opts.mode == CR_SHOW_DEPRECATED) {
|
||||
pr_err("The \"show\" action is deprecated by the CRIT utility.\n");
|
||||
pr_err("To view an image use the \"crit decode -i $name --pretty\" command.\n");
|
||||
return -1;
|
||||
diff --git a/criu/include/cr_options.h b/criu/include/cr_options.h
|
||||
index a34f8dbbf..85648bf1c 100644
|
||||
--- a/criu/include/cr_options.h
|
||||
+++ b/criu/include/cr_options.h
|
||||
@@ -100,6 +100,22 @@ struct irmap_path_opt {
|
||||
struct irmap *ir;
|
||||
};
|
||||
|
||||
+enum criu_mode {
|
||||
+ CR_UNSET = 0,
|
||||
+ CR_DUMP,
|
||||
+ CR_PRE_DUMP,
|
||||
+ CR_RESTORE,
|
||||
+ CR_LAZY_PAGES,
|
||||
+ CR_CHECK,
|
||||
+ CR_PAGE_SERVER,
|
||||
+ CR_SERVICE,
|
||||
+ CR_SWRK,
|
||||
+ CR_DEDUP,
|
||||
+ CR_CPUINFO,
|
||||
+ CR_EXEC_DEPRECATED,
|
||||
+ CR_SHOW_DEPRECATED,
|
||||
+};
|
||||
+
|
||||
struct cr_options {
|
||||
int final_state;
|
||||
int check_extra_features;
|
||||
@@ -188,6 +204,9 @@ struct cr_options {
|
||||
|
||||
/* This stores which method to use for file validation. */
|
||||
int file_validation_method;
|
||||
+
|
||||
+ /* Shows the mode criu is running at the moment: dump/pre-dump/restore/... */
|
||||
+ enum criu_mode mode;
|
||||
};
|
||||
|
||||
extern struct cr_options opts;
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,48 +0,0 @@
|
||||
From f8250a1c0f62abe60c727d90e39cf6c26fe357f4 Mon Sep 17 00:00:00 2001
|
||||
From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
|
||||
Date: Wed, 15 Dec 2021 10:49:42 +0300
|
||||
Subject: [PATCH 081/249] crtools: use new opts.mode in image_dir_mode
|
||||
|
||||
Also while on it there is no "cpuinfo restore", let's remove it.
|
||||
|
||||
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
|
||||
---
|
||||
criu/crtools.c | 19 ++++++++++++++-----
|
||||
1 file changed, 14 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/criu/crtools.c b/criu/crtools.c
|
||||
index d10d7f7d0..7bf92ffd0 100644
|
||||
--- a/criu/crtools.c
|
||||
+++ b/criu/crtools.c
|
||||
@@ -56,14 +56,23 @@ void flush_early_log_to_stderr(void)
|
||||
|
||||
static int image_dir_mode(char *argv[], int optind)
|
||||
{
|
||||
- if (!strcmp(argv[optind], "dump") || !strcmp(argv[optind], "pre-dump") ||
|
||||
- (!strcmp(argv[optind], "cpuinfo") && !strcmp(argv[optind + 1], "dump")))
|
||||
+ switch (opts.mode) {
|
||||
+ case CR_DUMP:
|
||||
+ /* fallthrough */
|
||||
+ case CR_PRE_DUMP:
|
||||
return O_DUMP;
|
||||
-
|
||||
- if (!strcmp(argv[optind], "restore") ||
|
||||
- (!strcmp(argv[optind], "cpuinfo") && !strcmp(argv[optind + 1], "restore")))
|
||||
+ case CR_RESTORE:
|
||||
return O_RSTR;
|
||||
+ case CR_CPUINFO:
|
||||
+ if (!strcmp(argv[optind + 1], "dump"))
|
||||
+ return O_DUMP;
|
||||
+ /* fallthrough */
|
||||
+ default:
|
||||
+ return -1;
|
||||
+ }
|
||||
|
||||
+ /* never reached */
|
||||
+ BUG();
|
||||
return -1;
|
||||
}
|
||||
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,29 +0,0 @@
|
||||
From f67fb6cf09c1a38f5f7c0bd86fee572bb6cf7bf9 Mon Sep 17 00:00:00 2001
|
||||
From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
|
||||
Date: Thu, 16 Dec 2021 18:05:01 +0300
|
||||
Subject: [PATCH 082/249] crtools: check that cpuinfo command has sub-command
|
||||
|
||||
This fixes segfault on empty sub-command for cpuinfo.
|
||||
|
||||
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
|
||||
---
|
||||
criu/crtools.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/criu/crtools.c b/criu/crtools.c
|
||||
index 7bf92ffd0..0752800f6 100644
|
||||
--- a/criu/crtools.c
|
||||
+++ b/criu/crtools.c
|
||||
@@ -222,6 +222,9 @@ int main(int argc, char *argv[], char *envp[])
|
||||
if (opts.mode != CR_CPUINFO && has_sub_command) {
|
||||
pr_err("excessive parameter%s for command %s\n", (argc - optind) > 2 ? "s" : "", argv[optind]);
|
||||
goto usage;
|
||||
+ } else if (opts.mode == CR_CPUINFO && !has_sub_command) {
|
||||
+ pr_err("cpuinfo requires an action: dump or check\n");
|
||||
+ goto usage;
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,53 +0,0 @@
|
||||
From ac48b975f6d4c03d0ea2a9f99ed88d03333f7ad3 Mon Sep 17 00:00:00 2001
|
||||
From: Bui Quang Minh <minhquangbui99@gmail.com>
|
||||
Date: Tue, 14 Dec 2021 22:28:27 +0700
|
||||
Subject: [PATCH 083/249] sk-unix: Add support for SOCK_SEQPACKET unix sockets
|
||||
|
||||
Adjust some SOCK_STREAM cases to handle SOCK_SEQPACKET too.
|
||||
|
||||
Signed-off-by: Bui Quang Minh <minhquangbui99@gmail.com>
|
||||
---
|
||||
criu/sk-unix.c | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/criu/sk-unix.c b/criu/sk-unix.c
|
||||
index d3402c3ac..194193dff 100644
|
||||
--- a/criu/sk-unix.c
|
||||
+++ b/criu/sk-unix.c
|
||||
@@ -402,12 +402,12 @@ static int dump_one_unix_fd(int lfd, uint32_t id, const struct fd_parms *p)
|
||||
sk_encode_shutdown(ue, sk->shutdown);
|
||||
|
||||
/*
|
||||
- * If a stream listening socket has non-zero rqueue, this
|
||||
- * means there are in-flight connections waiting to get
|
||||
+ * If a stream/seqpacket listening socket has non-zero rqueue,
|
||||
+ * this means there are in-flight connections waiting to get
|
||||
* accept()-ed. We handle them separately with the "icons"
|
||||
* (i stands for in-flight, cons -- for connections) things.
|
||||
*/
|
||||
- if (sk->rqlen != 0 && !(sk->type == SOCK_STREAM && sk->state == TCP_LISTEN)) {
|
||||
+ if (sk->rqlen != 0 && sk->state != TCP_LISTEN) {
|
||||
if (dump_sk_queue(lfd, id))
|
||||
goto err;
|
||||
}
|
||||
@@ -1610,7 +1610,7 @@ static int bind_unix_sk(int sk, struct unix_sk_info *ui)
|
||||
if (ui->ue->name.len == 0)
|
||||
return 0;
|
||||
|
||||
- if ((ui->ue->type == SOCK_STREAM) && (ui->ue->state == TCP_ESTABLISHED)) {
|
||||
+ if ((ui->ue->type != SOCK_DGRAM) && (ui->ue->state == TCP_ESTABLISHED)) {
|
||||
/*
|
||||
* FIXME this can be done, but for doing this properly we
|
||||
* need to bind socket to its name, then rename one to
|
||||
@@ -1851,7 +1851,7 @@ static int open_unixsk_standalone(struct unix_sk_info *ui, int *new_fd)
|
||||
|
||||
close(sks[1]);
|
||||
sk = sks[0];
|
||||
- } else if ((ui->ue->state == TCP_ESTABLISHED && ui->ue->type == SOCK_STREAM) && queuer &&
|
||||
+ } else if ((ui->ue->state == TCP_ESTABLISHED && ui->ue->type != SOCK_DGRAM) && queuer &&
|
||||
queuer->ue->ino == FAKE_INO) {
|
||||
int ret, sks[2];
|
||||
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,574 +0,0 @@
|
||||
From c68b20e449d8dac653b1a9f6a893416d2d38cc07 Mon Sep 17 00:00:00 2001
|
||||
From: Bui Quang Minh <minhquangbui99@gmail.com>
|
||||
Date: Thu, 16 Dec 2021 09:35:25 +0700
|
||||
Subject: [PATCH 084/249] zdtm: Add SOCK_SEQPACKET variants to unix socket
|
||||
tests
|
||||
|
||||
This commit simply makes copies of SOCK_STREAM unix socket tests and uses
|
||||
SOCK_SEQPACKET instead.
|
||||
|
||||
Signed-off-by: Bui Quang Minh <minhquangbui99@gmail.com>
|
||||
---
|
||||
test/zdtm/static/Makefile | 23 +++++++++++++++++++
|
||||
test/zdtm/static/del_standalone_un.c | 8 ++++++-
|
||||
.../zdtm/static/del_standalone_un_seqpacket.c | 1 +
|
||||
test/zdtm/static/scm03-seqpacket.c | 1 +
|
||||
test/zdtm/static/scm03.c | 8 ++++++-
|
||||
test/zdtm/static/sk-unix-rel-seqpacket.c | 1 +
|
||||
test/zdtm/static/sk-unix-rel.c | 10 ++++++--
|
||||
test/zdtm/static/sk-unix-unconn-seqpacket.c | 1 +
|
||||
test/zdtm/static/sk-unix-unconn.c | 10 ++++++--
|
||||
test/zdtm/static/sk-unix01-seqpacket.c | 1 +
|
||||
test/zdtm/static/sk-unix01-seqpacket.desc | 1 +
|
||||
test/zdtm/static/sk-unix01.c | 12 +++++++---
|
||||
test/zdtm/static/socket_queues.c | 8 ++++++-
|
||||
test/zdtm/static/socket_queues_seqpacket.c | 1 +
|
||||
test/zdtm/static/sockets00-seqpacket.c | 1 +
|
||||
test/zdtm/static/sockets00-seqpacket.desc | 1 +
|
||||
test/zdtm/static/sockets00.c | 12 +++++++---
|
||||
test/zdtm/static/sockets01-seqpacket.c | 1 +
|
||||
test/zdtm/static/sockets01.c | 10 ++++++--
|
||||
test/zdtm/static/sockets02-seqpacket.c | 1 +
|
||||
test/zdtm/static/sockets02.c | 8 ++++++-
|
||||
test/zdtm/static/sockets03-seqpacket.c | 1 +
|
||||
test/zdtm/static/sockets03-seqpacket.desc | 1 +
|
||||
test/zdtm/static/sockets03.c | 10 ++++++--
|
||||
test/zdtm/static/sockets_spair.c | 8 ++++++-
|
||||
test/zdtm/static/sockets_spair_seqpacket.c | 1 +
|
||||
26 files changed, 122 insertions(+), 19 deletions(-)
|
||||
create mode 120000 test/zdtm/static/del_standalone_un_seqpacket.c
|
||||
create mode 120000 test/zdtm/static/scm03-seqpacket.c
|
||||
create mode 120000 test/zdtm/static/sk-unix-rel-seqpacket.c
|
||||
create mode 120000 test/zdtm/static/sk-unix-unconn-seqpacket.c
|
||||
create mode 120000 test/zdtm/static/sk-unix01-seqpacket.c
|
||||
create mode 120000 test/zdtm/static/sk-unix01-seqpacket.desc
|
||||
create mode 120000 test/zdtm/static/socket_queues_seqpacket.c
|
||||
create mode 120000 test/zdtm/static/sockets00-seqpacket.c
|
||||
create mode 120000 test/zdtm/static/sockets00-seqpacket.desc
|
||||
create mode 120000 test/zdtm/static/sockets01-seqpacket.c
|
||||
create mode 120000 test/zdtm/static/sockets02-seqpacket.c
|
||||
create mode 120000 test/zdtm/static/sockets03-seqpacket.c
|
||||
create mode 120000 test/zdtm/static/sockets03-seqpacket.desc
|
||||
create mode 120000 test/zdtm/static/sockets_spair_seqpacket.c
|
||||
|
||||
diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile
|
||||
index 3e1e0a498..4a21978b5 100644
|
||||
--- a/test/zdtm/static/Makefile
|
||||
+++ b/test/zdtm/static/Makefile
|
||||
@@ -68,9 +68,13 @@ TST_NOFILE := \
|
||||
utsname \
|
||||
pstree \
|
||||
sockets01 \
|
||||
+ sockets01-seqpacket \
|
||||
sockets02 \
|
||||
+ sockets02-seqpacket \
|
||||
sockets_spair \
|
||||
+ sockets_spair_seqpacket \
|
||||
socket_queues \
|
||||
+ socket_queues_seqpacket \
|
||||
socket-raw \
|
||||
socket-tcp \
|
||||
socket-tcp-listen \
|
||||
@@ -119,6 +123,7 @@ TST_NOFILE := \
|
||||
sock_opts01 \
|
||||
sock_opts02 \
|
||||
sk-unix-unconn \
|
||||
+ sk-unix-unconn-seqpacket \
|
||||
ipc_namespace \
|
||||
selfexe00 \
|
||||
sem \
|
||||
@@ -187,6 +192,7 @@ TST_NOFILE := \
|
||||
scm01 \
|
||||
scm02 \
|
||||
scm03 \
|
||||
+ scm03-seqpacket \
|
||||
scm04 \
|
||||
scm05 \
|
||||
scm06 \
|
||||
@@ -284,6 +290,7 @@ TST_FILE = \
|
||||
file_attr \
|
||||
deleted_unix_sock \
|
||||
sk-unix-rel \
|
||||
+ sk-unix-rel-seqpacket \
|
||||
deleted_dev \
|
||||
unlink_fstat00 \
|
||||
unlink_fstat01 \
|
||||
@@ -311,7 +318,9 @@ TST_FILE = \
|
||||
cow01 \
|
||||
fdt_shared \
|
||||
sockets00 \
|
||||
+ sockets00-seqpacket \
|
||||
sockets03 \
|
||||
+ sockets03-seqpacket \
|
||||
sockets_dgram \
|
||||
file_lease00 \
|
||||
file_lease01 \
|
||||
@@ -394,8 +403,10 @@ TST_DIR = \
|
||||
mnt_enablefs \
|
||||
autofs \
|
||||
del_standalone_un \
|
||||
+ del_standalone_un_seqpacket \
|
||||
sk-unix-mntns \
|
||||
sk-unix01 \
|
||||
+ sk-unix01-seqpacket \
|
||||
sk-unix-dgram-ghost \
|
||||
unsupported_children_collision \
|
||||
shared_slave_mount_children \
|
||||
@@ -607,6 +618,18 @@ socket-tcp6-unconn: CFLAGS += -D ZDTM_IPV6
|
||||
socket-tcp4v6-last-ack: CFLAGS += -D ZDTM_TCP_LAST_ACK -D ZDTM_IPV4V6
|
||||
socket-tcp4v6-closing: CFLAGS += -D ZDTM_IPV4V6
|
||||
|
||||
+sockets00-seqpacket: CFLAGS += -D ZDTM_UNIX_SEQPACKET
|
||||
+sockets01-seqpacket: CFLAGS += -D ZDTM_UNIX_SEQPACKET
|
||||
+sockets02-seqpacket: CFLAGS += -D ZDTM_UNIX_SEQPACKET
|
||||
+sockets03-seqpacket: CFLAGS += -D ZDTM_UNIX_SEQPACKET
|
||||
+sk-unix01-seqpacket: CFLAGS += -D ZDTM_UNIX_SEQPACKET
|
||||
+sk-unix-rel-seqpacket: CFLAGS += -D ZDTM_UNIX_SEQPACKET
|
||||
+sockets_spair_seqpacket: CFLAGS += -D ZDTM_UNIX_SEQPACKET
|
||||
+socket_queues_seqpacket: CFLAGS += -D ZDTM_UNIX_SEQPACKET
|
||||
+del_standalone_un_seqpacket: CFLAGS += -D ZDTM_UNIX_SEQPACKET
|
||||
+sk-unix-unconn-seqpacket: CFLAGS += -D ZDTM_UNIX_SEQPACKET
|
||||
+scm03-seqpacket: CFLAGS += -D ZDTM_UNIX_SEQPACKET
|
||||
+
|
||||
pty-console: CFLAGS += -D ZDTM_DEV_CONSOLE
|
||||
|
||||
shm-unaligned: CFLAGS += -DZDTM_SHM_UNALIGNED
|
||||
diff --git a/test/zdtm/static/del_standalone_un.c b/test/zdtm/static/del_standalone_un.c
|
||||
index c9fa84870..b4f99e260 100644
|
||||
--- a/test/zdtm/static/del_standalone_un.c
|
||||
+++ b/test/zdtm/static/del_standalone_un.c
|
||||
@@ -16,11 +16,17 @@ const char *test_author = "Tycho Andersen <tycho.andersen@canonical.com>";
|
||||
char *dirname;
|
||||
TEST_OPTION(dirname, string, "directory name", 1);
|
||||
|
||||
+#ifdef ZDTM_UNIX_SEQPACKET
|
||||
+#define SOCK_TYPE SOCK_SEQPACKET
|
||||
+#else
|
||||
+#define SOCK_TYPE SOCK_STREAM
|
||||
+#endif
|
||||
+
|
||||
static int bind_and_listen(struct sockaddr_un *addr)
|
||||
{
|
||||
int sk;
|
||||
|
||||
- sk = socket(PF_UNIX, SOCK_STREAM, 0);
|
||||
+ sk = socket(PF_UNIX, SOCK_TYPE, 0);
|
||||
if (sk < 0) {
|
||||
fail("socket");
|
||||
return -1;
|
||||
diff --git a/test/zdtm/static/del_standalone_un_seqpacket.c b/test/zdtm/static/del_standalone_un_seqpacket.c
|
||||
new file mode 120000
|
||||
index 000000000..d88fcbad8
|
||||
--- /dev/null
|
||||
+++ b/test/zdtm/static/del_standalone_un_seqpacket.c
|
||||
@@ -0,0 +1 @@
|
||||
+del_standalone_un.c
|
||||
\ No newline at end of file
|
||||
diff --git a/test/zdtm/static/scm03-seqpacket.c b/test/zdtm/static/scm03-seqpacket.c
|
||||
new file mode 120000
|
||||
index 000000000..f1f86dd8b
|
||||
--- /dev/null
|
||||
+++ b/test/zdtm/static/scm03-seqpacket.c
|
||||
@@ -0,0 +1 @@
|
||||
+scm03.c
|
||||
\ No newline at end of file
|
||||
diff --git a/test/zdtm/static/scm03.c b/test/zdtm/static/scm03.c
|
||||
index a40fc0101..4453f7e93 100644
|
||||
--- a/test/zdtm/static/scm03.c
|
||||
+++ b/test/zdtm/static/scm03.c
|
||||
@@ -9,6 +9,12 @@
|
||||
const char *test_doc = "Check that SCM_RIGHTS are preserved";
|
||||
const char *test_author = "Pavel Emelyanov <xemul@virtuozzo.com>";
|
||||
|
||||
+#ifdef ZDTM_UNIX_SEQPACKET
|
||||
+#define SOCK_TYPE SOCK_SEQPACKET
|
||||
+#else
|
||||
+#define SOCK_TYPE SOCK_DGRAM
|
||||
+#endif
|
||||
+
|
||||
static int send_fd(int via, int fd1, int fd2)
|
||||
{
|
||||
struct msghdr h = {};
|
||||
@@ -105,7 +111,7 @@ int main(int argc, char **argv)
|
||||
|
||||
test_init(argc, argv);
|
||||
|
||||
- if (socketpair(PF_UNIX, SOCK_DGRAM, 0, sk) < 0) {
|
||||
+ if (socketpair(PF_UNIX, SOCK_TYPE, 0, sk) < 0) {
|
||||
pr_perror("Can't make unix pair");
|
||||
exit(1);
|
||||
}
|
||||
diff --git a/test/zdtm/static/sk-unix-rel-seqpacket.c b/test/zdtm/static/sk-unix-rel-seqpacket.c
|
||||
new file mode 120000
|
||||
index 000000000..1f98e3845
|
||||
--- /dev/null
|
||||
+++ b/test/zdtm/static/sk-unix-rel-seqpacket.c
|
||||
@@ -0,0 +1 @@
|
||||
+sk-unix-rel.c
|
||||
\ No newline at end of file
|
||||
diff --git a/test/zdtm/static/sk-unix-rel.c b/test/zdtm/static/sk-unix-rel.c
|
||||
index 10c19080a..7e4aeafe6 100644
|
||||
--- a/test/zdtm/static/sk-unix-rel.c
|
||||
+++ b/test/zdtm/static/sk-unix-rel.c
|
||||
@@ -25,6 +25,12 @@ TEST_OPTION(filename, string, "socket file name", 1);
|
||||
|
||||
#define TEST_MODE 0640
|
||||
|
||||
+#ifdef ZDTM_UNIX_SEQPACKET
|
||||
+#define SOCK_TYPE SOCK_SEQPACKET
|
||||
+#else
|
||||
+#define SOCK_TYPE SOCK_STREAM
|
||||
+#endif
|
||||
+
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct sockaddr_un addr;
|
||||
@@ -54,8 +60,8 @@ int main(int argc, char *argv[])
|
||||
memcpy(addr.sun_path, filename, addrlen);
|
||||
addrlen += sizeof(addr.sun_family);
|
||||
|
||||
- sock[0] = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
- sock[1] = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
+ sock[0] = socket(AF_UNIX, SOCK_TYPE, 0);
|
||||
+ sock[1] = socket(AF_UNIX, SOCK_TYPE, 0);
|
||||
if (sock[0] < 0 || sock[1] < 0) {
|
||||
fail("socket");
|
||||
exit(1);
|
||||
diff --git a/test/zdtm/static/sk-unix-unconn-seqpacket.c b/test/zdtm/static/sk-unix-unconn-seqpacket.c
|
||||
new file mode 120000
|
||||
index 000000000..f5c276186
|
||||
--- /dev/null
|
||||
+++ b/test/zdtm/static/sk-unix-unconn-seqpacket.c
|
||||
@@ -0,0 +1 @@
|
||||
+sk-unix-unconn.c
|
||||
\ No newline at end of file
|
||||
diff --git a/test/zdtm/static/sk-unix-unconn.c b/test/zdtm/static/sk-unix-unconn.c
|
||||
index caad3d315..62e48247f 100644
|
||||
--- a/test/zdtm/static/sk-unix-unconn.c
|
||||
+++ b/test/zdtm/static/sk-unix-unconn.c
|
||||
@@ -9,6 +9,12 @@
|
||||
const char *test_doc = "Check unconnected unix sockets";
|
||||
const char *test_author = "Vagin Andrew <avagin@parallels.com>";
|
||||
|
||||
+#ifdef ZDTM_UNIX_SEQPACKET
|
||||
+#define SOCK_TYPE SOCK_SEQPACKET
|
||||
+#else
|
||||
+#define SOCK_TYPE SOCK_STREAM
|
||||
+#endif
|
||||
+
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int sk, skc;
|
||||
@@ -19,13 +25,13 @@ int main(int argc, char **argv)
|
||||
|
||||
test_init(argc, argv);
|
||||
|
||||
- sk = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
+ sk = socket(AF_UNIX, SOCK_TYPE, 0);
|
||||
if (sk == -1) {
|
||||
pr_perror("socket");
|
||||
return 1;
|
||||
}
|
||||
|
||||
- skc = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
+ skc = socket(AF_UNIX, SOCK_TYPE, 0);
|
||||
if (skc == -1) {
|
||||
pr_perror("socket");
|
||||
return 1;
|
||||
diff --git a/test/zdtm/static/sk-unix01-seqpacket.c b/test/zdtm/static/sk-unix01-seqpacket.c
|
||||
new file mode 120000
|
||||
index 000000000..bef734ed6
|
||||
--- /dev/null
|
||||
+++ b/test/zdtm/static/sk-unix01-seqpacket.c
|
||||
@@ -0,0 +1 @@
|
||||
+sk-unix01.c
|
||||
\ No newline at end of file
|
||||
diff --git a/test/zdtm/static/sk-unix01-seqpacket.desc b/test/zdtm/static/sk-unix01-seqpacket.desc
|
||||
new file mode 120000
|
||||
index 000000000..7a30da25c
|
||||
--- /dev/null
|
||||
+++ b/test/zdtm/static/sk-unix01-seqpacket.desc
|
||||
@@ -0,0 +1 @@
|
||||
+sk-unix01.desc
|
||||
\ No newline at end of file
|
||||
diff --git a/test/zdtm/static/sk-unix01.c b/test/zdtm/static/sk-unix01.c
|
||||
index c2bb8b9ed..5146c027f 100644
|
||||
--- a/test/zdtm/static/sk-unix01.c
|
||||
+++ b/test/zdtm/static/sk-unix01.c
|
||||
@@ -24,6 +24,12 @@ const char *test_author = "Cyrill Gorcunov <gorcunov@openvz.org>";
|
||||
char *dirname;
|
||||
TEST_OPTION(dirname, string, "directory name", 1);
|
||||
|
||||
+#ifdef ZDTM_UNIX_SEQPACKET
|
||||
+#define SOCK_TYPE SOCK_SEQPACKET
|
||||
+#else
|
||||
+#define SOCK_TYPE SOCK_STREAM
|
||||
+#endif
|
||||
+
|
||||
static int sk_alloc_bind(int type, struct sockaddr_un *addr)
|
||||
{
|
||||
int sk;
|
||||
@@ -256,7 +262,7 @@ int main(int argc, char **argv)
|
||||
|
||||
unlink(addr.sun_path);
|
||||
|
||||
- sk_st[0] = sk_alloc_bind(SOCK_STREAM, &addr);
|
||||
+ sk_st[0] = sk_alloc_bind(SOCK_TYPE, &addr);
|
||||
if (sk_st[0] < 0)
|
||||
return 1;
|
||||
test_msg("sk-st: alloc/bind/listen %d\n", sk_st[0]);
|
||||
@@ -266,7 +272,7 @@ int main(int argc, char **argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
- sk_st[1] = sk_alloc_connect(SOCK_STREAM, &addr);
|
||||
+ sk_st[1] = sk_alloc_connect(SOCK_TYPE, &addr);
|
||||
if (sk_st[1] < 0)
|
||||
return 1;
|
||||
test_msg("sk-st: alloc/connect %d\n", sk_st[1]);
|
||||
@@ -279,7 +285,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
test_msg("sk-st: accept %d\n", sk_st[2]);
|
||||
|
||||
- sk_st[3] = sk_alloc_connect(SOCK_STREAM, &addr);
|
||||
+ sk_st[3] = sk_alloc_connect(SOCK_TYPE, &addr);
|
||||
if (sk_st[3] < 0)
|
||||
return 1;
|
||||
test_msg("sk-st: alloc/connect %d\n", sk_st[3]);
|
||||
diff --git a/test/zdtm/static/socket_queues.c b/test/zdtm/static/socket_queues.c
|
||||
index e30bca0e1..44495f06b 100644
|
||||
--- a/test/zdtm/static/socket_queues.c
|
||||
+++ b/test/zdtm/static/socket_queues.c
|
||||
@@ -24,6 +24,12 @@ const char *test_author = "Stanislav Kinsbursky <skinsbursky@parallels.com>\n";
|
||||
#define SK_DATA_D1 "packet dgram left"
|
||||
#define SK_DATA_D2 "packet dgram right"
|
||||
|
||||
+#ifdef ZDTM_UNIX_SEQPACKET
|
||||
+#define SOCK_TYPE SOCK_SEQPACKET
|
||||
+#else
|
||||
+#define SOCK_TYPE SOCK_STREAM
|
||||
+#endif
|
||||
+
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int ssk_pair_d[2];
|
||||
@@ -32,7 +38,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
test_init(argc, argv);
|
||||
|
||||
- if (socketpair(AF_UNIX, SOCK_STREAM, 0, ssk_pair_s) == -1) {
|
||||
+ if (socketpair(AF_UNIX, SOCK_TYPE, 0, ssk_pair_s) == -1) {
|
||||
fail("socketpair");
|
||||
exit(1);
|
||||
}
|
||||
diff --git a/test/zdtm/static/socket_queues_seqpacket.c b/test/zdtm/static/socket_queues_seqpacket.c
|
||||
new file mode 120000
|
||||
index 000000000..0f3f93ea6
|
||||
--- /dev/null
|
||||
+++ b/test/zdtm/static/socket_queues_seqpacket.c
|
||||
@@ -0,0 +1 @@
|
||||
+socket_queues.c
|
||||
\ No newline at end of file
|
||||
diff --git a/test/zdtm/static/sockets00-seqpacket.c b/test/zdtm/static/sockets00-seqpacket.c
|
||||
new file mode 120000
|
||||
index 000000000..4bce9fc31
|
||||
--- /dev/null
|
||||
+++ b/test/zdtm/static/sockets00-seqpacket.c
|
||||
@@ -0,0 +1 @@
|
||||
+sockets00.c
|
||||
\ No newline at end of file
|
||||
diff --git a/test/zdtm/static/sockets00-seqpacket.desc b/test/zdtm/static/sockets00-seqpacket.desc
|
||||
new file mode 120000
|
||||
index 000000000..4beea2642
|
||||
--- /dev/null
|
||||
+++ b/test/zdtm/static/sockets00-seqpacket.desc
|
||||
@@ -0,0 +1 @@
|
||||
+sockets00.desc
|
||||
\ No newline at end of file
|
||||
diff --git a/test/zdtm/static/sockets00.c b/test/zdtm/static/sockets00.c
|
||||
index 53890077b..ac5d7d6fe 100644
|
||||
--- a/test/zdtm/static/sockets00.c
|
||||
+++ b/test/zdtm/static/sockets00.c
|
||||
@@ -25,6 +25,12 @@ TEST_OPTION(filename, string, "socket file name", 1);
|
||||
|
||||
#define TEST_MODE 0640
|
||||
|
||||
+#ifdef ZDTM_UNIX_SEQPACKET
|
||||
+#define SOCK_TYPE SOCK_SEQPACKET
|
||||
+#else
|
||||
+#define SOCK_TYPE SOCK_STREAM
|
||||
+#endif
|
||||
+
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int ssk_icon[4];
|
||||
@@ -58,9 +64,9 @@ int main(int argc, char *argv[])
|
||||
memcpy(addr.sun_path, path, addrlen);
|
||||
addrlen += sizeof(addr.sun_family);
|
||||
|
||||
- ssk_icon[0] = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
- ssk_icon[1] = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
- ssk_icon[2] = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
+ ssk_icon[0] = socket(AF_UNIX, SOCK_TYPE, 0);
|
||||
+ ssk_icon[1] = socket(AF_UNIX, SOCK_TYPE, 0);
|
||||
+ ssk_icon[2] = socket(AF_UNIX, SOCK_TYPE, 0);
|
||||
if (ssk_icon[0] < 0 || ssk_icon[1] < 0 || ssk_icon[2] < 0) {
|
||||
fail("socket");
|
||||
exit(1);
|
||||
diff --git a/test/zdtm/static/sockets01-seqpacket.c b/test/zdtm/static/sockets01-seqpacket.c
|
||||
new file mode 120000
|
||||
index 000000000..8d51121e1
|
||||
--- /dev/null
|
||||
+++ b/test/zdtm/static/sockets01-seqpacket.c
|
||||
@@ -0,0 +1 @@
|
||||
+sockets01.c
|
||||
\ No newline at end of file
|
||||
diff --git a/test/zdtm/static/sockets01.c b/test/zdtm/static/sockets01.c
|
||||
index e35a31fec..f56cd219e 100644
|
||||
--- a/test/zdtm/static/sockets01.c
|
||||
+++ b/test/zdtm/static/sockets01.c
|
||||
@@ -30,6 +30,12 @@ const char *test_author = "Pavel Emelyanov <xemul@parallels.com>";
|
||||
#define TEST_MSG "test-message"
|
||||
static char buf[sizeof(TEST_MSG)];
|
||||
|
||||
+#ifdef ZDTM_UNIX_SEQPACKET
|
||||
+#define SOCK_TYPE SOCK_SEQPACKET
|
||||
+#else
|
||||
+#define SOCK_TYPE SOCK_STREAM
|
||||
+#endif
|
||||
+
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int spu[2], spb[2], dpu[2], dpb[2], dpd[2];
|
||||
@@ -40,14 +46,14 @@ int main(int argc, char *argv[])
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
|
||||
/* spu -- stream pair, unidirectional shutdown */
|
||||
- if (socketpair(PF_UNIX, SOCK_STREAM, 0, spu) < 0)
|
||||
+ if (socketpair(PF_UNIX, SOCK_TYPE, 0, spu) < 0)
|
||||
fin("no stream pair 1");
|
||||
|
||||
if (shutdown(spu[0], SHUT_RD) < 0)
|
||||
fin("no stream shutdown 1");
|
||||
|
||||
/* spb -- stream pair, bidirectional shutdown */
|
||||
- if (socketpair(PF_UNIX, SOCK_STREAM, 0, spb) < 0)
|
||||
+ if (socketpair(PF_UNIX, SOCK_TYPE, 0, spb) < 0)
|
||||
fin("no stream pair 2");
|
||||
|
||||
if (shutdown(spb[0], SHUT_RDWR) < 0)
|
||||
diff --git a/test/zdtm/static/sockets02-seqpacket.c b/test/zdtm/static/sockets02-seqpacket.c
|
||||
new file mode 120000
|
||||
index 000000000..b95831599
|
||||
--- /dev/null
|
||||
+++ b/test/zdtm/static/sockets02-seqpacket.c
|
||||
@@ -0,0 +1 @@
|
||||
+sockets02.c
|
||||
\ No newline at end of file
|
||||
diff --git a/test/zdtm/static/sockets02.c b/test/zdtm/static/sockets02.c
|
||||
index 2729ade2c..d7d84d815 100644
|
||||
--- a/test/zdtm/static/sockets02.c
|
||||
+++ b/test/zdtm/static/sockets02.c
|
||||
@@ -16,6 +16,12 @@
|
||||
const char *test_doc = "Test semi-closed unix stream connection\n";
|
||||
const char *test_author = "Pavel Emelyanov <xemul@parallels.com>\n";
|
||||
|
||||
+#ifdef ZDTM_UNIX_SEQPACKET
|
||||
+#define SOCK_TYPE SOCK_SEQPACKET
|
||||
+#else
|
||||
+#define SOCK_TYPE SOCK_STREAM
|
||||
+#endif
|
||||
+
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int ssk_pair[2], ret;
|
||||
@@ -25,7 +31,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
data = (char)lrand48();
|
||||
|
||||
- if (socketpair(AF_UNIX, SOCK_STREAM, 0, ssk_pair) == -1) {
|
||||
+ if (socketpair(AF_UNIX, SOCK_TYPE, 0, ssk_pair) == -1) {
|
||||
fail("socketpair");
|
||||
exit(1);
|
||||
}
|
||||
diff --git a/test/zdtm/static/sockets03-seqpacket.c b/test/zdtm/static/sockets03-seqpacket.c
|
||||
new file mode 120000
|
||||
index 000000000..997cce673
|
||||
--- /dev/null
|
||||
+++ b/test/zdtm/static/sockets03-seqpacket.c
|
||||
@@ -0,0 +1 @@
|
||||
+sockets03.c
|
||||
\ No newline at end of file
|
||||
diff --git a/test/zdtm/static/sockets03-seqpacket.desc b/test/zdtm/static/sockets03-seqpacket.desc
|
||||
new file mode 120000
|
||||
index 000000000..3798a8242
|
||||
--- /dev/null
|
||||
+++ b/test/zdtm/static/sockets03-seqpacket.desc
|
||||
@@ -0,0 +1 @@
|
||||
+sockets03.desc
|
||||
\ No newline at end of file
|
||||
diff --git a/test/zdtm/static/sockets03.c b/test/zdtm/static/sockets03.c
|
||||
index cd6f60831..6b0915aaa 100644
|
||||
--- a/test/zdtm/static/sockets03.c
|
||||
+++ b/test/zdtm/static/sockets03.c
|
||||
@@ -22,6 +22,12 @@ const char *test_author = "Andrey Ryabinin <aryabinin@virtuozzo.com>";
|
||||
char *filename;
|
||||
TEST_OPTION(filename, string, "socket file name", 1);
|
||||
|
||||
+#ifdef ZDTM_UNIX_SEQPACKET
|
||||
+#define SOCK_TYPE SOCK_SEQPACKET
|
||||
+#else
|
||||
+#define SOCK_TYPE SOCK_STREAM
|
||||
+#endif
|
||||
+
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int sk[3];
|
||||
@@ -52,8 +58,8 @@ int main(int argc, char *argv[])
|
||||
memcpy(addr.sun_path, path, addrlen);
|
||||
addrlen += sizeof(addr.sun_family);
|
||||
|
||||
- sk[0] = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
- sk[1] = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
+ sk[0] = socket(AF_UNIX, SOCK_TYPE, 0);
|
||||
+ sk[1] = socket(AF_UNIX, SOCK_TYPE, 0);
|
||||
if (sk[0] < 0 || sk[1] < 0) {
|
||||
fail("socket");
|
||||
exit(1);
|
||||
diff --git a/test/zdtm/static/sockets_spair.c b/test/zdtm/static/sockets_spair.c
|
||||
index 2dbb132aa..202c2e790 100644
|
||||
--- a/test/zdtm/static/sockets_spair.c
|
||||
+++ b/test/zdtm/static/sockets_spair.c
|
||||
@@ -18,6 +18,12 @@ const char *test_author = "Cyrill Gorcunov <gorcunov@openvz.org";
|
||||
|
||||
#define SK_DATA "packet"
|
||||
|
||||
+#ifdef ZDTM_UNIX_SEQPACKET
|
||||
+#define SOCK_TYPE SOCK_SEQPACKET
|
||||
+#else
|
||||
+#define SOCK_TYPE SOCK_STREAM
|
||||
+#endif
|
||||
+
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int ssk_pair[2];
|
||||
@@ -25,7 +31,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
test_init(argc, argv);
|
||||
|
||||
- if (socketpair(AF_UNIX, SOCK_STREAM, 0, ssk_pair) == -1) {
|
||||
+ if (socketpair(AF_UNIX, SOCK_TYPE, 0, ssk_pair) == -1) {
|
||||
fail("socketpair");
|
||||
exit(1);
|
||||
}
|
||||
diff --git a/test/zdtm/static/sockets_spair_seqpacket.c b/test/zdtm/static/sockets_spair_seqpacket.c
|
||||
new file mode 120000
|
||||
index 000000000..a52ccb6c9
|
||||
--- /dev/null
|
||||
+++ b/test/zdtm/static/sockets_spair_seqpacket.c
|
||||
@@ -0,0 +1 @@
|
||||
+sockets_spair.c
|
||||
\ No newline at end of file
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,26 +0,0 @@
|
||||
From a67c56da45910d3c07bdf54f2aecf43f57ca1451 Mon Sep 17 00:00:00 2001
|
||||
From: Radostin Stoyanov <radostin@redhat.com>
|
||||
Date: Tue, 7 Dec 2021 21:29:44 +0000
|
||||
Subject: [PATCH 085/249] tls: fix typo
|
||||
|
||||
Signed-off-by: Radostin Stoyanov <radostin@redhat.com>
|
||||
---
|
||||
criu/tls.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/criu/tls.c b/criu/tls.c
|
||||
index 60bd105bc..6a7b523ac 100644
|
||||
--- a/criu/tls.c
|
||||
+++ b/criu/tls.c
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "cr_options.h"
|
||||
#include "xmalloc.h"
|
||||
|
||||
-/* Compatability with GnuTLS verson <3.5 */
|
||||
+/* Compatability with GnuTLS version < 3.5 */
|
||||
#ifndef GNUTLS_E_CERTIFICATE_VERIFICATION_ERROR
|
||||
#define GNUTLS_E_CERTIFICATE_VERIFICATION_ERROR GNUTLS_E_CERTIFICATE_ERROR
|
||||
#endif
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,71 +0,0 @@
|
||||
From 3b96f978beb40ebbd1b9b1610d1a2df5181d4bce Mon Sep 17 00:00:00 2001
|
||||
From: Radostin Stoyanov <radostin@redhat.com>
|
||||
Date: Tue, 7 Dec 2021 22:32:54 +0000
|
||||
Subject: [PATCH 086/249] tls: use ssize_t for return value
|
||||
|
||||
Signed-off-by: Radostin Stoyanov <radostin@redhat.com>
|
||||
---
|
||||
criu/tls.c | 12 ++++++------
|
||||
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/criu/tls.c b/criu/tls.c
|
||||
index 6a7b523ac..626e529f8 100644
|
||||
--- a/criu/tls.c
|
||||
+++ b/criu/tls.c
|
||||
@@ -53,7 +53,7 @@ void tls_terminate_session(void)
|
||||
|
||||
ssize_t tls_send(const void *buf, size_t len, int flags)
|
||||
{
|
||||
- int ret;
|
||||
+ ssize_t ret;
|
||||
|
||||
tls_sk_flags = flags;
|
||||
ret = gnutls_record_send(session, buf, len);
|
||||
@@ -95,7 +95,7 @@ int tls_send_data_from_fd(int fd, unsigned long len)
|
||||
return -1;
|
||||
|
||||
while (len > 0) {
|
||||
- int ret, sent;
|
||||
+ ssize_t ret, sent;
|
||||
|
||||
copied = read(fd, buf, min(len, buf_size));
|
||||
if (copied <= 0) {
|
||||
@@ -119,7 +119,7 @@ err:
|
||||
|
||||
ssize_t tls_recv(void *buf, size_t len, int flags)
|
||||
{
|
||||
- int ret;
|
||||
+ ssize_t ret;
|
||||
|
||||
tls_sk_flags = flags;
|
||||
ret = gnutls_record_recv(session, buf, len);
|
||||
@@ -163,7 +163,7 @@ int tls_recv_data_to_fd(int fd, unsigned long len)
|
||||
gnutls_packet_t packet;
|
||||
|
||||
while (len > 0) {
|
||||
- int ret, w;
|
||||
+ ssize_t ret, w;
|
||||
gnutls_datum_t pdata;
|
||||
|
||||
ret = gnutls_record_recv_packet(session, &packet);
|
||||
@@ -301,7 +301,7 @@ static int tls_x509_setup_creds(void)
|
||||
static ssize_t _tls_push_cb(void *p, const void *data, size_t sz)
|
||||
{
|
||||
int fd = *(int *)(p);
|
||||
- int ret = send(fd, data, sz, tls_sk_flags);
|
||||
+ ssize_t ret = send(fd, data, sz, tls_sk_flags);
|
||||
if (ret < 0 && errno != EAGAIN) {
|
||||
int _errno = errno;
|
||||
pr_perror("Push callback send failed");
|
||||
@@ -313,7 +313,7 @@ static ssize_t _tls_push_cb(void *p, const void *data, size_t sz)
|
||||
static ssize_t _tls_pull_cb(void *p, void *data, size_t sz)
|
||||
{
|
||||
int fd = *(int *)(p);
|
||||
- int ret = recv(fd, data, sz, tls_sk_flags);
|
||||
+ ssize_t ret = recv(fd, data, sz, tls_sk_flags);
|
||||
if (ret < 0 && errno != EAGAIN) {
|
||||
int _errno = errno;
|
||||
pr_perror("Pull callback recv failed");
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,111 +0,0 @@
|
||||
From f6760b9a2e3b714c63e838e7cb0262223a8d501e Mon Sep 17 00:00:00 2001
|
||||
From: Radostin Stoyanov <radostin@redhat.com>
|
||||
Date: Thu, 16 Dec 2021 14:26:53 +0000
|
||||
Subject: [PATCH 087/249] tls: add more comments
|
||||
|
||||
Signed-off-by: Radostin Stoyanov <radostin@redhat.com>
|
||||
---
|
||||
criu/tls.c | 26 +++++++++++++++++++++++++-
|
||||
1 file changed, 25 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/criu/tls.c b/criu/tls.c
|
||||
index 626e529f8..9985b037d 100644
|
||||
--- a/criu/tls.c
|
||||
+++ b/criu/tls.c
|
||||
@@ -40,13 +40,19 @@ void tls_terminate_session(void)
|
||||
|
||||
if (session) {
|
||||
do {
|
||||
- /* don't wait for peer to close connection */
|
||||
+ /*
|
||||
+ * Initiate a connection shutdown but don't
|
||||
+ * wait for peer to close connection.
|
||||
+ */
|
||||
ret = gnutls_bye(session, GNUTLS_SHUT_WR);
|
||||
} while (ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED);
|
||||
+ /* Free the session object */
|
||||
gnutls_deinit(session);
|
||||
}
|
||||
|
||||
tls_sk = -1;
|
||||
+
|
||||
+ /* Free the credentials object */
|
||||
if (x509_cred)
|
||||
gnutls_certificate_free_credentials(x509_cred);
|
||||
}
|
||||
@@ -229,6 +235,7 @@ static int tls_handshake(void)
|
||||
{
|
||||
int ret = -1;
|
||||
while (ret != GNUTLS_E_SUCCESS) {
|
||||
+ /* Establish TLS session */
|
||||
ret = gnutls_handshake(session);
|
||||
if (gnutls_error_is_fatal(ret)) {
|
||||
tls_perror("TLS handshake failed", ret);
|
||||
@@ -257,6 +264,7 @@ static int tls_x509_setup_creds(void)
|
||||
if (opts.tls_key)
|
||||
key = opts.tls_key;
|
||||
|
||||
+ /* Load the trusted CA certificates */
|
||||
ret = gnutls_certificate_allocate_credentials(&x509_cred);
|
||||
if (ret != GNUTLS_E_SUCCESS) {
|
||||
tls_perror("Failed to allocate x509 credentials", ret);
|
||||
@@ -298,6 +306,10 @@ static int tls_x509_setup_creds(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+/**
|
||||
+ * A function used by gnutls to send data. It returns a positive
|
||||
+ * number indicating the bytes sent, and -1 on error.
|
||||
+ */
|
||||
static ssize_t _tls_push_cb(void *p, const void *data, size_t sz)
|
||||
{
|
||||
int fd = *(int *)(p);
|
||||
@@ -310,6 +322,11 @@ static ssize_t _tls_push_cb(void *p, const void *data, size_t sz)
|
||||
return ret;
|
||||
}
|
||||
|
||||
+/**
|
||||
+ * A callback function used by gnutls to receive data.
|
||||
+ * It returns 0 on connection termination, a positive number
|
||||
+ * indicating the number of bytes received, and -1 on error.
|
||||
+ */
|
||||
static ssize_t _tls_pull_cb(void *p, void *data, size_t sz)
|
||||
{
|
||||
int fd = *(int *)(p);
|
||||
@@ -326,26 +343,33 @@ static int tls_x509_setup_session(unsigned int flags)
|
||||
{
|
||||
int ret;
|
||||
|
||||
+ /* Create the session object */
|
||||
ret = gnutls_init(&session, flags);
|
||||
if (ret != GNUTLS_E_SUCCESS) {
|
||||
tls_perror("Failed to initialize session", ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
+ /* Install the trusted certificates */
|
||||
ret = gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, x509_cred);
|
||||
if (ret != GNUTLS_E_SUCCESS) {
|
||||
tls_perror("Failed to set session credentials", ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
+ /* Configure the cipher preferences */
|
||||
ret = gnutls_set_default_priority(session);
|
||||
if (ret != GNUTLS_E_SUCCESS) {
|
||||
tls_perror("Failed to set priority", ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
+ /* Associate the socket with the session object */
|
||||
gnutls_transport_set_ptr(session, &tls_sk);
|
||||
+
|
||||
+ /* Set a push function for gnutls to use to send data */
|
||||
gnutls_transport_set_push_function(session, _tls_push_cb);
|
||||
+ /* set a pull function for gnutls to use to receive data */
|
||||
gnutls_transport_set_pull_function(session, _tls_pull_cb);
|
||||
|
||||
if (flags == GNUTLS_SERVER) {
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,30 +0,0 @@
|
||||
From 10199579ab5e5d95465d5e28fa5c72b5d782eebe Mon Sep 17 00:00:00 2001
|
||||
From: Andrei Vagin <avagin@gmail.com>
|
||||
Date: Tue, 21 Dec 2021 21:59:13 -0800
|
||||
Subject: [PATCH 088/249] uffd: call disconnect_from_page_server to shutdown a
|
||||
page-server connection
|
||||
|
||||
We need to be sure that page-server doesn't wait for a new command when we
|
||||
call gnutls_bye() that sends an alert containing a close request.
|
||||
|
||||
Signed-off-by: Andrei Vagin <avagin@gmail.com>
|
||||
---
|
||||
criu/uffd.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/criu/uffd.c b/criu/uffd.c
|
||||
index f01e6999b..45ac8ba77 100644
|
||||
--- a/criu/uffd.c
|
||||
+++ b/criu/uffd.c
|
||||
@@ -1468,7 +1468,7 @@ int cr_lazy_pages(bool daemon)
|
||||
|
||||
ret = handle_requests(epollfd, &events, nr_fds);
|
||||
|
||||
- tls_terminate_session();
|
||||
+ disconnect_from_page_server();
|
||||
|
||||
xfree(events);
|
||||
return ret;
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,100 +0,0 @@
|
||||
From 8333e9dd1562b46fd0cb43ab22c9ac28e46ac66f Mon Sep 17 00:00:00 2001
|
||||
From: Andrei Vagin <avagin@gmail.com>
|
||||
Date: Wed, 22 Dec 2021 09:36:09 -0800
|
||||
Subject: [PATCH 089/249] tls: allow to terminate connections synchronously
|
||||
|
||||
GNUTLS_SHUT_RDWR sends an alert containing a close request and waits for
|
||||
the peer to reply with the same message.
|
||||
|
||||
Signed-off-by: Andrei Vagin <avagin@gmail.com>
|
||||
---
|
||||
criu/include/tls.h | 4 ++--
|
||||
criu/page-xfer.c | 5 +++--
|
||||
criu/tls.c | 6 +++---
|
||||
3 files changed, 8 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/criu/include/tls.h b/criu/include/tls.h
|
||||
index 26f9976fd..f563c092c 100644
|
||||
--- a/criu/include/tls.h
|
||||
+++ b/criu/include/tls.h
|
||||
@@ -4,7 +4,7 @@
|
||||
#ifdef CONFIG_GNUTLS
|
||||
|
||||
int tls_x509_init(int sockfd, bool is_server);
|
||||
-void tls_terminate_session(void);
|
||||
+void tls_terminate_session(bool async);
|
||||
|
||||
ssize_t tls_send(const void *buf, size_t len, int flags);
|
||||
ssize_t tls_recv(void *buf, size_t len, int flags);
|
||||
@@ -19,7 +19,7 @@ int tls_recv_data_to_fd(int fd, unsigned long len);
|
||||
#define tls_recv(buf, len, flags) (-1)
|
||||
#define tls_send_data_from_fd(fd, len) (-1)
|
||||
#define tls_recv_data_to_fd(fd, len) (-1)
|
||||
-#define tls_terminate_session()
|
||||
+#define tls_terminate_session(async)
|
||||
|
||||
#endif /* CONFIG_HAS_GNUTLS */
|
||||
|
||||
diff --git a/criu/page-xfer.c b/criu/page-xfer.c
|
||||
index 9adf2c8b2..7ff07680f 100644
|
||||
--- a/criu/page-xfer.c
|
||||
+++ b/criu/page-xfer.c
|
||||
@@ -1259,6 +1259,8 @@ static int page_server_serve(int sk)
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
+ tls_terminate_session(ret != 0);
|
||||
+
|
||||
if (ret == 0 && opts.ps_socket == -1) {
|
||||
char c;
|
||||
|
||||
@@ -1272,7 +1274,6 @@ static int page_server_serve(int sk)
|
||||
}
|
||||
}
|
||||
|
||||
- tls_terminate_session();
|
||||
page_server_close();
|
||||
|
||||
pr_info("Session over\n");
|
||||
@@ -1504,7 +1505,7 @@ int disconnect_from_page_server(void)
|
||||
|
||||
ret = 0;
|
||||
out:
|
||||
- tls_terminate_session();
|
||||
+ tls_terminate_session(ret != 0);
|
||||
close_safe(&page_server_sk);
|
||||
|
||||
return ret ?: status;
|
||||
diff --git a/criu/tls.c b/criu/tls.c
|
||||
index 9985b037d..4feaf613b 100644
|
||||
--- a/criu/tls.c
|
||||
+++ b/criu/tls.c
|
||||
@@ -31,7 +31,7 @@ static gnutls_certificate_credentials_t x509_cred;
|
||||
static int tls_sk = -1;
|
||||
static int tls_sk_flags = 0;
|
||||
|
||||
-void tls_terminate_session(void)
|
||||
+void tls_terminate_session(bool async)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@@ -44,7 +44,7 @@ void tls_terminate_session(void)
|
||||
* Initiate a connection shutdown but don't
|
||||
* wait for peer to close connection.
|
||||
*/
|
||||
- ret = gnutls_bye(session, GNUTLS_SHUT_WR);
|
||||
+ ret = gnutls_bye(session, async ? GNUTLS_SHUT_WR : GNUTLS_SHUT_RDWR);
|
||||
} while (ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED);
|
||||
/* Free the session object */
|
||||
gnutls_deinit(session);
|
||||
@@ -399,6 +399,6 @@ int tls_x509_init(int sockfd, bool is_server)
|
||||
|
||||
return 0;
|
||||
err:
|
||||
- tls_terminate_session();
|
||||
+ tls_terminate_session(true);
|
||||
return -1;
|
||||
}
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,66 +0,0 @@
|
||||
From 613839c7f2bd851abe9414849320ec2a4241eeb4 Mon Sep 17 00:00:00 2001
|
||||
From: Andrei Vagin <avagin@gmail.com>
|
||||
Date: Wed, 22 Dec 2021 09:59:11 -0800
|
||||
Subject: [PATCH 090/249] page-xfer: stop waiting for a new command after a
|
||||
close command
|
||||
|
||||
There is no reason to do that and in case of tls, __recv returns EAGAIN
|
||||
instead of 0.
|
||||
|
||||
Signed-off-by: Andrei Vagin <avagin@gmail.com>
|
||||
---
|
||||
criu/page-xfer.c | 16 +++++++++-------
|
||||
1 file changed, 9 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/criu/page-xfer.c b/criu/page-xfer.c
|
||||
index 7ff07680f..60c793009 100644
|
||||
--- a/criu/page-xfer.c
|
||||
+++ b/criu/page-xfer.c
|
||||
@@ -50,8 +50,8 @@ static void psi2iovec(struct page_server_iov *ps, struct iovec *iov)
|
||||
#define PS_IOV_ADD_F 6
|
||||
#define PS_IOV_GET 7
|
||||
|
||||
-#define PS_IOV_FLUSH 0x1023
|
||||
-#define PS_IOV_FLUSH_N_CLOSE 0x1024
|
||||
+#define PS_IOV_CLOSE 0x1023
|
||||
+#define PS_IOV_FORCE_CLOSE 0x1024
|
||||
|
||||
#define PS_CMD_BITS 16
|
||||
#define PS_CMD_MASK ((1 << PS_CMD_BITS) - 1)
|
||||
@@ -1223,8 +1223,8 @@ static int page_server_serve(int sk)
|
||||
ret = page_server_add(sk, &pi, flags);
|
||||
break;
|
||||
}
|
||||
- case PS_IOV_FLUSH:
|
||||
- case PS_IOV_FLUSH_N_CLOSE: {
|
||||
+ case PS_IOV_CLOSE:
|
||||
+ case PS_IOV_FORCE_CLOSE: {
|
||||
int32_t status = 0;
|
||||
|
||||
ret = 0;
|
||||
@@ -1250,7 +1250,9 @@ static int page_server_serve(int sk)
|
||||
break;
|
||||
}
|
||||
|
||||
- if (ret || (pi.cmd == PS_IOV_FLUSH_N_CLOSE))
|
||||
+ if (ret)
|
||||
+ break;
|
||||
+ if (pi.cmd == PS_IOV_CLOSE || pi.cmd == PS_IOV_FORCE_CLOSE)
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1491,9 +1493,9 @@ int disconnect_from_page_server(void)
|
||||
* the parent process) so we must order the
|
||||
* page-server to terminate itself.
|
||||
*/
|
||||
- pi.cmd = PS_IOV_FLUSH_N_CLOSE;
|
||||
+ pi.cmd = PS_IOV_FORCE_CLOSE;
|
||||
else
|
||||
- pi.cmd = PS_IOV_FLUSH;
|
||||
+ pi.cmd = PS_IOV_CLOSE;
|
||||
|
||||
if (send_psi(page_server_sk, &pi))
|
||||
goto out;
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,30 +0,0 @@
|
||||
From 9f50a9fb2a88db3d2853f514cddda84c3ff0d683 Mon Sep 17 00:00:00 2001
|
||||
From: Andrei Vagin <avagin@gmail.com>
|
||||
Date: Wed, 22 Dec 2021 17:03:04 -0800
|
||||
Subject: [PATCH 091/249] ci: reenable the lazy-thp test in the lazy-remote
|
||||
mode
|
||||
|
||||
Signed-off-by: Andrei Vagin <avagin@gmail.com>
|
||||
---
|
||||
scripts/ci/run-ci-tests.sh | 4 +---
|
||||
1 file changed, 1 insertion(+), 3 deletions(-)
|
||||
|
||||
diff --git a/scripts/ci/run-ci-tests.sh b/scripts/ci/run-ci-tests.sh
|
||||
index bf7331142..7eab9f2dc 100755
|
||||
--- a/scripts/ci/run-ci-tests.sh
|
||||
+++ b/scripts/ci/run-ci-tests.sh
|
||||
@@ -212,10 +212,8 @@ LAZY_OPTS="-p 2 -T $LAZY_TESTS $LAZY_EXCLUDE $ZDTM_OPTS"
|
||||
./test/zdtm.py run $LAZY_OPTS --lazy-pages
|
||||
# shellcheck disable=SC2086
|
||||
./test/zdtm.py run $LAZY_OPTS --remote-lazy-pages
|
||||
-# FIXME: post-copy migration of THP over TLS (sometimes) fails with:
|
||||
-# Error (criu/tls.c:321): tls: Pull callback recv failed: Connection reset by peer
|
||||
# shellcheck disable=SC2086
|
||||
-./test/zdtm.py run $LAZY_OPTS --remote-lazy-pages --tls -x lazy-thp
|
||||
+./test/zdtm.py run $LAZY_OPTS --remote-lazy-pages --tls
|
||||
|
||||
bash -x ./test/jenkins/criu-fault.sh
|
||||
if [ "$UNAME_M" == "x86_64" ]; then
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,38 +0,0 @@
|
||||
From 18fa29e4cb67ffc395930c829809cb36921dac35 Mon Sep 17 00:00:00 2001
|
||||
From: Andrei Vagin <avagin@gmail.com>
|
||||
Date: Wed, 22 Dec 2021 17:06:21 -0800
|
||||
Subject: [PATCH 092/249] test: log testname.out.inprogress if a test has
|
||||
failed
|
||||
|
||||
This is required if the test failed by timeout.
|
||||
|
||||
Signed-off-by: Andrei Vagin <avagin@gmail.com>
|
||||
---
|
||||
test/zdtm.py | 11 ++++++-----
|
||||
1 file changed, 6 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/test/zdtm.py b/test/zdtm.py
|
||||
index 086ae0285..c0e24a41a 100755
|
||||
--- a/test/zdtm.py
|
||||
+++ b/test/zdtm.py
|
||||
@@ -589,11 +589,12 @@ class zdtm_test:
|
||||
os.unlink(self.__pidfile())
|
||||
|
||||
def print_output(self):
|
||||
- if os.access(self.__name + '.out', os.R_OK):
|
||||
- print("Test output: " + "=" * 32)
|
||||
- with open(self.__name + '.out') as output:
|
||||
- print(output.read())
|
||||
- print(" <<< " + "=" * 32)
|
||||
+ for postfix in ['.out', '.out.inprogress']:
|
||||
+ if os.access(self.__name + postfix, os.R_OK):
|
||||
+ print("Test output: " + "=" * 32)
|
||||
+ with open(self.__name + postfix) as output:
|
||||
+ print(output.read())
|
||||
+ print(" <<< " + "=" * 32)
|
||||
|
||||
def static(self):
|
||||
return self.__name.split('/')[1] == 'static'
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,38 +0,0 @@
|
||||
From 6618fa96f8af67826b69bb49cb446579ce860693 Mon Sep 17 00:00:00 2001
|
||||
From: Andrei Vagin <avagin@gmail.com>
|
||||
Date: Wed, 22 Dec 2021 17:08:16 -0800
|
||||
Subject: [PATCH 093/249] zdtm: print tails of all logs if a test has failed
|
||||
|
||||
Signed-off-by: Andrei Vagin <avagin@gmail.com>
|
||||
---
|
||||
test/zdtm.py | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/test/zdtm.py b/test/zdtm.py
|
||||
index c0e24a41a..14e6aa1b0 100755
|
||||
--- a/test/zdtm.py
|
||||
+++ b/test/zdtm.py
|
||||
@@ -1475,17 +1475,17 @@ class criu:
|
||||
self.__lazy_pages_p.terminate()
|
||||
print("criu lazy-pages exited with %s" %
|
||||
self.__lazy_pages_p.wait())
|
||||
- grep_errors(os.path.join(self.__ddir(), "lazy-pages.log"))
|
||||
+ grep_errors(os.path.join(self.__ddir(), "lazy-pages.log"), err=True)
|
||||
self.__lazy_pages_p = None
|
||||
if self.__page_server_p:
|
||||
self.__page_server_p.terminate()
|
||||
print("criu page-server exited with %s" %
|
||||
self.__page_server_p.wait())
|
||||
- grep_errors(os.path.join(self.__ddir(), "page-server.log"))
|
||||
+ grep_errors(os.path.join(self.__ddir(), "page-server.log"), err=True)
|
||||
self.__page_server_p = None
|
||||
if self.__dump_process:
|
||||
self.__dump_process.terminate()
|
||||
- print("criu dump exited with %s" % self.__dump_process.wait())
|
||||
+ print("criu dump exited with %s" % self.__dump_process.wait(), err=True)
|
||||
grep_errors(os.path.join(self.__ddir(), "dump.log"))
|
||||
self.__dump_process = None
|
||||
if self.__img_streamer_process:
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,53 +0,0 @@
|
||||
From 9ca813c3237c4c3d5e0e09ed2358f5f1a1d43c1d Mon Sep 17 00:00:00 2001
|
||||
From: Andrei Vagin <avagin@gmail.com>
|
||||
Date: Wed, 22 Dec 2021 17:08:42 -0800
|
||||
Subject: [PATCH 094/249] zdtm/static/uffd-events: add more log messages
|
||||
|
||||
Signed-off-by: Andrei Vagin <avagin@gmail.com>
|
||||
---
|
||||
test/zdtm/static/uffd-events.c | 12 +++++++-----
|
||||
1 file changed, 7 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/test/zdtm/static/uffd-events.c b/test/zdtm/static/uffd-events.c
|
||||
index c811bcf4c..edd6c09ca 100644
|
||||
--- a/test/zdtm/static/uffd-events.c
|
||||
+++ b/test/zdtm/static/uffd-events.c
|
||||
@@ -153,28 +153,30 @@ int main(int argc, char **argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
+ test_msg("For a child process\n");
|
||||
pid = fork();
|
||||
if (pid < 0) {
|
||||
fail("Can't fork");
|
||||
return 1;
|
||||
}
|
||||
|
||||
- /* check madvise(MADV_DONTNEED) */
|
||||
+ test_msg("Check madvise(MADV_DONTNEED)\n");
|
||||
if (check_madv_dn(1))
|
||||
return 1;
|
||||
|
||||
- /* check growing mremap */
|
||||
+ test_msg("Check growing mremap\n");
|
||||
if (check_mremap_grow(2))
|
||||
return 1;
|
||||
|
||||
- /* check swapped mappings */
|
||||
+ test_msg("Check swapped mappings\n");
|
||||
if (check_swapped_mappings(3))
|
||||
return 1;
|
||||
|
||||
if (pid) {
|
||||
- int status;
|
||||
+ int status = -1;
|
||||
|
||||
- waitpid(-1, &status, 0);
|
||||
+ test_msg("Wait for the child %d\n", pid);
|
||||
+ waitpid(pid, &status, 0);
|
||||
if (status) {
|
||||
fail("child failed");
|
||||
return status;
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,120 +0,0 @@
|
||||
From e88e3a0cf79d6625ed4f5e4ffd07a3ee6405fda4 Mon Sep 17 00:00:00 2001
|
||||
From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
|
||||
Date: Fri, 17 Dec 2021 14:58:47 +0300
|
||||
Subject: [PATCH 095/249] mount: split check_mountpoint_fd from
|
||||
__open_mountpoint
|
||||
|
||||
Now we can reuse "check" part separately in other places.
|
||||
|
||||
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
|
||||
---
|
||||
criu/include/mount.h | 1 +
|
||||
criu/mount.c | 60 ++++++++++++++++++++++++--------------------
|
||||
2 files changed, 34 insertions(+), 27 deletions(-)
|
||||
|
||||
diff --git a/criu/include/mount.h b/criu/include/mount.h
|
||||
index 7705279e4..23448d5fc 100644
|
||||
--- a/criu/include/mount.h
|
||||
+++ b/criu/include/mount.h
|
||||
@@ -109,6 +109,7 @@ extern int mntns_get_root_by_mnt_id(int mnt_id);
|
||||
extern struct ns_id *lookup_nsid_by_mnt_id(int mnt_id);
|
||||
|
||||
extern int open_mount(unsigned int s_dev);
|
||||
+extern int check_mountpoint_fd(struct mount_info *pm, int mnt_fd);
|
||||
extern int __open_mountpoint(struct mount_info *pm, int mnt_fd);
|
||||
extern int mnt_is_dir(struct mount_info *pm);
|
||||
extern int open_mountpoint(struct mount_info *pm);
|
||||
diff --git a/criu/mount.c b/criu/mount.c
|
||||
index d75ca5598..f6347fd9d 100644
|
||||
--- a/criu/mount.c
|
||||
+++ b/criu/mount.c
|
||||
@@ -1018,39 +1018,20 @@ int mnt_is_dir(struct mount_info *pm)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-/*
|
||||
- * mnt_fd is a file descriptor on the mountpoint, which is closed in an error case.
|
||||
- * If mnt_fd is -1, the mountpoint will be opened by this function.
|
||||
- */
|
||||
-int __open_mountpoint(struct mount_info *pm, int mnt_fd)
|
||||
+int check_mountpoint_fd(struct mount_info *pm, int mnt_fd)
|
||||
{
|
||||
struct stat st;
|
||||
- int dev;
|
||||
- int ret;
|
||||
-
|
||||
- if (mnt_fd == -1) {
|
||||
- int mntns_root;
|
||||
-
|
||||
- mntns_root = mntns_get_root_fd(pm->nsid);
|
||||
- if (mntns_root < 0)
|
||||
- return -1;
|
||||
-
|
||||
- mnt_fd = openat(mntns_root, pm->ns_mountpoint, O_RDONLY);
|
||||
- if (mnt_fd < 0) {
|
||||
- pr_perror("Can't open %s", pm->ns_mountpoint);
|
||||
- return -1;
|
||||
- }
|
||||
- }
|
||||
+ int ret, dev;
|
||||
|
||||
ret = fstat(mnt_fd, &st);
|
||||
if (ret < 0) {
|
||||
pr_perror("fstat(%s) failed", pm->ns_mountpoint);
|
||||
- goto err;
|
||||
+ return -1;
|
||||
}
|
||||
|
||||
if (pm->s_dev_rt == MOUNT_INVALID_DEV) {
|
||||
pr_err("Resolving over invalid device for %#x %s %s\n", pm->s_dev, pm->fstype->name, pm->ns_mountpoint);
|
||||
- goto err;
|
||||
+ return -1;
|
||||
}
|
||||
|
||||
dev = MKKDEV(major(st.st_dev), minor(st.st_dev));
|
||||
@@ -1063,13 +1044,38 @@ int __open_mountpoint(struct mount_info *pm, int mnt_fd)
|
||||
if (dev != pm->s_dev_rt) {
|
||||
pr_err("The file system %#x %#x (%#x) %s %s is inaccessible\n", pm->s_dev, pm->s_dev_rt, dev,
|
||||
pm->fstype->name, pm->ns_mountpoint);
|
||||
- goto err;
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * mnt_fd is a file descriptor on the mountpoint, which is closed in an error case.
|
||||
+ * If mnt_fd is -1, the mountpoint will be opened by this function.
|
||||
+ */
|
||||
+int __open_mountpoint(struct mount_info *pm, int mnt_fd)
|
||||
+{
|
||||
+ if (mnt_fd == -1) {
|
||||
+ int mntns_root;
|
||||
+
|
||||
+ mntns_root = mntns_get_root_fd(pm->nsid);
|
||||
+ if (mntns_root < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ mnt_fd = openat(mntns_root, pm->ns_mountpoint, O_RDONLY);
|
||||
+ if (mnt_fd < 0) {
|
||||
+ pr_perror("Can't open %s", pm->ns_mountpoint);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (check_mountpoint_fd(pm, mnt_fd)) {
|
||||
+ close(mnt_fd);
|
||||
+ return -1;
|
||||
}
|
||||
|
||||
return mnt_fd;
|
||||
-err:
|
||||
- close(mnt_fd);
|
||||
- return -1;
|
||||
}
|
||||
|
||||
int open_mount(unsigned int s_dev)
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,116 +0,0 @@
|
||||
From 5258c8a15e46c2bf6614c6bd3cfb79463e640abe Mon Sep 17 00:00:00 2001
|
||||
From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
|
||||
Date: Fri, 17 Dec 2021 15:13:35 +0300
|
||||
Subject: [PATCH 096/249] mount: remove mnt_fd argument of __open_mountpoint
|
||||
|
||||
Only place where we used __open_mountpoint with non -1 mnt_fd is
|
||||
open_mountpoint. Let's use check_mountpoint_fd for this case, so that we
|
||||
now can remove mnt_id argument. Also now __open_mountpoint actually
|
||||
always does open.
|
||||
|
||||
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
|
||||
---
|
||||
criu/fsnotify.c | 4 ++--
|
||||
criu/include/mount.h | 2 +-
|
||||
criu/mount.c | 26 ++++++++++++--------------
|
||||
3 files changed, 15 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/criu/fsnotify.c b/criu/fsnotify.c
|
||||
index b5dd15dd8..22fb74973 100644
|
||||
--- a/criu/fsnotify.c
|
||||
+++ b/criu/fsnotify.c
|
||||
@@ -132,7 +132,7 @@ static char *alloc_openable(unsigned int s_dev, unsigned long i_ino, FhEntry *f_
|
||||
if (!mnt_is_dir(m))
|
||||
continue;
|
||||
|
||||
- mntfd = __open_mountpoint(m, -1);
|
||||
+ mntfd = __open_mountpoint(m);
|
||||
pr_debug("\t\tTrying via mntid %d root %s ns_mountpoint @%s (%d)\n", m->mnt_id, m->root,
|
||||
m->ns_mountpoint, mntfd);
|
||||
if (mntfd < 0)
|
||||
@@ -206,7 +206,7 @@ static int open_handle(unsigned int s_dev, unsigned long i_ino, FhEntry *f_handl
|
||||
if (m->s_dev != s_dev || !mnt_is_dir(m))
|
||||
continue;
|
||||
|
||||
- mntfd = __open_mountpoint(m, -1);
|
||||
+ mntfd = __open_mountpoint(m);
|
||||
if (mntfd < 0) {
|
||||
pr_warn("Can't open mount for s_dev %x, continue\n", s_dev);
|
||||
continue;
|
||||
diff --git a/criu/include/mount.h b/criu/include/mount.h
|
||||
index 23448d5fc..3f3a67afa 100644
|
||||
--- a/criu/include/mount.h
|
||||
+++ b/criu/include/mount.h
|
||||
@@ -110,7 +110,7 @@ extern struct ns_id *lookup_nsid_by_mnt_id(int mnt_id);
|
||||
|
||||
extern int open_mount(unsigned int s_dev);
|
||||
extern int check_mountpoint_fd(struct mount_info *pm, int mnt_fd);
|
||||
-extern int __open_mountpoint(struct mount_info *pm, int mnt_fd);
|
||||
+extern int __open_mountpoint(struct mount_info *pm);
|
||||
extern int mnt_is_dir(struct mount_info *pm);
|
||||
extern int open_mountpoint(struct mount_info *pm);
|
||||
|
||||
diff --git a/criu/mount.c b/criu/mount.c
|
||||
index f6347fd9d..ab6d3ed10 100644
|
||||
--- a/criu/mount.c
|
||||
+++ b/criu/mount.c
|
||||
@@ -1054,20 +1054,18 @@ int check_mountpoint_fd(struct mount_info *pm, int mnt_fd)
|
||||
* mnt_fd is a file descriptor on the mountpoint, which is closed in an error case.
|
||||
* If mnt_fd is -1, the mountpoint will be opened by this function.
|
||||
*/
|
||||
-int __open_mountpoint(struct mount_info *pm, int mnt_fd)
|
||||
+int __open_mountpoint(struct mount_info *pm)
|
||||
{
|
||||
- if (mnt_fd == -1) {
|
||||
- int mntns_root;
|
||||
+ int mntns_root, mnt_fd;
|
||||
|
||||
- mntns_root = mntns_get_root_fd(pm->nsid);
|
||||
- if (mntns_root < 0)
|
||||
- return -1;
|
||||
+ mntns_root = mntns_get_root_fd(pm->nsid);
|
||||
+ if (mntns_root < 0)
|
||||
+ return -1;
|
||||
|
||||
- mnt_fd = openat(mntns_root, pm->ns_mountpoint, O_RDONLY);
|
||||
- if (mnt_fd < 0) {
|
||||
- pr_perror("Can't open %s", pm->ns_mountpoint);
|
||||
- return -1;
|
||||
- }
|
||||
+ mnt_fd = openat(mntns_root, pm->ns_mountpoint, O_RDONLY);
|
||||
+ if (mnt_fd < 0) {
|
||||
+ pr_perror("Can't open %s", pm->ns_mountpoint);
|
||||
+ return -1;
|
||||
}
|
||||
|
||||
if (check_mountpoint_fd(pm, mnt_fd)) {
|
||||
@@ -1086,7 +1084,7 @@ int open_mount(unsigned int s_dev)
|
||||
if (!m)
|
||||
return -ENOENT;
|
||||
|
||||
- return __open_mountpoint(m, -1);
|
||||
+ return __open_mountpoint(m);
|
||||
}
|
||||
|
||||
/* Bind-mount a mount point in a temporary place without children */
|
||||
@@ -1350,7 +1348,7 @@ int open_mountpoint(struct mount_info *pm)
|
||||
|
||||
/* No overmounts and children - the entire mount is visible */
|
||||
if (list_empty(&pm->children) && !mnt_is_overmounted(pm))
|
||||
- return __open_mountpoint(pm, -1);
|
||||
+ return __open_mountpoint(pm);
|
||||
|
||||
pr_info("Mount is not fully visible %s\n", pm->mountpoint);
|
||||
|
||||
@@ -1413,7 +1411,7 @@ int open_mountpoint(struct mount_info *pm)
|
||||
goto err;
|
||||
}
|
||||
|
||||
- return __open_mountpoint(pm, fd);
|
||||
+ return fd < 0 ? __open_mountpoint(pm) : check_mountpoint_fd(pm, fd);
|
||||
err:
|
||||
if (ns_old >= 0)
|
||||
/* coverity[check_return] */
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,101 +0,0 @@
|
||||
From 8b981b4b416781f6d1803a45eb2fc806cf0a9bab Mon Sep 17 00:00:00 2001
|
||||
From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
|
||||
Date: Thu, 16 Dec 2021 16:14:41 +0300
|
||||
Subject: [PATCH 097/249] proc_parse: add helper to resolve sdev from fd
|
||||
|
||||
New get_sdev_from_fd helper first gets mnt_id from fd using fdinfo and
|
||||
then converts mnt_id to sdev using mountinfo.
|
||||
|
||||
By default mnt_id to sdev conversion only works for mounts in mntinfo.
|
||||
|
||||
If parse_mountinfo argument is true, will also parse current process
|
||||
mountinfo when looking for mount sdev, this should be used only with
|
||||
temporary mounts just created by criu in current mntns.
|
||||
|
||||
v3: add argument to parse self mountinfo for auxiliary mounts
|
||||
|
||||
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
|
||||
---
|
||||
criu/include/mount.h | 1 +
|
||||
criu/proc_parse.c | 53 ++++++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 54 insertions(+)
|
||||
|
||||
diff --git a/criu/include/mount.h b/criu/include/mount.h
|
||||
index 3f3a67afa..9c0d7c010 100644
|
||||
--- a/criu/include/mount.h
|
||||
+++ b/criu/include/mount.h
|
||||
@@ -140,6 +140,7 @@ extern void clean_cr_time_mounts(void);
|
||||
|
||||
extern bool add_skip_mount(const char *mountpoint);
|
||||
struct ns_id;
|
||||
+extern int get_sdev_from_fd(int fd, unsigned int *sdev, bool parse_mountinfo);
|
||||
extern struct mount_info *parse_mountinfo(pid_t pid, struct ns_id *nsid, bool for_dump);
|
||||
|
||||
extern int check_mnt_id(void);
|
||||
diff --git a/criu/proc_parse.c b/criu/proc_parse.c
|
||||
index c734fc24a..eb3efc877 100644
|
||||
--- a/criu/proc_parse.c
|
||||
+++ b/criu/proc_parse.c
|
||||
@@ -1492,6 +1492,59 @@ out:
|
||||
return exit_code;
|
||||
}
|
||||
|
||||
+static int get_mountinfo_sdev_from_mntid(int mnt_id, unsigned int *sdev)
|
||||
+{
|
||||
+ int exit_code = -1;
|
||||
+ FILE *f;
|
||||
+
|
||||
+ f = fopen_proc(PROC_SELF, "mountinfo");
|
||||
+ if (!f)
|
||||
+ return -1;
|
||||
+
|
||||
+ while (fgets(buf, BUF_SIZE, f)) {
|
||||
+ unsigned int kmaj, kmin;
|
||||
+ int id;
|
||||
+
|
||||
+ if (sscanf(buf, "%i %*i %u:%u", &id, &kmaj, &kmin) != 3) {
|
||||
+ pr_err("Failed to parse mountinfo line %s\n", buf);
|
||||
+ goto err;
|
||||
+ }
|
||||
+
|
||||
+ if (id == mnt_id) {
|
||||
+ *sdev = MKKDEV(kmaj, kmin);
|
||||
+ exit_code = 0;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+err:
|
||||
+ fclose(f);
|
||||
+ return exit_code;
|
||||
+}
|
||||
+
|
||||
+/* This works even on btrfs where stat does not show right sdev */
|
||||
+int get_sdev_from_fd(int fd, unsigned int *sdev, bool parse_mountinfo)
|
||||
+{
|
||||
+ struct mount_info *mi;
|
||||
+ int ret, mnt_id;
|
||||
+
|
||||
+ ret = get_fd_mntid(fd, &mnt_id);
|
||||
+ if (ret < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ /* Simple case mnt_id is in dumped mntns */
|
||||
+ mi = lookup_mnt_id(mnt_id);
|
||||
+ if (mi) {
|
||||
+ *sdev = mi->s_dev_rt;
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if (!parse_mountinfo)
|
||||
+ return -1;
|
||||
+
|
||||
+ /* Complex case mnt_id is in mntns created by criu */
|
||||
+ return get_mountinfo_sdev_from_mntid(mnt_id, sdev);
|
||||
+}
|
||||
+
|
||||
struct mount_info *parse_mountinfo(pid_t pid, struct ns_id *nsid, bool for_dump)
|
||||
{
|
||||
struct mount_info *list = NULL;
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,140 +0,0 @@
|
||||
From 1b1dc9023d1d169b75d19cc6770407b40589ee13 Mon Sep 17 00:00:00 2001
|
||||
From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
|
||||
Date: Thu, 16 Dec 2021 12:57:23 +0300
|
||||
Subject: [PATCH 098/249] mount/btrfs: make check_mountpoint_fd fallback to
|
||||
get_sdev_from_fd
|
||||
|
||||
We face that btrfs returns anonymous device in stat instead of real
|
||||
superblock dev for volumes, thus all btrfs volume mounts does not pass
|
||||
check_mountpoint_fd due to dev missmatch between stat and mountinfo. We
|
||||
can use special helper get_sdev_from_fd instead of stat to try to get
|
||||
real dev of fd for btrfs.
|
||||
|
||||
We move check_mountpoint_fd from open_mountpoint into get_clean_fd and
|
||||
ns_open_mountpoint to the point where temporary mount we open fd to is
|
||||
still in mountinfo, thus get_sdev_from_fd would be able to find tmp
|
||||
mount in mountinfo.
|
||||
|
||||
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
|
||||
---
|
||||
criu/include/mount.h | 1 +
|
||||
criu/mount.c | 49 ++++++++++++++++++++++++++++++++++++++++----
|
||||
2 files changed, 46 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/criu/include/mount.h b/criu/include/mount.h
|
||||
index 9c0d7c010..b959d131c 100644
|
||||
--- a/criu/include/mount.h
|
||||
+++ b/criu/include/mount.h
|
||||
@@ -109,6 +109,7 @@ extern int mntns_get_root_by_mnt_id(int mnt_id);
|
||||
extern struct ns_id *lookup_nsid_by_mnt_id(int mnt_id);
|
||||
|
||||
extern int open_mount(unsigned int s_dev);
|
||||
+extern int __check_mountpoint_fd(struct mount_info *pm, int mnt_fd, bool parse_mountinfo);
|
||||
extern int check_mountpoint_fd(struct mount_info *pm, int mnt_fd);
|
||||
extern int __open_mountpoint(struct mount_info *pm);
|
||||
extern int mnt_is_dir(struct mount_info *pm);
|
||||
diff --git a/criu/mount.c b/criu/mount.c
|
||||
index ab6d3ed10..4b57ac703 100644
|
||||
--- a/criu/mount.c
|
||||
+++ b/criu/mount.c
|
||||
@@ -1018,10 +1018,11 @@ int mnt_is_dir(struct mount_info *pm)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-int check_mountpoint_fd(struct mount_info *pm, int mnt_fd)
|
||||
+int __check_mountpoint_fd(struct mount_info *pm, int mnt_fd, bool parse_mountinfo)
|
||||
{
|
||||
struct stat st;
|
||||
- int ret, dev;
|
||||
+ unsigned int dev;
|
||||
+ int ret;
|
||||
|
||||
ret = fstat(mnt_fd, &st);
|
||||
if (ret < 0) {
|
||||
@@ -1042,6 +1043,14 @@ int check_mountpoint_fd(struct mount_info *pm, int mnt_fd)
|
||||
* allocates new device ID).
|
||||
*/
|
||||
if (dev != pm->s_dev_rt) {
|
||||
+ /*
|
||||
+ * For btrfs device numbers in stat and mountinfo can be
|
||||
+ * different, fallback to get_sdev_from_fd to get right dev.
|
||||
+ */
|
||||
+ if (!strcmp(pm->fstype->name, "btrfs") && !get_sdev_from_fd(mnt_fd, &dev, parse_mountinfo) &&
|
||||
+ dev == pm->s_dev_rt)
|
||||
+ return 0;
|
||||
+
|
||||
pr_err("The file system %#x %#x (%#x) %s %s is inaccessible\n", pm->s_dev, pm->s_dev_rt, dev,
|
||||
pm->fstype->name, pm->ns_mountpoint);
|
||||
return -1;
|
||||
@@ -1050,6 +1059,11 @@ int check_mountpoint_fd(struct mount_info *pm, int mnt_fd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+int check_mountpoint_fd(struct mount_info *pm, int mnt_fd)
|
||||
+{
|
||||
+ return __check_mountpoint_fd(pm, mnt_fd, false);
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* mnt_fd is a file descriptor on the mountpoint, which is closed in an error case.
|
||||
* If mnt_fd is -1, the mountpoint will be opened by this function.
|
||||
@@ -1114,12 +1128,34 @@ static int get_clean_fd(struct mount_info *mi)
|
||||
char *mnt_path = NULL;
|
||||
char mnt_path_tmp[] = "/tmp/cr-tmpfs.XXXXXX";
|
||||
char mnt_path_root[] = "/cr-tmpfs.XXXXXX";
|
||||
+ int fd;
|
||||
|
||||
mnt_path = get_clean_mnt(mi, mnt_path_tmp, mnt_path_root);
|
||||
if (!mnt_path)
|
||||
return -1;
|
||||
|
||||
- return open_detach_mount(mnt_path);
|
||||
+ fd = open(mnt_path, O_RDONLY | O_DIRECTORY, 0);
|
||||
+ if (fd < 0) {
|
||||
+ pr_perror("Can't open directory %s", mnt_path);
|
||||
+ } else {
|
||||
+ if (__check_mountpoint_fd(mi, fd, true))
|
||||
+ goto err_close;
|
||||
+ }
|
||||
+
|
||||
+ if (umount2(mnt_path, MNT_DETACH)) {
|
||||
+ pr_perror("Can't detach mount %s", mnt_path);
|
||||
+ goto err_close;
|
||||
+ }
|
||||
+
|
||||
+ if (rmdir(mnt_path)) {
|
||||
+ pr_perror("Can't remove tmp dir %s", mnt_path);
|
||||
+ goto err_close;
|
||||
+ }
|
||||
+
|
||||
+ return fd;
|
||||
+err_close:
|
||||
+ close_safe(&fd);
|
||||
+ return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1337,6 +1373,11 @@ int ns_open_mountpoint(void *arg)
|
||||
goto err;
|
||||
}
|
||||
|
||||
+ if (__check_mountpoint_fd(mi, *fd, true)) {
|
||||
+ close(*fd);
|
||||
+ goto err;
|
||||
+ }
|
||||
+
|
||||
return 0;
|
||||
err:
|
||||
return 1;
|
||||
@@ -1411,7 +1452,7 @@ int open_mountpoint(struct mount_info *pm)
|
||||
goto err;
|
||||
}
|
||||
|
||||
- return fd < 0 ? __open_mountpoint(pm) : check_mountpoint_fd(pm, fd);
|
||||
+ return fd < 0 ? __open_mountpoint(pm) : fd;
|
||||
err:
|
||||
if (ns_old >= 0)
|
||||
/* coverity[check_return] */
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -1,33 +0,0 @@
|
||||
From d5b49695c55387f14748a8543aaba29c7aeacf0f Mon Sep 17 00:00:00 2001
|
||||
From: Nicolas Viennot <Nicolas.Viennot@twosigma.com>
|
||||
Date: Tue, 28 Dec 2021 19:30:09 +0000
|
||||
Subject: [PATCH 099/249] ci: test criu-image-streamer with all tests
|
||||
|
||||
All the bugs that were in the way got fixed. We can enable all tests.
|
||||
|
||||
Signed-off-by: Nicolas Viennot <Nicolas.Viennot@twosigma.com>
|
||||
---
|
||||
scripts/ci/run-ci-tests.sh | 6 ++----
|
||||
1 file changed, 2 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/scripts/ci/run-ci-tests.sh b/scripts/ci/run-ci-tests.sh
|
||||
index 7eab9f2dc..d0cd55f7c 100755
|
||||
--- a/scripts/ci/run-ci-tests.sh
|
||||
+++ b/scripts/ci/run-ci-tests.sh
|
||||
@@ -62,11 +62,9 @@ ci_prep () {
|
||||
}
|
||||
|
||||
test_stream() {
|
||||
- # We must test CRIU features that dump content into an image file to ensure
|
||||
- # streaming compatibility.
|
||||
- STREAM_TEST_PATTERN='.*(ghost|fifo|unlink|memfd|shmem|socket_queue).*'
|
||||
+ # Testing CRIU streaming to criu-image-streamer
|
||||
# shellcheck disable=SC2086
|
||||
- ./test/zdtm.py run --stream -p 2 --keep-going -T "$STREAM_TEST_PATTERN" $ZDTM_OPTS
|
||||
+ ./test/zdtm.py run --stream -p 2 --keep-going -a $ZDTM_OPTS
|
||||
}
|
||||
|
||||
print_header() {
|
||||
--
|
||||
2.35.1
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user