seccomp: adding blacklist support with command line
v3 cover seccomp: adding blacklist support with command line
v3: The "-netdev tap" option is checked in order to decide if the blacklist is eligible to be installed or not, since it's one the most used features that is known to use the exec() system call. It's an automatic mechanism to avoid Qemu to break when using the blacklist feature.
v2: The blacklist works exactly the opposite as the whitelist. I set the default behaiour to SCMP_ACT_ALLOW and the exceptions to SCMP_ACT_KILL; remembering it inherits the behavior from the previous installed whitelist.
v1: The second whitelist is installed right before the vcpu starts, it contains all the system calls the first one has except for exec() and select(), which are big major syscalls that I could extensively test with virt-test and do not cause any damage to the general execution.
This patch series also contain the command line support for this feature and some minor fixes, all of them described in their own commit messages.
The environment in which the second whitelist is installed seems to need less system calls than the first, so the procedure here will be the same: Keep testing with virt-test and get to the smallest list as possible.
Eduardo Otubo (3):
seccomp: adding blacklist support
seccomp: adding command line support for blacklist
seccomp: general fixes
include/sysemu/seccomp.h | 6 ++++- qemu-options.hx | 8 +++--- qemu-seccomp.c | 66 ++++++++++++++++++++++++++++++++++++++---------- vl.c | 42 +++++++++++++++++++++++++++--- 4 files changed, 101 insertions(+), 21 deletions(-)
Signature · 1 line
1.8.3.1
PATCH v3 1/3 seccomp: adding blacklist support
v3: The "-netdev tap" option is checked in the vl.c file during the process of the command line argument list. It sets tap_enabled to true or false according to the configuration found. Later at the seccomp filter installation, this value is checked wheter to install or not this feature.
Adding a system call blacklist right before the vcpus starts. This filter is composed by the system calls that can't be executed after the guests are up. This list should be refined as whitelist is, with as much testing as we can do using virt-test.
--- include/sysemu/seccomp.h | 6 ++++- qemu-seccomp.c | 64 +++++++++++++++++++++++++++++++++++++++--------- vl.c | 21 +++++++++++++++- 3 files changed, 77 insertions(+), 14 deletions(-)
include/sysemu/seccomp.h +5 -1
@@ -15,8 +15,12 @@#ifndef QEMU_SECCOMP_H #define QEMU_SECCOMP_H +#define WHITELIST 0 +#define BLACKLIST 1 +#include <seccomp.h> #include "qemu/osdep.h" -int seccomp_start (void ); +int seccomp_start (int list_type); +#endif
qemu-seccomp.c +52 -12
91 lines not on this page · raw message
vl.c +20 -1
@@ -179,6 +179,8 @@ int main(int argc, char **argv)#define MAX_VIRTIO_CONSOLES 1#define MAX_SCLP_CONSOLES 1 +static bool enable_blacklist = false; +static bool tap_enabled = false;static const char *data_dir[16 ];static int data_dir_idx;const char *bios_name =NULL ;
@@ -1033,7 +1035,7 @@ static int parse_sandbox(QemuOpts *opts, void *opaque)/* FIXME: change this to true for 1.3 */ if (qemu_opt_get_bool (opts,"enable" , false)) {#ifdef CONFIG_SECCOMP -if (seccomp_start () <0 ) { +if (seccomp_start (WHITELIST ) <0 ) {qerror_report (ERROR_CLASS_GENERIC_ERROR ,"failed to install seccomp syscall filter in the kernel" );return -1 ;
@@ -1765,12 +1767,24 @@ void vm_state_notify(int running, RunState state) } } +static void install_seccomp_blacklist (void ) +{ +if (enable_blacklist && !tap_enabled) { +if (seccomp_start (BLACKLIST ) <0 ) { +qerror_report (ERROR_CLASS_GENERIC_ERROR , +"failed to install seccomp syscall second level filter in the kernel" ); +exit (1 ); + } + } +} +void vm_start (void ) {if (!runstate_is_running ()) {cpu_enable_ticks ();runstate_set (RUN_STATE_RUNNING );vm_state_notify (1 ,RUN_STATE_RUNNING ); +install_seccomp_blacklist ();resume_all_vcpus ();monitor_protocol_event (QEVENT_RESUME ,NULL ); }
@@ -3208,6 +3222,11 @@ int main(int argc, char **argv, char **envp)if (net_client_parse (qemu_find_opts ("netdev" ), optarg) ==-1 ) {exit (1 ); } + +if (strcmp (optarg,"tap" )){ + tap_enabled = true; + } +break ;case QEMU_OPTION_net:if (net_client_parse (qemu_find_opts ("net" ), optarg) ==-1 ) {
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PATCHv3 1/3] seccomp: adding blacklist support
Quoted 4 lines · Eduardo Otubo
v3: The "-netdev tap" option is checked in the
vl.cfile during the process of the command line argument list. It setstap_enabledto true or false according to the configuration found. Later at the seccomp filter installation, this value is checked wheter to install or not this
s/wheter/whether/
Quoted 7 lines
feature.
Adding a system call blacklist right before the vcpus starts. This filter is composed by the system calls that can't be executed after the guests are up. This list should be refined as whitelist is, with as much testing as we can do using virt-test.
Quoted 6 lines
Signed-off-by Eduardo Otubo <[email protected]>--- include/sysemu/seccomp.h | 6 ++++- qemu-seccomp.c | 64 +++++++++++++++++++++++++++++++++++++++--------- vl.c | 21 +++++++++++++++- 3 files changed, 77 insertions(+), 14 deletions(-)
No review on the actual patch, just spotting a typo.
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Re: [Qemu-devel] [PATCHv3 1/3] seccomp: adding blacklist support
Quoted 7 lines · Eric Blake
Quoted 4 lines · Eduardo Otubo
v3: The "-netdev tap" option is checked in the
vl.cfile during the process of the command line argument list. It setstap_enabledto true or false according to the configuration found. Later at the seccomp filter installation, this value is checked wheter to install or not thiss/wheter/whether/
Thank you.
Quoted 18 lines
Quoted 8 lines
feature.
Adding a system call blacklist right before the vcpus starts. This filter is composed by the system calls that can't be executed after the guests are up. This list should be refined as whitelist is, with as much testing as we can do using virt-test.
Quoted 6 lines
Signed-off-by Eduardo Otubo <[email protected]>--- include/sysemu/seccomp.h | 6 ++++- qemu-seccomp.c | 64 +++++++++++++++++++++++++++++++++++++++--------- vl.c | 21 +++++++++++++++- 3 files changed, 77 insertions(+), 14 deletions(-)No review on the actual patch, just spotting a typo.
Signature · 2 lines
Eduardo Otubo IBM Linux Technology Center
Re: [Qemu-devel] [PATCHv3 1/3] seccomp: adding blacklist support
In reply to Eduardo OtuboQuoted 156 lines · Eduardo Otubo
v3: The "-netdev tap" option is checked in the
vl.cfile during the process of the command line argument list. It setstap_enabledto true or false according to the configuration found. Later at the seccomp filter installation, this value is checked wheter to install or not this feature.Adding a system call blacklist right before the vcpus starts. This filter is composed by the system calls that can't be executed after the guests are up. This list should be refined as whitelist is, with as much testing as we can do using virt-test.
Signed-off-by Eduardo Otubo <[email protected]>--- include/sysemu/seccomp.h | 6 ++++- qemu-seccomp.c | 64 +++++++++++++++++++++++++++++++++++++++--------- vl.c | 21 +++++++++++++++- 3 files changed, 77 insertions(+), 14 deletions(-)include/sysemu/seccomp.h +5
-1@@ -15,8 +15,12 @@#ifndef QEMU_SECCOMP_H #define QEMU_SECCOMP_H +#define WHITELIST 0 +#define BLACKLIST 1 +#include <seccomp.h> #include "qemu/osdep.h" -int seccomp_start (void ); +int seccomp_start (int list_type); +#endif qemu-seccomp.c +52
-12@@ -21,7 +21,7 @@ struct QemuSeccompSyscall {uint8_t priority; }; -static const struct QemuSeccompSyscall seccomp_whitelist[] = { +static const struct QemuSeccompSyscall whitelist[] = { {SCMP_SYS (timer_settime),255 }, {SCMP_SYS (timer_gettime),254 }, {SCMP_SYS (futex),253 },@@ -221,32 +221,72 @@ static const struct QemuSeccompSyscall seccomp_whitelist[] = { { SCMP_SYS(arch_prctl), 240 } }; -int seccomp_start (void ) +/* +* The second list, called blacklist, basically reduces previously installed +* whitelist. All the syscalls configured by the previous whitelist are still +* allowed, except for the ones in the blacklist. +* */ + +static const struct QemuSeccompSyscall blacklist[] = { + {SCMP_SYS (execve),255 } +}; + +static int process_list (scmp_filter_ctx *ctx, +const struct QemuSeccompSyscall *list, +unsigned int list_size,uint32_t action) {int rc =0 ;unsigned int i =0 ; -scmp_filter_ctx ctx; - ctx =seccomp_init (SCMP_ACT_KILL ); -if (ctx ==NULL ) { - goto seccomp_return; - } +for (i =0 ; i < list_size; i++) { + rc =seccomp_rule_add (ctx, action, list[i].num,0 ); +if (rc <0 ) { + goto seccomp_return; + } -for (i =0 ; i <ARRAY_SIZE (seccomp_whitelist); i++) { - rc =seccomp_rule_add (ctx,SCMP_ACT_ALLOW , seccomp_whitelist[i].num,0 ); + rc =seccomp_syscall_priority (ctx, list[i].num, + list[i].priority);if (rc <0 ) { goto seccomp_return; } - rc =seccomp_syscall_priority (ctx, seccomp_whitelist[i].num, - seccomp_whitelist[i].priority); + } + +seccomp_return: +return rc; +} + +int seccomp_start (int list_type) +{ +int rc =0 ; +scmp_filter_ctx ctx; + +switch (list_type) { +case WHITELIST : + ctx =seccomp_init (SCMP_ACT_KILL ); +if (ctx ==NULL ) { + goto seccomp_return; + } + rc =process_list (ctx, whitelist,ARRAY_SIZE (whitelist),SCMP_ACT_ALLOW );if (rc <0 ) { goto seccomp_return; } +break ; +case BLACKLIST : + ctx =seccomp_init (SCMP_ACT_ALLOW ); +if (ctx ==NULL ) { + goto seccomp_return; + } + rc =process_list (ctx, blacklist,ARRAY_SIZE (blacklist),SCMP_ACT_KILL ); +break ; +default : + rc =-1 ; + goto seccomp_return; } rc =seccomp_load (ctx); seccomp_return: -seccomp_release (ctx); +if (ctx) +seccomp_release (ctx);return rc; }vl.c +3
-1@@ -179,6 +179,8 @@ int main(int argc, char **argv)#define MAX_VIRTIO_CONSOLES 1#define MAX_SCLP_CONSOLES 1 +static bool enable_blacklist = false; +static bool tap_enabled = false;static const char *data_dir[16 ];static int data_dir_idx;const char *bios_name =NULL ;@@ -1033,7 +1035,7 @@ static int parse_sandbox(QemuOpts *opts, void *opaque)/* FIXME: change this to true for 1.3 */ if (qemu_opt_get_bool (opts,"enable" , false)) {#ifdef CONFIG_SECCOMP -if (seccomp_start () <0 ) { +if (seccomp_start (WHITELIST ) <0 ) {qerror_report (ERROR_CLASS_GENERIC_ERROR ,"failed to install seccomp syscall filter in the kernel" );return -1 ;
vl.c void vm_state_notify(int running, RunState state) · line 1773
Quoted 7 lines
vl.c +4
-0@@ -1765,12 +1767,24 @@ void vm_state_notify(int running, RunState state) } } +static void install_seccomp_blacklist (void ) +{ +if (enable_blacklist && !tap_enabled) { +if (seccomp_start (BLACKLIST ) <0 ) {
I don't think this is flexible enough for future growth. If you're going to use a dynamic approach to building the blacklist, then wouldn't you want to blacklist syscalls individually based on the option that causes them to be used? The approach you have here would be all or nothing.
Quoted 18 lines
vl.c +8
-0+qerror_report (ERROR_CLASS_GENERIC_ERROR , +"failed to install seccomp syscall second level filter in the kernel" ); +exit (1 ); + } + } +} +void vm_start (void ) {if (!runstate_is_running ()) {cpu_enable_ticks ();runstate_set (RUN_STATE_RUNNING );vm_state_notify (1 ,RUN_STATE_RUNNING ); +install_seccomp_blacklist ();resume_all_vcpus ();monitor_protocol_event (QEVENT_RESUME ,NULL ); }
vl.c int main(int argc, char **argv, char **envp) · line 3228
Quoted 7 lines
vl.c +4
-0@@ -3208,6 +3222,11 @@ int main(int argc, char **argv, char **envp)if (net_client_parse (qemu_find_opts ("netdev" ), optarg) ==-1 ) {exit (1 ); } + +if (strcmp (optarg,"tap" )){ + tap_enabled = true; + }
You're not covering all command line options that lead to exec calls. I see the following with 'git grep execv':
net/tap.c: execv(setup_script, args);
net/tap.c: execv("/bin/sh", args);
net/tap.c: execv(helper, args);
slirp/misc.c: execvp(argv[0], (char **)argv);So I know you're at least missing -net bridge. And maybe slirp, but I'm not sure about that.
What about hotplugging a network tap or bridge device? You'll need to at least document that they're not going to work when -sandbox is in effect, and you'll need to fail nicely if they're attempted.
Quoted 5 lines
vl.c +1
-0+break ;case QEMU_OPTION_net:if (net_client_parse (qemu_find_opts ("net" ), optarg) ==-1 ) {
Signature · 2 lines
Regards, Corey Bryant
Re: [Qemu-devel] [PATCHv3 1/3] seccomp: adding blacklist support
In reply to Eduardo OtuboQuoted 5 lines · Eduardo Otubo
v3: The "-netdev tap" option is checked in the
vl.cfile during the process of the command line argument list. It setstap_enabledto true or false according to the configuration found. Later at the seccomp filter installation, this value is checked wheter to install or not this feature.
I like the idea of slowly making the QEMU syscall filter dependent on the runtime configuration. With that in mind, I wonder if we should have a more general purpose API in include/sysemu/seccomp.h that allows QEMU to indicate to the the QEMU/seccomp code that a particular feature is enabled.
Maybe something like this:
#define SCMP_FEAT_TAP ... int seccomp_feature_enable(int feature);
One more comment below.
Quoted 18 lines
Adding a system call blacklist right before the vcpus starts. This filter is composed by the system calls that can't be executed after the guests are up. This list should be refined as whitelist is, with as much testing as we can do using virt-test.
Signed-off-by Eduardo Otubo <[email protected]>--- include/sysemu/seccomp.h | 6 ++++- qemu-seccomp.c | 64 +++++++++++++++++++++++++++++++++++++++--------- vl.c | 21 +++++++++++++++- 3 files changed, 77 insertions(+), 14 deletions(-)include/sysemu/seccomp.h +0
-0
include/sysemu/seccomp.h line 19
Quoted 5 lines
include/sysemu/seccomp.h +2
-0@@ -15,8 +15,12 @@#ifndef QEMU_SECCOMP_H #define QEMU_SECCOMP_H +#define WHITELIST 0 +#define BLACKLIST 1
Should these #defines be namespaced in some way, e.g. SCMP_LIST_BLACKLIST?
Quoted 7 lines
include/sysemu/seccomp.h +2
-1#include <seccomp.h> #include "qemu/osdep.h" -int seccomp_start (void ); +int seccomp_start (int list_type); +#endif
Signature · 2 lines
paul moore security and virtualization @ redhat
Re: [Qemu-devel] [PATCHv3 1/3] seccomp: adding blacklist support
Quoted 12 lines · Paul Moore
Quoted 5 lines · Eduardo Otubo
v3: The "-netdev tap" option is checked in the
vl.cfile during the process of the command line argument list. It setstap_enabledto true or false according to the configuration found. Later at the seccomp filter installation, this value is checked wheter to install or not this feature.I like the idea of slowly making the QEMU syscall filter dependent on the runtime configuration. With that in mind, I wonder if we should have a more general purpose API in
include/sysemu/seccomp.hthat allows QEMU to indicate to the the QEMU/seccomp code that a particular feature is enabled.
Quoted 5 lines
Maybe something like this:
#define SCMP_FEAT_TAP ... int seccomp_feature_enable(int feature);
This is a good approach, and then the blacklist can vary based on what features are enabled.
Signature · 2 lines
Regards, Corey Bryant
Quoted 38 lines
One more comment below.
Quoted 18 lines
Adding a system call blacklist right before the vcpus starts. This filter is composed by the system calls that can't be executed after the guests are up. This list should be refined as whitelist is, with as much testing as we can do using virt-test.
Signed-off-by Eduardo Otubo <[email protected]>--- include/sysemu/seccomp.h | 6 ++++- qemu-seccomp.c | 64 +++++++++++++++++++++++++++++++++++++++--------- vl.c | 21 +++++++++++++++- 3 files changed, 77 insertions(+), 14 deletions(-)include/sysemu/seccomp.h +0
-0include/sysemu/seccomp.h line 19
Quoted 5 lines
include/sysemu/seccomp.h +2
-0@@ -15,8 +15,12 @@#ifndef QEMU_SECCOMP_H #define QEMU_SECCOMP_H +#define WHITELIST 0 +#define BLACKLIST 1Should these #defines be namespaced in some way, e.g.
SCMP_LIST_BLACKLIST?Quoted 7 lines
include/sysemu/seccomp.h +2
-1#include <seccomp.h> #include "qemu/osdep.h" -int seccomp_start (void ); +int seccomp_start (int list_type); +#endif
PATCH v3 2/3 seccomp: adding command line support for blacklist
In reply to Eduardo Otubov3: The options for blacklist in the command line also checkes the existence of "-netdev tap", leaving a warning message in a positive case.
New command line options for the seccomp blacklist feature:
$ qemu -sandbox on[,strict=<on|off>]
The strict parameter will turn on or off the new system call blacklist
--- qemu-options.hx | 8 +++++--- vl.c | 17 ++++++++++++++++- 2 files changed, 21 insertions(+), 4 deletions(-)
qemu-options.hx +5 -3
@@ -2978,13 +2978,15 @@ Old param mode (ARM only). ETEXI DEF("sandbox", HAS_ARG, QEMU_OPTION_sandbox, \ - "-sandbox <arg> Enable seccomp mode 2 system call filter (default 'off').\n", + "-sandbox <arg> Enable seccomp mode 2 system call filter (default 'off').\n" + "-sandbox on[,strict=<arg>]\n" + " Enable seccomp mode 2 system call second level filter (default 'off').\n", QEMU_ARCH_ALL) STEXI -@item -sandbox @var{arg} +@item -sandbox @var{arg}[,strict=@var{value}] @findex -sandbox Enable Seccomp mode 2 system call filter. 'on' will enable syscall filtering and 'off' will -disable it. The default is 'off'. +disable it. The default is 'off'. 'strict=on' will enable second level filter (default is 'off'). ETEXI DEF("readconfig", HAS_ARG, QEMU_OPTION_readconfig,
vl.c +16 -1
@@ -330,6 +330,9 @@ static QemuOptsList qemu_sandbox_opts = { { .name = "enable", .type = QEMU_OPT_BOOL, + },{ + .name = "strict", + .type = QEMU_OPT_STRING, }, {/* end of list */ } },
@@ -1032,6 +1035,7 @@ static int bt_parse(const char *opt)static int parse_sandbox (QemuOpts *opts,void *opaque) { +const char *strict_value =NULL ;/* FIXME: change this to true for 1.3 */ if (qemu_opt_get_bool (opts,"enable" , false)) {#ifdef CONFIG_SECCOMP
@@ -1040,6 +1044,17 @@ static int parse_sandbox(QemuOpts *opts, void *opaque) "failed to install seccomp syscall filter in the kernel"); return -1; } + + strict_value =qemu_opt_get (opts,"strict" ); + +if (!tap_enabled) +if (strict_value && !strcmp (strict_value,"on" )) { + enable_blacklist = true; + } + }else { +fprintf (stderr,"Warning: seccomp syscall second level filter \"-sandbox on,strict=on\" " +"cannot work together with \"-netdev tap\". Disabling it.\n" ); + }#else qerror_report (ERROR_CLASS_GENERIC_ERROR ,"sandboxing request but seccomp is not compiled into this build" );
@@ -1769,7 +1784,7 @@ void vm_state_notify(int running, RunState state)static void install_seccomp_blacklist (void ) { -if (enable_blacklist && !tap_enabled) { +if (enable_blacklist) {if (seccomp_start (BLACKLIST ) <0 ) {qerror_report (ERROR_CLASS_GENERIC_ERROR ,"failed to install seccomp syscall second level filter in the kernel" );
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PATCHv3 2/3] seccomp: adding command line support for blacklist
Quoted 62 lines · Eduardo Otubo
v3: The options for blacklist in the command line also checkes the existence of "-netdev tap", leaving a warning message in a positive case.
New command line options for the seccomp blacklist feature:
$ qemu -sandbox on[,strict=<on|off>]The strict parameter will turn on or off the new system call blacklist
Signed-off-by Eduardo Otubo <[email protected]>--- qemu-options.hx | 8 +++++--- vl.c | 17 ++++++++++++++++- 2 files changed, 21 insertions(+), 4 deletions(-)qemu-options.hx +5
-3@@ -2978,13 +2978,15 @@ Old param mode (ARM only). ETEXI DEF("sandbox", HAS_ARG, QEMU_OPTION_sandbox, \ - "-sandbox <arg> Enable seccomp mode 2 system call filter (default 'off').\n", + "-sandbox <arg> Enable seccomp mode 2 system call filter (default 'off').\n" + "-sandbox on[,strict=<arg>]\n" + " Enable seccomp mode 2 system call second level filter (default 'off').\n", QEMU_ARCH_ALL) STEXI -@item -sandbox @var{arg} +@item -sandbox @var{arg}[,strict=@var{value}] @findex -sandbox Enable Seccomp mode 2 system call filter. 'on' will enable syscall filtering and 'off' will -disable it. The default is 'off'. +disable it. The default is 'off'. 'strict=on' will enable second level filter (default is 'off'). ETEXI DEF("readconfig", HAS_ARG, QEMU_OPTION_readconfig,vl.c +4
-0@@ -330,6 +330,9 @@ static QemuOptsList qemu_sandbox_opts = { { .name = "enable", .type = QEMU_OPT_BOOL, + },{ + .name = "strict", + .type = QEMU_OPT_STRING, }, {/* end of list */ } },@@ -1032,6 +1035,7 @@ static int bt_parse(const char *opt)static int parse_sandbox (QemuOpts *opts,void *opaque) { +const char *strict_value =NULL ;/* FIXME: change this to true for 1.3 */ if (qemu_opt_get_bool (opts,"enable" , false)) {#ifdef CONFIG_SECCOMP
vl.c static int parse_sandbox(QemuOpts *opts, void *opaque) · line 1050
Quoted 7 lines
vl.c +4
-0@@ -1040,6 +1044,17 @@ static int parse_sandbox(QemuOpts *opts, void *opaque) "failed to install seccomp syscall filter in the kernel");return -1 ; } + + strict_value =qemu_opt_get (opts,"strict" ); + +if (!tap_enabled)
.------^
Just spotted tha I erased this open brace in one of my rebases.
Quoted 20 lines
vl.c +8
-1+if (strict_value && !strcmp (strict_value,"on" )) { + enable_blacklist = true; + } + }else { +fprintf (stderr,"Warning: seccomp syscall second level filter \"-sandbox on,strict=on\" " +"cannot work together with \"-netdev tap\". Disabling it.\n" ); + }#else qerror_report (ERROR_CLASS_GENERIC_ERROR ,"sandboxing request but seccomp is not compiled into this build" );@@ -1769,7 +1784,7 @@ void vm_state_notify(int running, RunState state)static void install_seccomp_blacklist (void ) { -if (enable_blacklist && !tap_enabled) { +if (enable_blacklist) {if (seccomp_start (BLACKLIST ) <0 ) {qerror_report (ERROR_CLASS_GENERIC_ERROR ,"failed to install seccomp syscall second level filter in the kernel" );
Signature · 2 lines
Eduardo Otubo IBM Linux Technology Center
PATCH v3 3/3 seccomp: general fixes
In reply to Eduardo Otubo 1) On qemu-seccomp.c:255, the variable ctx was being used
uninitialized; now it's initialized with NULL and it's being checked at the end of the function.
2) Changed the name of the command line option from "enable" to
"sandbox" for a better understanding from user side.
--- qemu-seccomp.c | 4 ++-- vl.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-)
qemu-seccomp.c +2 -2
@@ -258,7 +258,7 @@ seccomp_return:int seccomp_start (int list_type) {int rc =0 ; -scmp_filter_ctx ctx; +scmp_filter_ctx ctx =NULL ;switch (list_type) {case WHITELIST :
@@ -285,7 +285,7 @@ int seccomp_start(int list_type) rc =seccomp_load (ctx); - seccomp_return: +seccomp_return:if (ctx)seccomp_release (ctx);return rc;
vl.c +3 -3
@@ -324,11 +324,11 @@ static QemuOptsList qemu_rtc_opts = {static QemuOptsList qemu_sandbox_opts = { .name ="sandbox" , - .implied_opt_name ="enable" , + .implied_opt_name ="sandbox" , .head =QTAILQ_HEAD_INITIALIZER (qemu_sandbox_opts.head), .desc = { { - .name ="enable" , + .name ="sandbox" , .type =QEMU_OPT_BOOL , },{ .name ="strict" ,
@@ -1037,7 +1037,7 @@ static int parse_sandbox(QemuOpts *opts, void *opaque) {const char *strict_value =NULL ;/* FIXME: change this to true for 1.3 */ -if (qemu_opt_get_bool (opts,"enable" , false)) { +if (qemu_opt_get_bool (opts,"sandbox" , false)) {#ifdef CONFIG_SECCOMP if (seccomp_start (WHITELIST ) <0 ) { qerror_report(ERROR_CLASS_GENERIC_ERROR,
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PATCHv3 3/3] seccomp: general fixes
Quoted 27 lines · Eduardo Otubo
1) On qemu-seccomp.c:255, the variable ctx was being used
uninitialized; now it's initialized with NULL and it's being checked at the end of the function.2) Changed the name of the command line option from "enable" to
"sandbox" for a better understanding from user side.Signed-off-by Eduardo Otubo <[email protected]>--- qemu-seccomp.c | 4 ++-- vl.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-)qemu-seccomp.c +1
-1@@ -258,7 +258,7 @@ seccomp_return:int seccomp_start (int list_type) {int rc =0 ; -scmp_filter_ctx ctx; +scmp_filter_ctx ctx =NULL ;switch (list_type) {case WHITELIST :
qemu-seccomp.c int seccomp_start(int list_type) · line 291
Quoted 8 lines
qemu-seccomp.c +1
-1@@ -285,7 +285,7 @@ int seccomp_start(int list_type) rc =seccomp_load (ctx); - seccomp_return: +seccomp_return:if (ctx)seccomp_release (ctx);return rc;
Any particular reason these changes weren't folded into patch 1/3?
Signature · 2 lines
paul moore security and virtualization @ redhat