harald | 12 Jun 2012 13:51
Picon
Favicon
Gravatar

[PATCH] Before clearing the capability bounding set, check if we have the cap

From: Harald Hoyer <harald@...>

PR_CAPBSET_DROP can return EINVAL, if an older kernel does support
some capabilities, which are defined by CAP_LAST_CAP, which results in
a failure of the service.

For example kernel 3.4 errors on CAP_EPOLLWAKEUP, which was newly
introduced in 3.5.

So, for future capabilities, we clear until we get an EINVAL for
PR_CAPBSET_READ.
---
 support/nsm/file.c      |    2 +-
 utils/nfsdcld/nfsdcld.c |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/support/nsm/file.c b/support/nsm/file.c
index 5476446..4711c2c 100644
--- a/support/nsm/file.c
+++ b/support/nsm/file.c
 <at>  <at>  -386,7 +386,7  <at>  <at>  prune_bounding_set(void)
 	}

 	/* prune the bounding set to nothing */
-	for (i = 0; i <= CAP_LAST_CAP; ++i) {
+	for (i = 0; prctl(PR_CAPBSET_READ, i, 0, 0, 0) >=0 ; ++i) {
 		ret = prctl(PR_CAPBSET_DROP, i, 0, 0, 0);
 		if (ret) {
 			xlog(L_ERROR, "Unable to prune capability %lu from "
diff --git a/utils/nfsdcld/nfsdcld.c b/utils/nfsdcld/nfsdcld.c
(Continue reading)

Jeff Layton | 12 Jun 2012 14:17
Picon
Favicon

Re: [PATCH] Before clearing the capability bounding set, check if we have the cap

On Tue, 12 Jun 2012 13:51:06 +0200
harald@... wrote:

> From: Harald Hoyer <harald@...>
> 
> PR_CAPBSET_DROP can return EINVAL, if an older kernel does support
> some capabilities, which are defined by CAP_LAST_CAP, which results in
> a failure of the service.
> 
> For example kernel 3.4 errors on CAP_EPOLLWAKEUP, which was newly
> introduced in 3.5.
> 
> So, for future capabilities, we clear until we get an EINVAL for
> PR_CAPBSET_READ.
> ---
>  support/nsm/file.c      |    2 +-
>  utils/nfsdcld/nfsdcld.c |    4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/support/nsm/file.c b/support/nsm/file.c
> index 5476446..4711c2c 100644
> --- a/support/nsm/file.c
> +++ b/support/nsm/file.c
>  <at>  <at>  -386,7 +386,7  <at>  <at>  prune_bounding_set(void)
>  	}
>  
>  	/* prune the bounding set to nothing */
> -	for (i = 0; i <= CAP_LAST_CAP; ++i) {
> +	for (i = 0; prctl(PR_CAPBSET_READ, i, 0, 0, 0) >=0 ; ++i) {
>  		ret = prctl(PR_CAPBSET_DROP, i, 0, 0, 0);
(Continue reading)

Harald Hoyer | 12 Jun 2012 14:22
Picon
Favicon
Gravatar

Re: [PATCH] Before clearing the capability bounding set, check if we have the cap

On 06/12/2012 02:17 PM, Jeff Layton wrote:
> On Tue, 12 Jun 2012 13:51:06 +0200
> harald@... wrote:
> 
>> From: Harald Hoyer <harald@...>
>>
>> PR_CAPBSET_DROP can return EINVAL, if an older kernel does support
>> some capabilities, which are defined by CAP_LAST_CAP, which results in
>> a failure of the service.
>>
>> For example kernel 3.4 errors on CAP_EPOLLWAKEUP, which was newly
>> introduced in 3.5.
>>
>> So, for future capabilities, we clear until we get an EINVAL for
>> PR_CAPBSET_READ.
>> ---
>>  support/nsm/file.c      |    2 +-
>>  utils/nfsdcld/nfsdcld.c |    4 ++--
>>  2 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/support/nsm/file.c b/support/nsm/file.c
>> index 5476446..4711c2c 100644
>> --- a/support/nsm/file.c
>> +++ b/support/nsm/file.c
>>  <at>  <at>  -386,7 +386,7  <at>  <at>  prune_bounding_set(void)
>>  	}
>>  
>>  	/* prune the bounding set to nothing */
>> -	for (i = 0; i <= CAP_LAST_CAP; ++i) {
>> +	for (i = 0; prctl(PR_CAPBSET_READ, i, 0, 0, 0) >=0 ; ++i) {
(Continue reading)

Steve Dickson | 19 Jun 2012 16:53
Picon
Favicon

Re: [PATCH] Before clearing the capability bounding set, check if we have the cap


On 06/12/2012 07:51 AM, harald@... wrote:
> From: Harald Hoyer <harald@...>
> 
> PR_CAPBSET_DROP can return EINVAL, if an older kernel does support
> some capabilities, which are defined by CAP_LAST_CAP, which results in
> a failure of the service.
> 
> For example kernel 3.4 errors on CAP_EPOLLWAKEUP, which was newly
> introduced in 3.5.
> 
> So, for future capabilities, we clear until we get an EINVAL for
> PR_CAPBSET_READ.
Committed...

steved.

> ---
>  support/nsm/file.c      |    2 +-
>  utils/nfsdcld/nfsdcld.c |    4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/support/nsm/file.c b/support/nsm/file.c
> index 5476446..4711c2c 100644
> --- a/support/nsm/file.c
> +++ b/support/nsm/file.c
>  <at>  <at>  -386,7 +386,7  <at>  <at>  prune_bounding_set(void)
>  	}
>  
>  	/* prune the bounding set to nothing */
(Continue reading)


Gmane