Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

posix: check glibc version for ::close_range function #378

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

T3RR7
Copy link

@T3RR7 T3RR7 commented Jun 18, 2024

On old systems with old glibc, but new kernel (the common case is build in CI on ancient OS with old glibc for extended compatibility) there may not be ::close_range() function. In this case build will fail.

To avoid that we should properly check not only linux kernel version, but glibc version too.

There is one another option to solve this issue is use raw system call with only checking kernel version, but it seems to me dirty solution.

@T3RR7
Copy link
Author

T3RR7 commented Jun 18, 2024

Moreover, I've just noticed that kernel version also checked wrong.
According to:

close_range() available from kernel 5.9, so right check might look like:

#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0)

@T3RR7
Copy link
Author

T3RR7 commented Jul 3, 2024

@klemens-morgenstern I've noticed that you pushed the fix to you devel branch, but you haven't provided option to fully disable close_range usage, as I understood.

In case we build on new kernel, BUT with old glibc (for extended compatibility) the whole program will break, because of ENOTSUP error (a.k.a Unsupported system call).

klemens-morgenstern added a commit that referenced this pull request Oct 24, 2024
@klemens-morgenstern
Copy link
Collaborator

klemens-morgenstern commented Oct 24, 2024

@T3RR7 does 41a4a5a work?

klemens-morgenstern added a commit that referenced this pull request Oct 24, 2024
klemens-morgenstern added a commit that referenced this pull request Oct 30, 2024
@klemens-morgenstern klemens-morgenstern force-pushed the develop branch 2 times, most recently from ac43b71 to 58586e4 Compare October 30, 2024 01:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants