From 0c1f0256ff56e1816fa97f060f5c46bfa7c86a15 Mon Sep 17 00:00:00 2001 From: Alexander Mikhalitsyn Date: Thu, 5 May 2022 12:41:48 +0000 Subject: [PATCH] kerndat: handle the case when hugetlb isn't supported Currently we check memfd_hugetlb by doing memfd_create("", MFD_HUGETLB). If we see EINVAL we report that it's not supported, but we can also get ENOENT error in such case in hugetlb_file_setup() while trying to find proper hugetlbfs mount. Reference: https://github.com/torvalds/linux/blob/06fb4ecfeac/fs/hugetlbfs/inode.c#L1465 Fixes: 4245e6b02fa ("check: Add a check for using memfd with hugetlb") Reported-by: Mr. Jenkins (ppc64le) Signed-off-by: Alexander Mikhalitsyn --- criu/kerndat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/criu/kerndat.c b/criu/kerndat.c index 551e18bae..b8b6bc95d 100644 --- a/criu/kerndat.c +++ b/criu/kerndat.c @@ -502,7 +502,7 @@ static bool kerndat_has_memfd_hugetlb(void) if (ret >= 0) { kdat.has_memfd_hugetlb = true; close(ret); - } else if (ret == -1 && errno == EINVAL) { + } else if (ret == -1 && (errno == EINVAL || errno == ENOENT)) { kdat.has_memfd_hugetlb = false; } else { pr_perror("Unexpected error from memfd_create(\"\", MFD_HUGETLB)");