47ecc2
From 21cb5a8c7bcc90c42743ffd15cd11a55bf66993d Mon Sep 17 00:00:00 2001
47ecc2
From: Giuseppe Scrivano <gscrivan@redhat.com>
47ecc2
Date: Mon, 28 Feb 2022 11:06:50 +0100
47ecc2
Subject: [PATCH 2/2] exec: --cap do not set inheritable capabilities
47ecc2
47ecc2
Closes: CVE-2022-27650
47ecc2
47ecc2
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
47ecc2
(cherry picked from commit 1aeeed2e4fdeffb4875c0d0b439915894594c8c6)
47ecc2
---
47ecc2
 src/exec.c | 4 ++--
47ecc2
 1 file changed, 2 insertions(+), 2 deletions(-)
47ecc2
47ecc2
diff --git a/src/exec.c b/src/exec.c
47ecc2
index bf6c05f..8c9862d 100644
47ecc2
--- a/src/exec.c
47ecc2
+++ b/src/exec.c
47ecc2
@@ -250,8 +250,8 @@ crun_command_exec (struct crun_global_arguments *global_args, int argc, char **a
47ecc2
           capabilities->effective = exec_options.cap;
47ecc2
           capabilities->effective_len = exec_options.cap_size;
47ecc2
 
47ecc2
-          capabilities->inheritable = dup_array (exec_options.cap, exec_options.cap_size);
47ecc2
-          capabilities->inheritable_len = exec_options.cap_size;
47ecc2
+          capabilities->inheritable = NULL;
47ecc2
+          capabilities->inheritable_len = 0;
47ecc2
 
47ecc2
           capabilities->bounding = dup_array (exec_options.cap, exec_options.cap_size);
47ecc2
           capabilities->bounding_len = exec_options.cap_size;
47ecc2
-- 
47ecc2
2.35.1
47ecc2