mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
libxl: add support for running bootloader in restricted mode
Much like the device model depriv mode, add the same kind of support for the bootloader. Such feature allows passing a UID as a parameter for the bootloader to run as, together with the bootloader itself taking the necessary actions to isolate. Note that the user to run the bootloader as must have the right permissions to access the guest disk image (in read mode only), and that the bootloader will be run in non-interactive mode when restricted. If enabled bootloader restrict mode will attempt to re-use the user(s) from the QEMU depriv implementation if no user is provided on the configuration file or the environment. See docs/features/qemu-deprivilege.pandoc for more information about how to setup those users. Bootloader restrict mode is not enabled by default as it requires certain setup to be done first (setup of the user(s) to use in restrict mode). This is part of XSA-443 / CVE-2023-34325 Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
This commit is contained in:
1 parent
e0342ae555
commit
1f762642d2
12 files changed
+203
-7
No files matched your search
@@ -57,6 +57,7 @@ int max_grant_frames = -1;
|
||||
int max_maptrack_frames = -1;
|
||||
int max_grant_version = LIBXL_MAX_GRANT_DEFAULT;
|
||||
libxl_domid domid_policy = INVALID_DOMID;
|
||||
libxl_defbool bootloader_restrict;
|
||||
|
||||
xentoollog_level minmsglevel = minmsglevel_default;
|
||||
|
||||
@@ -253,6 +254,9 @@ static void parse_global_config(const char *configfile,
|
||||
fprintf(stderr, "invalid domid_policy option");
|
||||
}
|
||||
|
||||
xlu_cfg_get_defbool(config, "bootloader_restrict",
|
||||
&bootloader_restrict, 0);
|
||||
|
||||
xlu_cfg_destroy(config);
|
||||
}
|
||||
|
||||
|
||||
@@ -288,6 +288,7 @@ extern libxl_bitmap global_vm_affinity_mask;
|
||||
extern libxl_bitmap global_hvm_affinity_mask;
|
||||
extern libxl_bitmap global_pv_affinity_mask;
|
||||
extern libxl_domid domid_policy;
|
||||
extern libxl_defbool bootloader_restrict;
|
||||
|
||||
enum output_format {
|
||||
OUTPUT_FORMAT_JSON,
|
||||
|
||||
@@ -1700,6 +1700,13 @@ void parse_config_data(const char *config_source,
|
||||
exit(-ERROR_FAIL);
|
||||
}
|
||||
#endif
|
||||
xlu_cfg_get_defbool(config, "bootloader_restrict",
|
||||
&b_info->bootloader_restrict, 0);
|
||||
if (!libxl_defbool_is_default(bootloader_restrict))
|
||||
libxl_defbool_setdefault(&b_info->bootloader_restrict,
|
||||
libxl_defbool_val(bootloader_restrict));
|
||||
xlu_cfg_replace_string(config, "bootloader_user",
|
||||
&b_info->bootloader_user, 0);
|
||||
|
||||
switch (xlu_cfg_get_list_as_string_list(config, "bootloader_args",
|
||||
&b_info->bootloader_args, 1)) {
|
||||
|
||||