On Fri, Feb 15, 2008 at 12:38:02PM -0600, Serge E. Hallyn wrote:
> Quoting Kohei KaiGai ([EMAIL PROTECTED]):
> > Li Zefan wrote:
> >  - snip -
> > >> +error1:
> > >> +        kobject_put(capability_kobj);
> > >> +error0:
> > >> +        printk(KERN_ERR "Unable to export capabilities\n");
> > >> +
> > >> +        return 0;
> > > 
> > > Should return -EFXXX ..
> > 
> > Oops,
> > I fixed it as follows. Thanks for your pointed out.
> > 
> > --------
> > This patch enables to export code/name of capabilities supported
> > on the running kernel.
> > 
> > A newer kernel sometimes adds new capabilities, like CAP_MAC_ADMIN
> > at 2.6.25. However, we have no interface to disclose what capabilities
> > are supported on this kernel. Thus, we have to maintain libcap version
> > in appropriate one synchronously.
> > 
> > This patch enables libcap to collect the list of capabilities on
> > run time, and provide them for users.
> > It helps to improve portability of library.
> > 
> > It exports these information as regular files under /sys/kernel/capability.
> > The numeric node exports its name, the symbolic node exports its code.
> > 
> > Please consider to put this patch on the queue of 2.6.25.
> 
> Looks good, except don't you need to put the code in commoncap.c under a
> #ifdef SYSFS?
> 
> thanks,
> -serge
> 
> > 
> > Thanks,
> > ===================================================
> > [EMAIL PROTECTED] ~]$ ls -R /sys/kernel/capability/
> > /sys/kernel/capability/:
> > codes  names  version
> > 
> > /sys/kernel/capability/codes:
> > 0  10  12  14  16  18  2   21  23  25  27  29  30  32  4  6  8
> > 1  11  13  15  17  19  20  22  24  26  28  3   31  33  5  7  9
> > 
> > /sys/kernel/capability/names:
> > cap_audit_control    cap_kill              cap_net_raw     cap_sys_nice
> > cap_audit_write      cap_lease             cap_setfcap     cap_sys_pacct
> > cap_chown            cap_linux_immutable   cap_setgid      cap_sys_ptrace
> > cap_dac_override     cap_mac_admin         cap_setpcap     cap_sys_rawio
> > cap_dac_read_search  cap_mac_override      cap_setuid      cap_sys_resource
> > cap_fowner           cap_mknod             cap_sys_admin   cap_sys_time
> > cap_fsetid           cap_net_admin         cap_sys_boot    
> > cap_sys_tty_config
> > cap_ipc_lock         cap_net_bind_service  cap_sys_chroot
> > cap_ipc_owner        cap_net_broadcast     cap_sys_module
> > [EMAIL PROTECTED] ~]$ cat /sys/kernel/capability/version
> > 0x20071026
> > [EMAIL PROTECTED] ~]$ cat /sys/kernel/capability/codes/30
> > cap_audit_control
> > [EMAIL PROTECTED] ~]$ cat /sys/kernel/capability/names/cap_sys_pacct
> > 20
> > [EMAIL PROTECTED] ~]$
> > ===================================================

As you are adding new sysfs entries, please also add the needed
Documentation/ABI/ entries as well.

Also, this code can be cleaned up a lot by just using the basic kobject
attributes, and not rolling your own types here.

thanks,

greg k-h
-
To unsubscribe from this list: send the line "unsubscribe 
linux-security-module" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to