----- Original Message -----
> From: "Jan Stancek" <jstan...@redhat.com>
> To: "Yuan Sun" <sunyu...@huawei.com>
> Cc: ltp-list@lists.sourceforge.net
> Sent: Friday, 3 July, 2015 12:27:49 PM
> Subject: Re: [LTP] [PATCH V2] userns01: add capability verification
> 
> 
> 
> 
> 
> ----- Original Message -----
> > From: "Yuan Sun" <sunyu...@huawei.com>
> > To: "Jan Stancek" <jstan...@redhat.com>
> > Cc: ltp-list@lists.sourceforge.net
> > Sent: Friday, 3 July, 2015 11:37:45 AM
> > Subject: Re: [PATCH V2] userns01: add capability verification
> > 
> > 
> > Log is as follow. I am not clear if new feature is added.
> 
> I have installed "ubuntu-15.04-server-amd64.iso" and I get
> the same failure:
> 
> root@ubuntu:~# apt-cache show libcap2 | grep Vers
> Version: 1:2.24-6
> 
> root@ubuntu:~# uname -r
> 3.19.0-15-generic
> 
> root@ubuntu:~# cat /proc/self/status | grep Eff
> CapEff: 0000003fffffffff
> 
> root@ubuntu:~# ./a.out
> ffffffff 0000003f
> ffffffff ffffffff
> cap_compare: 3

Since this doesn't work on multiple distros, I'm thinking about
this as alternative (plus checking ret code from cap_get_flag):

        int i, last_cap;
        cap_flag_value_t flag_val;

        SAFE_FILE_SCANF(NULL, "/proc/sys/kernel/cap_last_cap", "%d", &last_cap);
        for (i = 0; i <= last_cap; i++) {
                cap_get_flag(caps, i, CAP_EFFECTIVE, &flag_val);
                if (flag_val == 0)
                        break;
                cap_get_flag(caps, i, CAP_PERMITTED, &flag_val);
                if (flag_val == 0)
                        break;
        }

        if (flag_val == 0) {
                printf("unexpected effective/permitted caps\n");
                exit_val = 1;
        }


> 
> Regards,
> Jan
> 
> ------------------------------------------------------------------------------
> Don't Limit Your Business. Reach for the Cloud.
> GigeNET's Cloud Solutions provide you with the tools and support that
> you need to offload your IT needs and focus on growing your business.
> Configured For All Businesses. Start Your Cloud Today.
> https://www.gigenetcloud.com/
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list
> 

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to