virtiofsd: Terminate capability list
authorDr. David Alan Gilbert <dgilbert@redhat.com>
Mon, 29 Jun 2020 11:54:18 +0000 (12:54 +0100)
committerDr. David Alan Gilbert <dgilbert@redhat.com>
Fri, 3 Jul 2020 15:23:05 +0000 (16:23 +0100)
capng_updatev is a varargs function that needs a -1 to terminate it,
but it was missing.

In practice what seems to have been happening is that it's added the
capabilities we asked for, then runs into junk on the stack, so if
we're unlucky it might be adding some more, but in reality it's
failing - but after adding the capabilities we asked for.

Fixes: a59feb483b8 ("virtiofsd: only retain file system capabilities")
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-2-dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
tools/virtiofsd/passthrough_ll.c

index 2ce7c96085bf5a1a8b55dd21f23bb30a4661f606..e373e3b36ec8ecf6c2a84907108739be67d7dcd4 100644 (file)
@@ -2598,7 +2598,9 @@ static void setup_capabilities(void)
             CAP_SETGID,
             CAP_SETUID,
             CAP_MKNOD,
-            CAP_SETFCAP);
+            CAP_SETFCAP,
+            -1);
+
     capng_apply(CAPNG_SELECT_BOTH);
 
     cap.saved = capng_save_state();