Your message dated Sat, 11 Jan 2025 11:03:08 +0000
with message-id <e1twzgm-009jxa...@coccia.debian.org>
and subject line Close 1087931
has caused the Debian Bug report #1087931,
regarding bookworm-pu: package criu/3.17.1-2+deb12u1
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)
--
1087931: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1087931
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Package: release.debian.org
Severity: normal
Tags: bookworm
X-Debbugs-Cc: c...@packages.debian.org, Aurelien Jarno <aure...@debian.org>,
car...@debian.org, f...@deneb.enyo.de
Control: affects -1 + src:criu
User: release.debian....@packages.debian.org
Usertags: pu
Hi Stable release managers,
[ Reason ]
In stable (via a non BTS mail initially) it got reported that after
the glibc/2.36-9+deb12u8 did not work properly and was not able to do
an actual rstore, verifiable as well with the "simple loop" case.
In fact upstream before commit cacddf19dad3 ("cr-restore: rseq:
dynamically handle *libc with rseq") had the assumption that criu is
compiled against the same GLibc as it runs with. There were some
rseq() related changes in that glibc update.
[ Impact ]
Users are actually not able to use criu sensibly and restore proceses
from a dump.
[ Tests ]
Done a manual test of the functionality with the simple loop case with
the updated criu package and restore a previous dumped process.
[ Risks ]
There is some risk, but if we do not accept this update then we are
better of to just remove criu in bookworm in the next point release.
Testing though went fine with the simple cases and I reached out to
the affected user to test the functionality. I aim to report that back
s well if I get a reply.
[ Checklist ]
[x] *all* changes are documented in the d/changelog
[x] I reviewed all changes and I approve them
[x] attach debdiff against the package in (old)stable
[x] the issue is verified as fixed in unstable
[ Changes ]
Quoting the upsream commit is likely the best to explain the changes:
| cr-restore: rseq: dynamically handle *libc with rseq
| Before this patch we assumed that CRIU is compiled against
| the same GLibc as it runs with. But as we see from real
| world examples like #1935 it's not always true.
|
| The idea of this patch is to detect rseq configuration
| for the main CRIU process and use it to unregister
| rseq for all further child processes. It's correct,
| because we restore pstree using clone*() syscalls,
| don't use exec*() (!) syscalls, so rseq gets inherited
| in the kernel and rseq configuration remains the same
| for all children processes.
Regards,
Salvatore
diff -Nru criu-3.17.1/debian/changelog criu-3.17.1/debian/changelog
--- criu-3.17.1/debian/changelog 2022-12-20 22:00:51.000000000 +0100
+++ criu-3.17.1/debian/changelog 2024-11-20 12:46:56.000000000 +0100
@@ -1,3 +1,10 @@
+criu (3.17.1-2+deb12u1) bookworm; urgency=medium
+
+ * cr-restore: rseq: dynamically handle *libc with rseq (Closes: #1081683)
+ * cr-restore: rseq: use glibc-specific way to unregister only as fallback
+
+ -- Salvatore Bonaccorso <car...@debian.org> Wed, 20 Nov 2024 12:46:56 +0100
+
criu (3.17.1-2) unstable; urgency=medium
* criu: fix conflicting headers (Closes: #1026534)
diff -Nru
criu-3.17.1/debian/patches/cr-restore-rseq-dynamically-handle-libc-with-rseq.patch
criu-3.17.1/debian/patches/cr-restore-rseq-dynamically-handle-libc-with-rseq.patch
---
criu-3.17.1/debian/patches/cr-restore-rseq-dynamically-handle-libc-with-rseq.patch
1970-01-01 01:00:00.000000000 +0100
+++
criu-3.17.1/debian/patches/cr-restore-rseq-dynamically-handle-libc-with-rseq.patch
2024-11-20 12:46:56.000000000 +0100
@@ -0,0 +1,151 @@
+From cacddf19dad339f963b0b01f7174091b90c49e5d Mon Sep 17 00:00:00 2001
+From: Alexander Mikhalitsyn <alexander.mikhalit...@virtuozzo.com>
+Date: Wed, 20 Jul 2022 14:36:28 +0300
+Subject: [PATCH] cr-restore: rseq: dynamically handle *libc with rseq
+
+Before this patch we assumed that CRIU is compiled against
+the same GLibc as it runs with. But as we see from real
+world examples like #1935 it's not always true.
+
+The idea of this patch is to detect rseq configuration
+for the main CRIU process and use it to unregister
+rseq for all further child processes. It's correct,
+because we restore pstree using clone*() syscalls,
+don't use exec*() (!) syscalls, so rseq gets inherited
+in the kernel and rseq configuration remains the same
+for all children processes.
+
+This will prevent issues like this:
+https://github.com/checkpoint-restore/criu/issues/1935
+
+Suggested-by: Florian Weimer <fwei...@redhat.com>
+Signed-off-by: Alexander Mikhalitsyn <alexander.mikhalit...@virtuozzo.com>
+---
+ criu/cr-restore.c | 16 ++++++++--------
+ criu/include/kerndat.h | 2 ++
+ criu/kerndat.c | 25 +++++++++++++++++++++++--
+ 3 files changed, 33 insertions(+), 10 deletions(-)
+
+diff --git a/criu/cr-restore.c b/criu/cr-restore.c
+index d11d28173a63..5b5b41dfc8bd 100644
+--- a/criu/cr-restore.c
++++ b/criu/cr-restore.c
+@@ -3103,14 +3103,14 @@ static void prep_libc_rseq_info(struct rst_rseq_param
*rseq)
+ #else
+ static void prep_libc_rseq_info(struct rst_rseq_param *rseq)
+ {
+- /*
+- * TODO: handle built-in rseq on other libc'ies like musl
+- * We can do that using get_rseq_conf kernel feature.
+- *
+- * For now we just assume that other libc libraries are
+- * not registering rseq by default.
+- */
+- rseq->rseq_abi_pointer = 0;
++ if (!kdat.has_rseq || !kdat.has_ptrace_get_rseq_conf) {
++ rseq->rseq_abi_pointer = 0;
++ return;
++ }
++
++ rseq->rseq_abi_pointer = kdat.libc_rseq_conf.rseq_abi_pointer;
++ rseq->rseq_abi_size = kdat.libc_rseq_conf.rseq_abi_size;
++ rseq->signature = kdat.libc_rseq_conf.signature;
+ }
+ #endif
+
+diff --git a/criu/include/kerndat.h b/criu/include/kerndat.h
+index 83d867e75bab..a3959c99260d 100644
+--- a/criu/include/kerndat.h
++++ b/criu/include/kerndat.h
+@@ -7,6 +7,7 @@
+ #include "asm/kerndat.h"
+ #include "util-vdso.h"
+ #include "hugetlb.h"
++#include <compel/ptrace.h>
+
+ struct stat;
+
+@@ -82,6 +83,7 @@ struct kerndat_s {
+ bool has_openat2;
+ bool has_rseq;
+ bool has_ptrace_get_rseq_conf;
++ struct __ptrace_rseq_configuration libc_rseq_conf;
+ };
+
+ extern struct kerndat_s kdat;
+diff --git a/criu/kerndat.c b/criu/kerndat.c
+index bc5dccab1804..0f7d5fc8fb1d 100644
+--- a/criu/kerndat.c
++++ b/criu/kerndat.c
+@@ -923,6 +923,7 @@ static int kerndat_has_ptrace_get_rseq_conf(void)
+ pid_t pid;
+ int len;
+ struct __ptrace_rseq_configuration rseq;
++ int ret = 0;
+
+ pid = fork_and_ptrace_attach(NULL);
+ if (pid < 0)
+@@ -930,6 +931,9 @@ static int kerndat_has_ptrace_get_rseq_conf(void)
+
+ len = ptrace(PTRACE_GET_RSEQ_CONFIGURATION, pid, sizeof(rseq), &rseq);
+ if (len != sizeof(rseq)) {
++ if (kdat.has_ptrace_get_rseq_conf)
++ ret = 1; /* we should update kdat */
++
+ kdat.has_ptrace_get_rseq_conf = false;
+ pr_info("ptrace(PTRACE_GET_RSEQ_CONFIGURATION) is not
supported\n");
+ goto out;
+@@ -940,16 +944,27 @@ static int kerndat_has_ptrace_get_rseq_conf(void)
+ * we need to pay attention to that and, possibly, make changes on the
CRIU side.
+ */
+ if (rseq.flags != 0) {
++ if (kdat.has_ptrace_get_rseq_conf)
++ ret = 1; /* we should update kdat */
++
+ kdat.has_ptrace_get_rseq_conf = false;
+ pr_err("ptrace(PTRACE_GET_RSEQ_CONFIGURATION): rseq.flags !=
0\n");
+ } else {
++ if (!kdat.has_ptrace_get_rseq_conf)
++ ret = 1; /* we should update kdat */
++
+ kdat.has_ptrace_get_rseq_conf = true;
++
++ if (memcmp(&kdat.libc_rseq_conf, &rseq, sizeof(rseq)))
++ ret = 1; /* we should update kdat */
++
++ kdat.libc_rseq_conf = rseq;
+ }
+
+ out:
+ kill(pid, SIGKILL);
+ waitpid(pid, NULL, 0);
+- return 0;
++ return ret;
+ }
+
+ int kerndat_sockopt_buf_lock(void)
+@@ -1472,6 +1487,12 @@ int kerndat_try_load_new(void)
+ if (ret < 0)
+ return ret;
+
++ ret = kerndat_has_ptrace_get_rseq_conf();
++ if (ret < 0) {
++ pr_err("kerndat_has_ptrace_get_rseq_conf failed when
initializing kerndat.\n");
++ return ret;
++ }
++
+ /* New information is found, we need to save to the cache */
+ if (ret)
+ kerndat_save_cache();
+@@ -1657,7 +1678,7 @@ int kerndat_init(void)
+ pr_err("kerndat_has_rseq failed when initializing kerndat.\n");
+ ret = -1;
+ }
+- if (!ret && kerndat_has_ptrace_get_rseq_conf()) {
++ if (!ret && (kerndat_has_ptrace_get_rseq_conf() < 0)) {
+ pr_err("kerndat_has_ptrace_get_rseq_conf failed when
initializing kerndat.\n");
+ ret = -1;
+ }
+--
+2.45.2
+
diff -Nru
criu-3.17.1/debian/patches/cr-restore-rseq-use-glibc-specific-way-to-unregister.patch
criu-3.17.1/debian/patches/cr-restore-rseq-use-glibc-specific-way-to-unregister.patch
---
criu-3.17.1/debian/patches/cr-restore-rseq-use-glibc-specific-way-to-unregister.patch
1970-01-01 01:00:00.000000000 +0100
+++
criu-3.17.1/debian/patches/cr-restore-rseq-use-glibc-specific-way-to-unregister.patch
2024-11-20 12:46:56.000000000 +0100
@@ -0,0 +1,61 @@
+From f7972a3f0468e32231af6914e2e9c9e07ac53ae6 Mon Sep 17 00:00:00 2001
+From: Alexander Mikhalitsyn <alexander.mikhalit...@virtuozzo.com>
+Date: Wed, 20 Jul 2022 15:17:35 +0300
+Subject: [PATCH] cr-restore: rseq: use glibc-specific way to unregister only
+ as fallback
+
+Let's use dynamic approach to detect built-in *libc rseq in all cases,
+and "old" static approach as a fallback path if the user kernel
+lacks support of ptrace_get_rseq_conf feature.
+
+Suggested-by: Florian Weimer <fwei...@redhat.com>
+Signed-off-by: Alexander Mikhalitsyn <alexander.mikhalit...@virtuozzo.com>
+---
+ criu/cr-restore.c | 15 ++++++---------
+ 1 file changed, 6 insertions(+), 9 deletions(-)
+
+diff --git a/criu/cr-restore.c b/criu/cr-restore.c
+index 5b5b41dfc8bd..919d10ab57b4 100644
+--- a/criu/cr-restore.c
++++ b/criu/cr-restore.c
+@@ -3088,7 +3088,6 @@ static int prep_rseq(struct rst_rseq_param *rseq,
ThreadCoreEntry *tc)
+ return 0;
+ }
+
+-#if defined(__GLIBC__) && defined(RSEQ_SIG)
+ static void prep_libc_rseq_info(struct rst_rseq_param *rseq)
+ {
+ if (!kdat.has_rseq) {
+@@ -3096,15 +3095,14 @@ static void prep_libc_rseq_info(struct rst_rseq_param
*rseq)
+ return;
+ }
+
+- rseq->rseq_abi_pointer = encode_pointer(__criu_thread_pointer() +
__rseq_offset);
+- rseq->rseq_abi_size = __rseq_size;
+- rseq->signature = RSEQ_SIG;
+-}
++ if (!kdat.has_ptrace_get_rseq_conf) {
++#if defined(__GLIBC__) && defined(RSEQ_SIG)
++ rseq->rseq_abi_pointer = encode_pointer(__criu_thread_pointer()
+ __rseq_offset);
++ rseq->rseq_abi_size = __rseq_size;
++ rseq->signature = RSEQ_SIG;
+ #else
+-static void prep_libc_rseq_info(struct rst_rseq_param *rseq)
+-{
+- if (!kdat.has_rseq || !kdat.has_ptrace_get_rseq_conf) {
+ rseq->rseq_abi_pointer = 0;
++#endif
+ return;
+ }
+
+@@ -3112,7 +3110,6 @@ static void prep_libc_rseq_info(struct rst_rseq_param
*rseq)
+ rseq->rseq_abi_size = kdat.libc_rseq_conf.rseq_abi_size;
+ rseq->signature = kdat.libc_rseq_conf.signature;
+ }
+-#endif
+
+ static rlim_t decode_rlim(rlim_t ival)
+ {
+--
+2.45.2
+
diff -Nru criu-3.17.1/debian/patches/series criu-3.17.1/debian/patches/series
--- criu-3.17.1/debian/patches/series 2022-12-20 22:00:51.000000000 +0100
+++ criu-3.17.1/debian/patches/series 2024-11-20 12:46:56.000000000 +0100
@@ -1,2 +1,4 @@
criu-fix-conflicting-headers.patch
mount-add-definition-for-FSOPEN_CLOEXEC.patch
+cr-restore-rseq-dynamically-handle-libc-with-rseq.patch
+cr-restore-rseq-use-glibc-specific-way-to-unregister.patch
--- End Message ---
--- Begin Message ---
Version: 12.9
This update has been released as part of 12.9. Thank you for your contribution.
--- End Message ---