kerndat: Mark memfd_create(MFD_HUGETLB) unavailable when ENOSYS is returned

Some users on Raspberry Pi report that the kerndat checking for
memfd_create(MFD_HUGETLB) support returns ENOSYS even when memfd_create
syscall is available. We currently treat this error as unexpected and
return error. This commit marks the memfd_create(MFD_HUGETLB) as
unavailable when ENOSYS is returned.

Signed-off-by: Bui Quang Minh <minhquangbui99@gmail.com>
This commit is contained in:
Bui Quang Minh 2022-11-08 21:10:52 +07:00 committed by Andrei Vagin
parent 153614cb1d
commit c1ae880eb4

View file

@ -500,7 +500,7 @@ static bool kerndat_has_memfd_hugetlb(void)
if (ret >= 0) {
kdat.has_memfd_hugetlb = true;
close(ret);
} else if (ret == -1 && (errno == EINVAL || errno == ENOENT)) {
} else if (ret == -1 && (errno == EINVAL || errno == ENOENT || errno == ENOSYS)) {
kdat.has_memfd_hugetlb = false;
} else {
pr_perror("Unexpected error from memfd_create(\"\", MFD_HUGETLB)");