mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
libxl: set XEN_QEMU_CONSOLE_LIMIT for QEMU
XSA-180 provides a patch to QEMU to bodge QEMU logging issue. We
explicitly set the limit in libxl for 4.7.
Introduce a function for setting the environment variable and call it in
the right places.
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Release-acked-by: Wei Liu <wei.liu2@citrix.com>
(cherry picked from commit b0d409d9c4)
This commit is contained in:
1 parent
8b7a356409
commit
fe82a96a65
1 file changed
+26
-3
+26
-3
@@ -363,6 +363,20 @@ int libxl__domain_device_construct_rdm(libxl__gc *gc,
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
/* XSA-180 / CVE-2014-3672
|
||||
*
|
||||
* The QEMU shipped with Xen has a bodge. It checks for
|
||||
* XEN_QEMU_CONSOLE_LIMIT to see how much data QEMU is allowed
|
||||
* to write to stderr. We set that to 1MB if it is not set by
|
||||
* system administrator.
|
||||
*/
|
||||
static void libxl__set_qemu_env_for_xsa_180(libxl__gc *gc,
|
||||
flexarray_t *dm_envs)
|
||||
{
|
||||
if (getenv("XEN_QEMU_CONSOLE_LIMIT")) return;
|
||||
flexarray_append_pair(dm_envs, "XEN_QEMU_CONSOLE_LIMIT", "1048576");
|
||||
}
|
||||
|
||||
const libxl_vnc_info *libxl__dm_vnc(const libxl_domain_config *guest_config)
|
||||
{
|
||||
const libxl_vnc_info *vnc = NULL;
|
||||
@@ -413,6 +427,8 @@ static int libxl__build_device_model_args_old(libxl__gc *gc,
|
||||
dm_args = flexarray_make(gc, 16, 1);
|
||||
dm_envs = flexarray_make(gc, 16, 1);
|
||||
|
||||
libxl__set_qemu_env_for_xsa_180(gc, dm_envs);
|
||||
|
||||
flexarray_vappend(dm_args, dm,
|
||||
"-d", libxl__sprintf(gc, "%d", domid), NULL);
|
||||
|
||||
@@ -726,6 +742,8 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
|
||||
dm_args = flexarray_make(gc, 16, 1);
|
||||
dm_envs = flexarray_make(gc, 16, 1);
|
||||
|
||||
libxl__set_qemu_env_for_xsa_180(gc, dm_envs);
|
||||
|
||||
flexarray_vappend(dm_args, dm,
|
||||
"-xen-domid",
|
||||
libxl__sprintf(gc, "%d", guest_domid), NULL);
|
||||
@@ -1872,8 +1890,8 @@ static void device_model_spawn_outcome(libxl__egc *egc,
|
||||
void libxl__spawn_qdisk_backend(libxl__egc *egc, libxl__dm_spawn_state *dmss)
|
||||
{
|
||||
STATE_AO_GC(dmss->spawn.ao);
|
||||
flexarray_t *dm_args;
|
||||
char **args;
|
||||
flexarray_t *dm_args, *dm_envs;
|
||||
char **args, **envs;
|
||||
const char *dm;
|
||||
int logfile_w, null = -1, rc;
|
||||
uint32_t domid = dmss->guest_domid;
|
||||
@@ -1882,6 +1900,8 @@ void libxl__spawn_qdisk_backend(libxl__egc *egc, libxl__dm_spawn_state *dmss)
|
||||
dm = qemu_xen_path(gc);
|
||||
|
||||
dm_args = flexarray_make(gc, 15, 1);
|
||||
dm_envs = flexarray_make(gc, 1, 1);
|
||||
|
||||
flexarray_vappend(dm_args, dm, "-xen-domid",
|
||||
GCSPRINTF("%d", domid), NULL);
|
||||
flexarray_append(dm_args, "-xen-attach");
|
||||
@@ -1895,6 +1915,9 @@ void libxl__spawn_qdisk_backend(libxl__egc *egc, libxl__dm_spawn_state *dmss)
|
||||
flexarray_append(dm_args, NULL);
|
||||
args = (char **) flexarray_contents(dm_args);
|
||||
|
||||
libxl__set_qemu_env_for_xsa_180(gc, dm_envs);
|
||||
envs = (char **) flexarray_contents(dm_envs);
|
||||
|
||||
logfile_w = libxl__create_qemu_logfile(gc, GCSPRINTF("qdisk-%u", domid));
|
||||
if (logfile_w < 0) {
|
||||
rc = logfile_w;
|
||||
@@ -1932,7 +1955,7 @@ void libxl__spawn_qdisk_backend(libxl__egc *egc, libxl__dm_spawn_state *dmss)
|
||||
goto error;
|
||||
if (!rc) { /* inner child */
|
||||
setsid();
|
||||
libxl__exec(gc, null, logfile_w, logfile_w, dm, args, NULL);
|
||||
libxl__exec(gc, null, logfile_w, logfile_w, dm, args, envs);
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||