diff --git a/criu/cr-check.c b/criu/cr-check.c index eef45b93b..fda17cc53 100644 --- a/criu/cr-check.c +++ b/criu/cr-check.c @@ -1331,6 +1331,21 @@ static int check_net_diag_raw(void) socket_test_collect_bit(AF_INET6, IPPROTO_RAW)) ? 0 : -1; } +static int check_pidfd_store(void) +{ + if (!kdat.has_pidfd_open) { + pr_warn("Pidfd store requires pidfd_open syscall which is not supported\n"); + return -1; + } + + if (!kdat.has_pidfd_getfd) { + pr_warn("Pidfd store requires pidfd_getfd syscall which is not supported\n"); + return -1; + } + + return 0; +} + static int (*chk_feature)(void); /* @@ -1443,6 +1458,7 @@ int cr_check(void) ret |= check_clone3_set_tid(); ret |= check_time_namespace(); ret |= check_newifindex(); + ret |= check_pidfd_store(); } /* @@ -1551,6 +1567,7 @@ static struct feature_list feature_list[] = { { "newifindex", check_newifindex}, { "nftables", check_nftables_cr }, { "has_ipt_legacy", check_ipt_legacy }, + { "pidfd_store", check_pidfd_store }, { NULL, NULL }, }; diff --git a/criu/cr-service.c b/criu/cr-service.c index 983d60096..81ae5f745 100644 --- a/criu/cr-service.c +++ b/criu/cr-service.c @@ -1065,6 +1065,8 @@ static int handle_feature_check(int sk, CriuReq * msg) feat.mem_track = false; feat.has_lazy_pages = 1; feat.lazy_pages = false; + feat.has_pidfd_store = 1; + feat.pidfd_store = false; pid = fork(); if (pid < 0) { @@ -1086,6 +1088,10 @@ static int handle_feature_check(int sk, CriuReq * msg) (msg->features->lazy_pages == true)) feat.lazy_pages = kdat.has_uffd && uffd_noncooperative(); + if ((msg->features->has_pidfd_store == 1) && + (msg->features->pidfd_store == true)) + feat.pidfd_store = kdat.has_pidfd_getfd && kdat.has_pidfd_open; + resp.features = &feat; resp.type = msg->type; /* The feature check is working, actual results are in resp.features */ diff --git a/images/rpc.proto b/images/rpc.proto index e83f2c9f8..f667d136c 100644 --- a/images/rpc.proto +++ b/images/rpc.proto @@ -174,6 +174,7 @@ enum criu_req_type { message criu_features { optional bool mem_track = 1; optional bool lazy_pages = 2; + optional bool pidfd_store = 3; } /*