[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 2/5] virtiofsd: Check capability calls
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[PULL 2/5] virtiofsd: Check capability calls |
Date: |
Fri, 3 Jul 2020 16:27:45 +0100 |
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Check the capability calls worked.
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
Message-Id: <20200629115420.98443-3-dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
tools/virtiofsd/passthrough_ll.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
index e373e3b36e..99d562046a 100644
--- a/tools/virtiofsd/passthrough_ll.c
+++ b/tools/virtiofsd/passthrough_ll.c
@@ -2589,7 +2589,7 @@ static void setup_capabilities(void)
*/
capng_setpid(syscall(SYS_gettid));
capng_clear(CAPNG_SELECT_BOTH);
- capng_updatev(CAPNG_ADD, CAPNG_PERMITTED | CAPNG_EFFECTIVE,
+ if (capng_updatev(CAPNG_ADD, CAPNG_PERMITTED | CAPNG_EFFECTIVE,
CAP_CHOWN,
CAP_DAC_OVERRIDE,
CAP_DAC_READ_SEARCH,
@@ -2599,11 +2599,21 @@ static void setup_capabilities(void)
CAP_SETUID,
CAP_MKNOD,
CAP_SETFCAP,
- -1);
+ -1)) {
+ fuse_log(FUSE_LOG_ERR, "%s: capng_updatev failed\n", __func__);
+ exit(1);
+ }
- capng_apply(CAPNG_SELECT_BOTH);
+ if (capng_apply(CAPNG_SELECT_BOTH)) {
+ fuse_log(FUSE_LOG_ERR, "%s: capng_apply failed\n", __func__);
+ exit(1);
+ }
cap.saved = capng_save_state();
+ if (!cap.saved) {
+ fuse_log(FUSE_LOG_ERR, "%s: capng_save_state failed\n", __func__);
+ exit(1);
+ }
pthread_mutex_unlock(&cap.mutex);
}
--
2.26.2
- [PULL 0/5] migration queue, Dr. David Alan Gilbert (git), 2020/07/03
- [PULL 1/5] virtiofsd: Terminate capability list, Dr. David Alan Gilbert (git), 2020/07/03
- [PULL 2/5] virtiofsd: Check capability calls,
Dr. David Alan Gilbert (git) <=
- [PULL 3/5] virtiofsd: Allow addition or removal of capabilities, Dr. David Alan Gilbert (git), 2020/07/03
- [PULL 4/5] migration: postcopy take proper error return, Dr. David Alan Gilbert (git), 2020/07/03
- [PULL 5/5] migration: Count new_dirty instead of real_dirty, Dr. David Alan Gilbert (git), 2020/07/03
- Re: [PULL 0/5] migration queue, Peter Maydell, 2020/07/04