Bug 895105 - libcap-ng should handle cap_last_cap changes
Summary: libcap-ng should handle cap_last_cap changes
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: libcap-ng
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Steve Grubb
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1027032
TreeView+ depends on / blocked
 
Reported: 2013-01-14 15:16 UTC by Andy Lutomirski
Modified: 2014-05-01 02:37 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-05-01 02:37:12 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Andy Lutomirski 2013-01-14 15:16:41 UTC
libcap-ng does not handle the addition of new capabilities gracefully.  So far, I've found the following issues:

1. CAP_LAST_CAP is exposed in cap-ng.h.  cap-ng.h should instead expose a function or an extern const int that is set at runtime.  This makes looping over all capabilities work poorly.  (/proc/sys/kernel/cap_last_cap is there for exactly this reason.)

2. capng_capability_to_name returns null (often causing segfaults) when the input parameter isn't in the lookup table.  It could return something more clever like "cap_%d" with %d filled in appropriately.  (Leaking a few bytes per unknown capability number wouldn't be so bad -- it's a bounded leak.)

3. capng_name_to_capability can't parse names that aren't in the lookup table.

(2 and 3 would be greatly improved if there was a way to ask the kernel for the names of capabilities.)

4. CAP_LAST_CAP is a compile-time constant in cap-ng.c, meaning that many things are likely to break if new capabilities are added.


A stopgap measure would be to just fix #1 so that a mismatch between header and library version won't cause problems.

Comment 1 Steve Grubb 2013-01-14 15:26:18 UTC
Hmm...I didn't know about that proc entry. I'll see what I can do. I can likely do something with #2, but not #3. Thanks for pointing out the proc entry. The audit system and strace would have the same issues on interpreting unknown capabilities.

Comment 2 Andy Lutomirski 2013-01-14 15:36:05 UTC
Allowing capng_name_to_capability to parse cap_<number> is probably the best that can be done about #3.

Comment 3 Fedora End Of Life 2013-07-04 03:22:17 UTC
This message is a reminder that Fedora 17 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 17. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '17'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 17's end of life.

Bug Reporter:  Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 17 is end of life. If you 
would still like  to see this bug fixed and are able to reproduce it 
against a later version  of Fedora, you are encouraged  change the 
'version' to a later Fedora version prior to Fedora 17's end of life.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 4 Steve Grubb 2013-07-04 14:01:13 UTC
Still planning to make some changes...moving to rawhide.

Comment 5 Steve Grubb 2013-11-15 19:33:59 UTC
This now fixed in SVN and will be in libcap-ng-0.7.4.

Comment 6 Steve Grubb 2014-05-01 02:37:12 UTC
A new package was released fixing this.


Note You need to log in before you can comment on or make changes to this bug.