From: harald@redhat.com
To: steved@redhat.com
Cc: linux-nfs@vger.kernel.org, jlayton@redhat.com,
Harald Hoyer <harald@redhat.com>
Subject: [PATCH] Before clearing the capability bounding set, check if we have the cap
Date: Tue, 12 Jun 2012 13:51:06 +0200 [thread overview]
Message-ID: <1339501866-18967-1-git-send-email-harald@redhat.com> (raw)
From: Harald Hoyer <harald@redhat.com>
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
@@ -386,7 +386,7 @@ 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
index e7af4e3..473d069 100644
--- a/utils/nfsdcld/nfsdcld.c
+++ b/utils/nfsdcld/nfsdcld.c
@@ -102,8 +102,8 @@ cld_set_caps(void)
}
/* prune the bounding set to nothing */
- for (i = 0; i <= CAP_LAST_CAP; ++i) {
- ret = prctl(PR_CAPBSET_DROP, 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 "
"bounding set: %m", i);
--
1.7.10.2
next reply other threads:[~2012-06-12 11:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-12 11:51 harald [this message]
2012-06-12 12:17 ` [PATCH] Before clearing the capability bounding set, check if we have the cap Jeff Layton
2012-06-12 12:22 ` Harald Hoyer
2012-06-19 14:53 ` Steve Dickson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1339501866-18967-1-git-send-email-harald@redhat.com \
--to=harald@redhat.com \
--cc=jlayton@redhat.com \
--cc=linux-nfs@vger.kernel.org \
--cc=steved@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).