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

Fix sbit removal if fchmodat() doesn't support AT_SYMLINK_NOFOLLOW #2759

Merged
merged 1 commit into from
Nov 10, 2023

Conversation

pmatilai
Copy link
Member

glibc versions prior to 2020 know about AT_SYMLINK_NOFOLLOW but don't actually implement it for fchmodat() and returns ENOSYS when used. We don't check the return code in removeSBITS() so this silently fails on those older versions.

We already verify the thing is not a link in the fstatat() condition because cap_set_fileat() doesn't have any "dont follow" mode at all, so we can just as well drop it from the fchmodat() and make this work on more libc versions.

Add a test for the suid bit removal while at it.

glibc versions prior to 2020 know about AT_SYMLINK_NOFOLLOW but don't
actually implement it for fchmodat() and returns ENOSYS when used.
We don't check the return code in removeSBITS() so this silently fails
on those older versions.

We already verify the thing is not a link in the fstatat() condition
because cap_set_fileat() doesn't have any "dont follow" mode at all,
so we can just as well drop it from the fchmodat() and make this
work on more libc versions.

Add a test for the suid bit removal while at it.
@pmatilai pmatilai added the bug label Nov 10, 2023
@pmatilai pmatilai merged commit 7d3d904 into rpm-software-management:master Nov 10, 2023
1 check passed
@pmatilai pmatilai deleted the sbits-pr branch November 10, 2023 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants