-
Notifications
You must be signed in to change notification settings - Fork 242
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
[merged] Clear capability bounding set #149
Conversation
The capability bounding set is a limit on what capabilities can be regained at execve(). Due to PR_NO_NEW_PRIVS we should be safe from any such issues, but we may as well clear it anyway. Note, we also have to clear it in the new namespace if user namespaces are enabled, because the kernel gives us a new set of full bounds in the user namespace. See containers#136 for some discussion about this.
{ | ||
unsigned long cap; | ||
|
||
for (cap = 0; cap <= 63; cap++) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where did this 63 value come from? A quick glance at the systemd source (again my first go-to reference) is they have a cap_last_cap()
function which does all sorts of gymnastics. But on the other hand it wouldn't be that bad to copy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The syscall api used to set capabilities currently allow a maximum of 64 capabilities (its got 2 32bit fields). There are not actually that many, but we just ignore EINVAL for the "too large" ones.
Eventually the kernel could have some new syscall to get more caps, but I doubt that will happen.
☀️ Test successful - status-redhatci |
We recently upgraded bubblewrap to 1.7 on Endless and observed this error now whenever we try to run any flatpak on our ARM product:
Reading through However, another question I have about is whether it would make sense to call Comments? |
Can you file a new issue for this? |
Sure, thanks |
The capability bounding set is a limit on what capabilities can
be regained at execve(). Due to PR_NO_NEW_PRIVS we should be safe
from any such issues, but we may as well clear it anyway.
Note, we also have to clear it in the new namespace if user namespaces
are enabled, because the kernel gives us a new set of full bounds in
the user namespace.
See #136 for some
discussion about this.