<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "http://bugs.gentoo.org/bugzilla.dtd">

<bugzilla version="2.22.7"
          urlbase="http://bugs.gentoo.org/"
          maintainer="bugzilla@gentoo.org"
>

    <bug>
          <bug_id>22016</bug_id>
          
          <creation_ts>2003-05-31 15:29 0000</creation_ts>
          <short_desc>lcap removes all capabilities</short_desc>
          <delta_ts>2003-06-12 06:23:11 0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Gentoo Linux</product>
          <component>Applications</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>marka@desert.cx</reporter>
          <assigned_to>phosphan@gentoo.org</assigned_to>
          

      

      
          <long_desc isprivate="0">
            <who>marka@desert.cx</who>
            <bug_when>2003-05-31 15:29:47 0000</bug_when>
            <thetext>Using lcap to remove a single capability removes them all. 

Reproducible: Always
Steps to Reproduce:
1. lcap CAP_NET_RAW 
2. lcap 
Actual Results:  
lcap shows all capabilities removed 

Expected Results:  
lcap should have only removed the CAP_NET_RAW capability 

Portage 2.0.48 (default-x86-1.4, gcc-3.2.2, glibc-2.3.1-r4) 
================================================================= 
System uname: 2.4.20-m2 i686 AMD Athlon(tm) XP 2000+ 
GENTOO_MIRRORS=&quot;http://gentoo.oregonstate.edu/ http://www.ibiblio.org/gentoo/&quot; 
CONFIG_PROTECT=&quot;/etc /var/qmail/control /usr/kde/2/share/config 
/usr/kde/3/share/config /usr/X11R6/lib/X11/xkb /usr/kde/3.1/share/config 
/usr/share/config&quot; 
CONFIG_PROTECT_MASK=&quot;/etc/gconf /etc/env.d&quot; 
PORTDIR=&quot;/usr/portage&quot; 
DISTDIR=&quot;/usr/portage/distfiles&quot; 
PKGDIR=&quot;/usr/portage/packages&quot; 
PORTAGE_TMPDIR=&quot;/work&quot; 
PORTDIR_OVERLAY=&quot;/usr/local/portage&quot; 
USE=&quot;x86 oss 3dnow apm avi crypt cups encode gif jpeg kde gnome libg++ mikmod 
mmx mpeg ncurses nls pdflib png spell truetype xml2 xmms xv zlib alsa gdbm berkdb 
slang readline arts tetex aalib tcltk java guile postgres X sdl gpm tcpd pam libwww ssl 
perl python imlib oggvorbis gtk qt motif opengl cdr mbox -svga -esd -quicktime&quot; 
COMPILER=&quot;gcc3&quot; 
CHOST=&quot;i686-pc-linux-gnu&quot; 
CFLAGS=&quot;-march=athlon -O3 -pipe&quot; 
CXXFLAGS=&quot;-O2 -mcpu=i686 -pipe&quot; 
ACCEPT_KEYWORDS=&quot;x86&quot; 
MAKEOPTS=&quot;-j2&quot; 
AUTOCLEAN=&quot;yes&quot; 
SYNC=&quot;rsync://rsync.gentoo.org/gentoo-portage&quot; 
FEATURES=&quot;sandbox ccache&quot;</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>phosphan@gentoo.org</who>
            <bug_when>2003-06-11 02:16:17 0000</bug_when>
            <thetext>Strange things happening...

If I just lcap -vv CAP_SYS_MODULE, all capabilities are blanked.
If I try lcap -vv CAP_SYS_TIME, I can safely remove CAP_SYS_MODULE afterwards, but
trying CAP_NET_RAW then blanks everything again. Seems it has strange problems with certain bit combinations. Investigating...</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>phosphan@gentoo.org</who>
            <bug_when>2003-06-11 03:19:50 0000</bug_when>
            <thetext>Looks like sometimes it can&apos;t read back the data it writes to the kernel via /proc - still no idea who gets it wrong, the kernel or lcap. Stay tuned.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>phosphan@gentoo.org</who>
            <bug_when>2003-06-11 06:24:30 0000</bug_when>
            <thetext>Got it.
The kernel (at least 2.4.20) uses the function proc_dointvec_bset from kernel/sysctl.c for access to /proc/sys/kernel/cap-bound - this function forbids any access if CAP_SYS_MODULE is not available (please don&apos;t ask me why they made it this way).
lcap is satisfied if it can open the file (which will work), then it reads from it (which fails, but isn&apos;t caught). It gets a zero and displays all capabilities as deleted though they aren&apos;t.
Just removing CAP_NET_RAW does not show this effect (at least not on my system). Please try to verify this with the new -r1 revision which should be in portage soon. It should print an error message if it can&apos;t read the capabilities.
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>marka@desert.cx</who>
            <bug_when>2003-06-12 06:04:53 0000</bug_when>
            <thetext>OK, thanks. I just won&apos;t remove CAP_SYS_MODULE. Removing other capabilities work as expected.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>phosphan@gentoo.org</who>
            <bug_when>2003-06-12 06:22:35 0000</bug_when>
            <thetext>Fine. Setting this to fixed.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>phosphan@gentoo.org</who>
            <bug_when>2003-06-12 06:23:11 0000</bug_when>
            <thetext>Fixed.</thetext>
          </long_desc>
      
    </bug>

</bugzilla>