libxl: Move dm user determination logic into a helper function
PATCH v3 1/11 libxl: Move dm user determination logic into a helper function
To reliably kill an untrusted devicemodel, we need to know not only its pid, but its uid. In preparation for this, move the userid determination logic into a helper function.
Create a new field, dm_runas, in libxl__domain_build_state to store the value during domain creation.
This change also removes unnecessary duplication of the argument construction code.
While here, clean up some minor CODING_STYLE infractions (space between * and variable name).
No functional change intended.
While here, delete some trailing whitespace.
---
v2:
- Remove unnecessary space between * and dm_runas
- Additional code clean-up
- Delete trailing whitespace
--- tools/libxl/libxl_dm.c | 260 +++++++++++++++++++---------------- tools/libxl/libxl_internal.h | 22 +-- 2 files changed, 151 insertions(+), 131 deletions(-)
tools/libxl/libxl_dm.c +139 -121
@@ -65,6 +65,131 @@ static int libxl__create_qemu_logfile(libxl__gc *gc, char *name)return logfile_w; } +/* +* userlookup_helper_getpwnam(libxl__gc*, const char *user, +* struct passwd **pwd_r); +* +* userlookup_helper_getpwuid(libxl__gc*, uid_t uid, +* struct passwd **pwd_r); +* +* returns 1 if the user was found, 0 if it was not, -1 on error +*/ +#define DEFINE_USERLOOKUP_HELPER (NAME ,SPEC_TYPE ,STRUCTNAME ,SYSCONF ) \ + static int userlookup_helper_##NAME(libxl__gc *gc, \ + SPEC_TYPE spec, \ + struct STRUCTNAME *resultbuf, \ + struct STRUCTNAME **out) \ + { \ + struct STRUCTNAME *resultp = NULL; \ + char *buf = NULL; \ + long buf_size; \ + int ret; \ + \ + buf_size = sysconf(SYSCONF); \ + if (buf_size < 0) { \ + buf_size = 2048; \ + LOG(DEBUG, \ + "sysconf failed, setting the initial buffer size to %ld", \ + buf_size); \ + } \ + \ + while (1) { \ + buf = libxl__realloc(gc, buf, buf_size); \ + ret = NAME##_r(spec, resultbuf, buf, buf_size, &resultp); \ + if (ret == ERANGE) { \ + buf_size += 128; \ + continue; \ + } \ + if (ret != 0) \ + return ERROR_FAIL; \ + if (resultp != NULL) { \ + if (out) *out = resultp; \ + return 1; \ + } \ + return 0; \ + } \ + } + +DEFINE_USERLOOKUP_HELPER(getpwnam, const char*, passwd, _SC_GETPW_R_SIZE_MAX); +DEFINE_USERLOOKUP_HELPER (getpwuid, uid_t, passwd, _SC_GETPW_R_SIZE_MAX); + +static int libxl__domain_get_device_model_uid (libxl__gc *gc, +libxl__dm_spawn_state *dmss) +{ +int guest_domid = dmss->guest_domid; +libxl__domain_build_state *const state = dmss->build_state; +const libxl_domain_build_info *b_info = &dmss->guest_config->b_info; + +struct passwd *user_base, user_pwbuf; +int ret; +char *user; + +/* Only qemu-upstream can run as a different uid */ +if (b_info->device_model_version !=LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN ) +return 0 ; + + user = b_info->device_model_user; +if (user) + goto end_search; + +if (!libxl_defbool_val (b_info->dm_restrict)) { +LOGD (DEBUG , guest_domid, +"dm_restrict disabled, starting QEMU as root" ); +return 0 ; + } + + user =GCSPRINTF ("%s%d" ,LIBXL_QEMU_USER_BASE , guest_domid); + ret =userlookup_helper_getpwnam (gc, user, &user_pwbuf,0 ); +if (ret <0 ) +return ret; +if (ret >0 ) + goto end_search; + + ret =userlookup_helper_getpwnam (gc,LIBXL_QEMU_USER_RANGE_BASE , + &user_pwbuf, &user_base); +if (ret <0 ) +return ret; +if (ret >0 ) { +struct passwd *user_clash, user_clash_pwbuf; +uid_t intended_uid = user_base->pw_uid + guest_domid; + ret =userlookup_helper_getpwuid (gc, intended_uid, + &user_clash_pwbuf, &user_clash); +if (ret <0 ) +return ret; +if (ret >0 ) { +LOGD (ERROR , guest_domid, +"wanted to use uid %ld (%s + %d) but that is user %s !" , + (long )intended_uid,LIBXL_QEMU_USER_RANGE_BASE , + guest_domid, user_clash->pw_name); +return ERROR_FAIL ; + } +LOGD (DEBUG , guest_domid,"using uid %ld" , (long )intended_uid); + user =GCSPRINTF ("%ld:%ld" , (long )intended_uid, + (long )user_base->pw_gid); + goto end_search; + } + + user =LIBXL_QEMU_USER_SHARED ; + ret =userlookup_helper_getpwnam (gc, user, &user_pwbuf,0 ); +if (ret <0 ) +return ret; +if (ret >0 ) { +LOGD (WARN , guest_domid,"Could not find user %s%d, falling back to %s" , +LIBXL_QEMU_USER_BASE , guest_domid,LIBXL_QEMU_USER_SHARED ); + goto end_search; + } + +LOGD (ERROR , guest_domid, +"Could not find user %s%d or %s or range base pseudo-user %s, cannot restrict" , +LIBXL_QEMU_USER_BASE , guest_domid,LIBXL_QEMU_USER_SHARED , +LIBXL_QEMU_USER_RANGE_BASE ); +return ERROR_INVAL ; + +end_search: + state->dm_runas = user; +return 0 ; +} +const char *libxl__domain_device_model (libxl__gc *gc,const libxl_domain_build_info *info) {
@@ -737,54 +862,6 @@ libxl__detect_gfx_passthru_kind(libxl__gc *gc,return LIBXL_GFX_PASSTHRU_KIND_DEFAULT ; } -/* -* userlookup_helper_getpwnam(libxl__gc*, const char *user, -* struct passwd **pwd_r); -* -* userlookup_helper_getpwuid(libxl__gc*, uid_t uid, -* struct passwd **pwd_r); -* -* returns 1 if the user was found, 0 if it was not, -1 on error -*/ -#define DEFINE_USERLOOKUP_HELPER (NAME ,SPEC_TYPE ,STRUCTNAME ,SYSCONF ) \ - static int userlookup_helper_##NAME(libxl__gc *gc, \ - SPEC_TYPE spec, \ - struct STRUCTNAME *resultbuf, \ - struct STRUCTNAME **out) \ - { \ - struct STRUCTNAME *resultp = NULL; \ - char *buf = NULL; \ - long buf_size; \ - int ret; \ - \ - buf_size = sysconf(SYSCONF); \ - if (buf_size < 0) { \ - buf_size = 2048; \ - LOG(DEBUG, \ - "sysconf failed, setting the initial buffer size to %ld", \ - buf_size); \ - } \ - \ - while (1) { \ - buf = libxl__realloc(gc, buf, buf_size); \ - ret = NAME##_r(spec, resultbuf, buf, buf_size, &resultp); \ - if (ret == ERANGE) { \ - buf_size += 128; \ - continue; \ - } \ - if (ret != 0) \ - return ERROR_FAIL; \ - if (resultp != NULL) { \ - if (out) *out = resultp; \ - return 1; \ - } \ - return 0; \ - } \ - } - -DEFINE_USERLOOKUP_HELPER(getpwnam, const char*, passwd, _SC_GETPW_R_SIZE_MAX); -DEFINE_USERLOOKUP_HELPER (getpwuid, uid_t, passwd, _SC_GETPW_R_SIZE_MAX); -/* colo mode */ enum {LIBXL__COLO_NONE =0 ,
@@ -928,11 +1005,9 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,const char *keymap =dm_keymap (guest_config);char *machinearg;flexarray_t *dm_args, *dm_envs; -int i, connection, devid, ret; +int i, connection, devid;uint64_t ram_size;const char *path, *chardev; -char *user =NULL ; -struct passwd *user_base, user_pwbuf; dm_args =flexarray_make (gc,16 ,1 ); dm_envs =flexarray_make (gc,16 ,1 );
@@ -1414,10 +1489,10 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,char *chroot_dir =GCSPRINTF ("%s/qemu-root-%d" ,libxl__run_dir_path (), guest_domid);int r; - +flexarray_append (dm_args,"-xen-domid-restrict" ); -/* +/* * Run QEMU in a chroot at XEN_RUN_DIR/qemu-root-<domid> * * There is no library function to do the equivalent of `rm
@@ -1425,7 +1500,7 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,* able to write any files, as the chroot would be owned by * root, but it would be running as an unprivileged process. * So in theory, old chroots should always be empty. -* +* * rmdir the directory before attempting to create * it; if it returns anything other than ENOENT, fail domain * creation.
@@ -1436,7 +1511,7 @@ static int libxl__build_device_model_args_new(libxl__gc *gc, "failed to remove existing chroot dir %s", chroot_dir);return ERROR_FAIL ; } - +for (;;) { r =mkdir (chroot_dir,0000 );if (!r)
@@ -1538,7 +1613,7 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,continue ; } -/* +/* * If qemu isn't doing the interpreting, the parameter is * always raw */
@@ -1563,7 +1638,7 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,continue ; } -/* +/* * We can't call libxl__blktap_devpath from * libxl__device_disk_find_local_path for now because * the bootloader is called before the disks are set
@@ -1685,71 +1760,9 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,break ; } -if (b_info->device_model_user) { - user = b_info->device_model_user; - goto end_search; - } - -if (!libxl_defbool_val (b_info->dm_restrict)) { -LOGD (DEBUG , guest_domid, -"dm_restrict disabled, starting QEMU as root" ); - goto end_search; - } - - user =GCSPRINTF ("%s%d" ,LIBXL_QEMU_USER_BASE , guest_domid); - ret =userlookup_helper_getpwnam (gc, user, &user_pwbuf,0 ); -if (ret <0 ) -return ret; -if (ret >0 ) - goto end_search; - - ret =userlookup_helper_getpwnam (gc,LIBXL_QEMU_USER_RANGE_BASE , - &user_pwbuf, &user_base); -if (ret <0 ) -return ret; -if (ret >0 ) { -struct passwd *user_clash, user_clash_pwbuf; -uid_t intended_uid = user_base->pw_uid + guest_domid; - ret =userlookup_helper_getpwuid (gc, intended_uid, - &user_clash_pwbuf, &user_clash); -if (ret <0 ) -return ret; -if (ret >0 ) { -LOGD (ERROR , guest_domid, -"wanted to use uid %ld (%s + %d) but that is user %s !" , - (long )intended_uid,LIBXL_QEMU_USER_RANGE_BASE , - guest_domid, user_clash->pw_name); -return ERROR_FAIL ; - } -LOGD (DEBUG , guest_domid,"using uid %ld" , (long )intended_uid); +if (state->dm_runas &&strcmp (state->dm_runas,"root" )) {flexarray_append (dm_args,"-runas" ); -flexarray_append (dm_args, -GCSPRINTF ("%ld:%ld" , (long )intended_uid, - (long )user_base->pw_gid)); - user =NULL ;/* we have taken care of it */ - goto end_search; - } - - user =LIBXL_QEMU_USER_SHARED ; - ret =userlookup_helper_getpwnam (gc, user, &user_pwbuf,0 ); -if (ret <0 ) -return ret; -if (ret >0 ) { -LOGD (WARN , guest_domid,"Could not find user %s%d, falling back to %s" , -LIBXL_QEMU_USER_BASE , guest_domid,LIBXL_QEMU_USER_SHARED ); - goto end_search; - } - -LOGD (ERROR , guest_domid, -"Could not find user %s%d or %s or range base pseudo-user %s, cannot restrict" , -LIBXL_QEMU_USER_BASE , guest_domid,LIBXL_QEMU_USER_SHARED , -LIBXL_QEMU_USER_RANGE_BASE ); -return ERROR_INVAL ; - -end_search: -if (user !=NULL &&strcmp (user,"root" )) { -flexarray_append (dm_args,"-runas" ); -flexarray_append (dm_args, user); +flexarray_append (dm_args, state->dm_runas); } }flexarray_append (dm_args,NULL );
@@ -2303,6 +2316,11 @@ void libxl__spawn_local_dm(libxl__egc *egc, libxl__dm_spawn_state *dmss) rc =ERROR_FAIL ; goto out; } + + rc =libxl__domain_get_device_model_uid (gc, dmss); +if (rc) + goto out; + rc =libxl__build_device_model_args (gc, dm, domid, guest_config, &args, &envs, state, &dm_state_fd);
tools/libxl/libxl_internal.h +12 -10
@@ -332,7 +332,7 @@ struct libxl__ev_evtchn {typedef struct libxl__ev_watch_slot {LIBXL_SLIST_ENTRY (struct libxl__ev_watch_slot ) empty; }libxl__ev_watch_slot ; - + _hidden libxl__ev_xswatch *libxl__watch_slot_contents(libxl__gc *gc,int slotnum);
@@ -484,7 +484,7 @@ struct libxl__ctx { death_list/* sorted by domid */ , death_reported;libxl__ev_xswatch death_watch; - + LIBXL_LIST_HEAD(, libxl_evgen_disk_eject) disk_eject_evgens;const libxl_childproc_hooks *childproc_hooks;
@@ -1131,9 +1131,11 @@ typedef struct {libxl__file_reference pv_kernel;libxl__file_reference pv_ramdisk; -const char * shim_path; -const char * shim_cmdline; -const char * pv_cmdline; +const char *shim_path; +const char *shim_cmdline; +const char *pv_cmdline; + +char *dm_runas;xen_vmemrange_t *vmemranges;uint32_t num_vmemranges;
@@ -1471,7 +1473,7 @@ _hidden void libxl__spawn_init(libxl__spawn_state*);* * what: string describing the spawned process, used for logging * -* Logs errors. A copy of "what" is taken. +* Logs errors. A copy of "what" is taken. * Return values: * < 0 error, *spawn is now Idle and need not be detached * +1 caller is the parent, *spawn is Attached and must be detached
@@ -2750,10 +2752,10 @@ static inline void libxl__device_disk_local_init(libxl__disk_local_state *dls) dls->rc =0 ; } -/* +/* * See if we can find a way to access a disk locally */ -_hidden char * libxl__device_disk_find_local_path(libxl__gc *gc, +_hidden char * libxl__device_disk_find_local_path(libxl__gc *gc,libxl_domid guest_domid,const libxl_device_disk *disk,bool qdisk_direct);
@@ -3774,7 +3776,7 @@ struct libxl__dm_spawn_state { _hidden void libxl__spawn_local_dm(libxl__egc *egc, libxl__dm_spawn_state*); -/* +/* * Called after forking but before executing the local devicemodel. */ _hidden int libxl__local_dm_preexec_restrict(libxl__gc *gc);
@@ -3963,7 +3965,7 @@ _hidden void libxl__remus_restore_setup(libxl__egc *egc,*/ #define GCNEW_ARRAY (var, nmemb) \ ((var) = libxl__calloc((gc), (nmemb), sizeof(*(var)))) - +/* * Expression statement <type> *GCREALLOC_ARRAY(<type> *var, size_t nmemb); * Uses libxl__gc *gc;
Signature · 7 lines
2.19.2 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v3 2/11 libxl: Get rid of support for QEMU_USER_BASE (xen-qemuuser-domidNN)
QEMU_USER_BASE allows a user to specify the UID to use when running the devicemodel for a specific domain number. Unfortunately, this is not really practical: It requires nearly 32,000 entries in /etc/passwd. QEMU_USER_RANGE_BASE is much more practical.
Remove support for QEMU_USER_BASE.
---
NB that I've chosen not to update the xl.cfg man page at this time; it needs a lot of other updates as well, which would be easier to do all at once at the end.
--- tools/libxl/libxl_dm.c | 16 ++++------------ tools/libxl/libxl_internal.h | 1 - 2 files changed, 4 insertions(+), 13 deletions(-)
tools/libxl/libxl_dm.c +4 -12
@@ -138,13 +138,6 @@ static int libxl__domain_get_device_model_uid(libxl__gc *gc,return 0 ; } - user =GCSPRINTF ("%s%d" ,LIBXL_QEMU_USER_BASE , guest_domid); - ret =userlookup_helper_getpwnam (gc, user, &user_pwbuf,0 ); -if (ret <0 ) -return ret; -if (ret >0 ) - goto end_search; - ret =userlookup_helper_getpwnam (gc,LIBXL_QEMU_USER_RANGE_BASE , &user_pwbuf, &user_base);if (ret <0 )
@@ -174,15 +167,14 @@ static int libxl__domain_get_device_model_uid(libxl__gc *gc,if (ret <0 )return ret;if (ret >0 ) { -LOGD (WARN , guest_domid,"Could not find user %s%d, falling back to %s" , -LIBXL_QEMU_USER_BASE , guest_domid,LIBXL_QEMU_USER_SHARED ); +LOGD (WARN , guest_domid,"Could not find user %s, falling back to %s" , +LIBXL_QEMU_USER_RANGE_BASE ,LIBXL_QEMU_USER_SHARED ); goto end_search; }LOGD (ERROR , guest_domid, -"Could not find user %s%d or %s or range base pseudo-user %s, cannot restrict" , -LIBXL_QEMU_USER_BASE , guest_domid,LIBXL_QEMU_USER_SHARED , -LIBXL_QEMU_USER_RANGE_BASE ); +"Could not find user %s or range base pseudo-user %s, cannot restrict" , +LIBXL_QEMU_USER_SHARED ,LIBXL_QEMU_USER_RANGE_BASE );return ERROR_INVAL ; end_search:
tools/libxl/libxl_internal.h +0 -1
@@ -4387,7 +4387,6 @@ _hidden int libxl__read_sysfs_file_contents(libxl__gc *gc, int *datalen_r);#define LIBXL_QEMU_USER_PREFIX "xen-qemuuser" -#define LIBXL_QEMU_USER_BASE LIBXL_QEMU_USER_PREFIX"-domid"#define LIBXL_QEMU_USER_SHARED LIBXL_QEMU_USER_PREFIX"-shared"#define LIBXL_QEMU_USER_RANGE_BASE LIBXL_QEMU_USER_PREFIX"-range-base"
Signature · 7 lines
2.19.2 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v3 3/11 libxl: Clean up userlookup_helper_getpw* helper
In reply to George DunlapBring conventions more in line with libxl__xs_read_checked():
- If found, return 0 and set pointer to non-NULL
- If not found, return 0 and set pointer to NULL
- On error, return libxl-style error number.
Update documentation to match.
Use CODING_STYLE compliant r rather than ret.
On error, log the error code before returning instead of discarding it.
Now that it only returns 0 or errno, update caller error checks to be if (ret) rather than if (ret < 0).
---
v3:
- Used more idiomatic if (ret) rather than if (ret < 0)
--- tools/libxl/libxl_dm.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-)
tools/libxl/libxl_dm.c +20 -15
@@ -72,7 +72,13 @@ static int libxl__create_qemu_logfile(libxl__gc *gc, char *name)* userlookup_helper_getpwuid(libxl__gc*, uid_t uid, * struct passwd **pwd_r); * -* returns 1 if the user was found, 0 if it was not, -1 on error +* If the user is found, return 0 and set *pwd_r to the appropriat +* value. +* +* If the user is not found but there are no errors, return 0 +* and set *pwd_r to NULL. +* +* On error, return a libxl-style error code. */ #define DEFINE_USERLOOKUP_HELPER (NAME ,SPEC_TYPE ,STRUCTNAME ,SYSCONF ) \ static int userlookup_helper_##NAME(libxl__gc *gc, \
@@ -83,7 +89,7 @@ static int libxl__create_qemu_logfile(libxl__gc *gc, char *name)struct STRUCTNAME *resultp =NULL ; \char *buf =NULL ; \long buf_size; \ -int ret; \ +int r; \ \ buf_size =sysconf (SYSCONF ); \if (buf_size <0 ) { \
@@ -95,17 +101,16 @@ static int libxl__create_qemu_logfile(libxl__gc *gc, char *name) \while (1 ) { \ buf =libxl__realloc (gc, buf, buf_size); \ - ret = NAME##_r(spec, resultbuf, buf, buf_size, &resultp); \ -if (ret ==ERANGE ) { \ + r = NAME##_r(spec, resultbuf, buf, buf_size, &resultp); \ +if (r ==ERANGE ) { \ buf_size +=128 ; \continue ; \ } \ -if (ret !=0 ) \ +if (r !=0 ) { \ + LOGEV(ERROR, r, "Looking up username/uid with " #NAME); \return ERROR_FAIL ; \ -if (resultp !=NULL ) { \ -if (out) *out = resultp; \ -return 1 ; \ } \ + *out = resultp; \return 0 ; \ } \ }
@@ -140,16 +145,16 @@ static int libxl__domain_get_device_model_uid(libxl__gc *gc, ret =userlookup_helper_getpwnam (gc,LIBXL_QEMU_USER_RANGE_BASE , &user_pwbuf, &user_base); -if (ret <0 ) +if (ret)return ret; -if (ret >0 ) { +if (user_base) {struct passwd *user_clash, user_clash_pwbuf;uid_t intended_uid = user_base->pw_uid + guest_domid; ret =userlookup_helper_getpwuid (gc, intended_uid, &user_clash_pwbuf, &user_clash); -if (ret <0 ) +if (ret)return ret; -if (ret >0 ) { +if (user_clash) { LOGD(ERROR, guest_domid, "wanted to use uid %ld (%s + %d) but that is user %s !", (long)intended_uid, LIBXL_QEMU_USER_RANGE_BASE,
@@ -163,10 +168,10 @@ static int libxl__domain_get_device_model_uid(libxl__gc *gc, } user =LIBXL_QEMU_USER_SHARED ; - ret =userlookup_helper_getpwnam (gc, user, &user_pwbuf,0 ); -if (ret <0 ) + ret =userlookup_helper_getpwnam (gc, user, &user_pwbuf, &user_base); +if (ret)return ret; -if (ret >0 ) { +if (user_base) {LOGD (WARN , guest_domid,"Could not find user %s, falling back to %s" ,LIBXL_QEMU_USER_RANGE_BASE ,LIBXL_QEMU_USER_SHARED ); goto end_search;
Signature · 7 lines
2.19.2 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v3 4/11 dm_depriv: Describe expected usage of device_model_user parameter
In reply to George DunlapA number of subsequent patches rely on as-yet undefined behavior for what the device_model_user parameter does. Rather than implement it incorrectly (or randomly), or remove the feature, describe an expected usage for the feature. Further patches will make decisions based on this expected usage.
---
v3:
- Fix a minor typo
v2:
- Remove stale comment about device_model_user not being ready
RFC: As we'll see in a later patch, this implementation is still
incomplete: we need a reaper uid from which to kill uids.
--- docs/features/qemu-deprivilege.pandoc | 17 +++++++++++++++++ tools/libxl/libxl_types.idl | 1 - 2 files changed, 17 insertions(+), 1 deletion(-)
docs/features/qemu-deprivilege.pandoc +17 -0
@@ -66,6 +66,23 @@ this, create a user named `xen-qemuuser-shared`; for example: adduser --no-create-home --system xen-qemuuser-shared +A final way to set up a separate process for qemus is to allocate one +UID per VM, and set the UID in the domain config file with the +`device_model_user` argument. For example, suppose you have a VM +named `c6-01`. You might do the following: + + adduser --system --no-create-home --group xen-qemuuser-c6-01 + +And then in your config file, the following line: + + device_model_user="xen-qemuuser-c6-01" + +NOTE: It is important when using `device_model_user` that EACH VM HAVE +A SEPARATE UID, and that none of these UIDs map to root. xl will +throw an error a uid maps to zero, but not if multiple VMs have the +same uid. Multiple VMs with the same device model uid will cause +problems. + ## Domain config changes The core domain config change is to add the following line to the
tools/libxl/libxl_types.idl +0 -1
@@ -495,7 +495,6 @@ libxl_domain_build_info = Struct("domain_build_info",[ ("device_model", string), ("device_model_ssidref", uint32), ("device_model_ssid_label", string), - # device_model_user is not ready for use yet ("device_model_user", string), # extra parameters pass directly to qemu, NULL terminated
Signature · 7 lines
2.19.2 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v3 5/11 libxl: Do root checks once in libxl__domain_get_device_model_uid
In reply to George DunlapAt the moment, we check for equivalence to literal "root" before deciding whether to add the runas command-line option to QEMU. This is unsatisfactory for several reasons.
First, just because the string doesn't match "root" doesn't mean the final uid won't end up being zero; in particular, the range_base calculations may end up producing "0:NNN", which would be root in any case.
Secondly, it's almost certainly a configuration error if the resulting uid ends up to be zero; rather than silently do what was specified but probably not intended, throw an error.
To fix this, check for root once in libxl__domain_get_device_model_uid. If the result is root, return an error; if appropriate, set runas.
After that, assume that the presence of state->dm_runas implies that a runas argument should be constructed.
One side effect of this is to check whether device_model_user exists before passing it to qemu, resulting in better error reporting.
While we're here:
- Refactor the function to use the "goto out" idiom
- Use 'rc' rather than 'ret', in line with CODING_STYLE
---
Let the record show that I personally think the goto out pattern here would be improved by having a "root check" label.
v3:
- Update to use more idiomatic if (rc)
- Make "inputs" to goto more clear
- Initialize intended_uid to -1 sentinel
- Document expectations when jumping to 'out'
- Don't return directly after non-trivial initial checks
- Always explicitly set rc to 0 when jumping to out, even if we just checked that it was zero a few lines earlier
- Work around one-goto limitation by having multiple 'rc' checks.
- Return generic ERROR_INVAL rather than in accurate ERROR_DEVICE_EXISTS
v2:
- Refactor to use out rather than multiple labels
- Only check for root once
- Use 'out' rather than direct returns for errors (only use direct returns for early succeed-without-setting-runas paths)
- Use rc rather than ret to more closely align with CODING_STYLE
- Fill out comments about the cases we're handling
- Return ERROR_DEVICE_EXISTS rather than ERROR_FAIL if there's another username that maps to our calculated uid
- Report an error if the specified device_model_user doesn't exist
--- tools/libxl/libxl_dm.c | 107 ++++++++++++++++++++++++++++++++--------- 1 file changed, 85 insertions(+), 22 deletions(-)
tools/libxl/libxl_dm.c +85 -22
@@ -126,65 +126,128 @@ static int libxl__domain_get_device_model_uid(libxl__gc *gc,const libxl_domain_build_info *b_info = &dmss->guest_config->b_info;struct passwd *user_base, user_pwbuf; -int ret; +int rc;char *user; +uid_t intended_uid =-1 ;/* Only qemu-upstream can run as a different uid */ if (b_info->device_model_version !=LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN )return 0 ; +/* +* From this point onward, all paths should go through the `out` +* label. The invariants should be: +* - rc may be 0, or an error code. +* - if rc is an error code, user and intended_uid are ignored. +* - if rc is 0, user may be set or not set. +* - if user is set, then intended_uid must be set to a UID matching +* the username `user`. This will be checked for root (0). +*/ + +/* +* If device_model_user is present, set `-runas` even if +* dm_restrict isn't in use +*/ user = b_info->device_model_user; -if (user) - goto end_search; +if (user) { + rc =userlookup_helper_getpwnam (gc, user, &user_pwbuf, &user_base); +if (rc) + goto out; + +if (!user_base) { +LOGD (ERROR , guest_domid,"Couldn't find device_model_user %s" , + user); + rc =ERROR_INVAL ; + goto out; + } + + intended_uid = user_base->pw_uid; + rc =0 ; + goto out; + } +/* +* If dm_restrict isn't set, and we don't have a specified user, don't +* bother setting a `-runas` parameter. +*/ if (!libxl_defbool_val (b_info->dm_restrict)) {LOGD (DEBUG , guest_domid,"dm_restrict disabled, starting QEMU as root" ); -return 0 ; + user =NULL ;/* Should already be null, but just in case */ + goto out; } - ret =userlookup_helper_getpwnam (gc,LIBXL_QEMU_USER_RANGE_BASE , +/* +* dm_restrict is set, but device_model_user isn't set; look for +* QEMU_USER_BASE_RANGE +*/ + rc =userlookup_helper_getpwnam (gc,LIBXL_QEMU_USER_RANGE_BASE , &user_pwbuf, &user_base); -if (ret) -return ret; +if (rc) + goto out;if (user_base) {struct passwd *user_clash, user_clash_pwbuf; -uid_t intended_uid = user_base->pw_uid + guest_domid; - ret =userlookup_helper_getpwuid (gc, intended_uid, + + intended_uid = user_base->pw_uid + guest_domid; + rc =userlookup_helper_getpwuid (gc, intended_uid, &user_clash_pwbuf, &user_clash); -if (ret) -return ret; +if (rc) + goto out;if (user_clash) {LOGD (ERROR , guest_domid,"wanted to use uid %ld (%s + %d) but that is user %s !" , (long )intended_uid,LIBXL_QEMU_USER_RANGE_BASE , guest_domid, user_clash->pw_name); -return ERROR_FAIL ; + rc =ERROR_INVAL ; + goto out; } +LOGD (DEBUG , guest_domid,"using uid %ld" , (long )intended_uid); user =GCSPRINTF ("%ld:%ld" , (long )intended_uid, (long )user_base->pw_gid); - goto end_search; + rc =0 ; + goto out; } +/* +* We couldn't find QEMU_USER_BASE_RANGE; look for QEMU_USER_SHARED +*/ user =LIBXL_QEMU_USER_SHARED ; - ret =userlookup_helper_getpwnam (gc, user, &user_pwbuf, &user_base); -if (ret) -return ret; + rc =userlookup_helper_getpwnam (gc, user, &user_pwbuf, &user_base); +if (rc) + goto out;if (user_base) {LOGD (WARN , guest_domid,"Could not find user %s, falling back to %s" ,LIBXL_QEMU_USER_RANGE_BASE ,LIBXL_QEMU_USER_SHARED ); - goto end_search; + intended_uid = user_base->pw_uid; + rc =0 ; + goto out; } +/* +* dm_depriv is set, but we can't find a non-root uid to run as; +* fail domain creation +*/ LOGD (ERROR , guest_domid,"Could not find user %s or range base pseudo-user %s, cannot restrict" ,LIBXL_QEMU_USER_SHARED ,LIBXL_QEMU_USER_RANGE_BASE ); -return ERROR_INVAL ; + rc =ERROR_INVAL ; -end_search: - state->dm_runas = user; -return 0 ; +out: +/* First, do a root check if appropriate */ +if (!rc) { +if (user && intended_uid ==0 ) { +LOGD (ERROR , guest_domid,"intended_uid is 0 (root)!" ); + rc =ERROR_INVAL ; + } + } + +/* Then do the final set, if still appropriate */ +if (!rc && user) { + state->dm_runas = user; + } + +return rc; } const char *libxl__domain_device_model(libxl__gc *gc,
@@ -1757,7 +1820,7 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,break ; } -if (state->dm_runas &&strcmp (state->dm_runas,"root" )) { +if (state->dm_runas) {flexarray_append (dm_args,"-runas" );flexarray_append (dm_args, state->dm_runas); }
Signature · 7 lines
2.19.2 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v3 05/11] libxl: Do root checks once in libxl__domain_get_device_model_uid
George Dunlap writes ("[PATCH v3 05/11] libxl: Do root checks once in libxl__domain_get_device_model_uid"):
Quoted 3 lines
At the moment, we check for equivalence to literal "root" before deciding whether to add the
runascommand-line option to QEMU. This is unsatisfactory for several reasons.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v3 6/11 libxl: Move qmp cleanup into devicemodel destroy function
In reply to George DunlapRemoving the qmp connection is logically part of the device model destruction; having the caller destroy it is a mild layering violation.
Move libxl__qmp_cleanup() into libxl__destroy_device_model(). This will make it easier when we make devicemodel destruction asynchronous.
---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
--- tools/libxl/libxl_dm.c | 9 +++++++-- tools/libxl/libxl_domain.c | 2 -- 2 files changed, 7 insertions(+), 4 deletions(-)
tools/libxl/libxl_dm.c +7 -2
@@ -2698,12 +2698,17 @@ out:int libxl__destroy_device_model (libxl__gc *gc,uint32_t domid) { +int rc;char *path =DEVICE_MODEL_XS_PATH (gc,LIBXL_TOOLSTACK_DOMID , domid,"" );if (!xs_rm (CTX ->xsh,XBT_NULL , path))LOGD (ERROR , domid,"xs_rm failed for %s" , path);/* We should try to destroy the device model anyway. */ -return kill_device_model (gc, -GCSPRINTF ("/local/domain/%d/image/device-model-pid" , domid)); + rc =kill_device_model (gc, +GCSPRINTF ("/local/domain/%d/image/device-model-pid" , domid)); + +libxl__qmp_cleanup (gc, domid); + +return rc; }/* Return 0 if no dm needed, 1 if needed and <0 if error. */
tools/libxl/libxl_domain.c +0 -2
@@ -1069,8 +1069,6 @@ void libxl__destroy_domid(libxl__egc *egc, libxl__destroy_domid_state *dis)if (dm_present) {if (libxl__destroy_device_model (gc, domid) <0 )LOGD (ERROR , domid,"libxl__destroy_device_model failed" ); - -libxl__qmp_cleanup (gc, domid); } dis->drs.ao = ao; dis->drs.domid = domid;
Signature · 7 lines
2.19.2 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v3 7/11 libxl: Make killing of device model asynchronous
In reply to George DunlapOr at least, give it an asynchronous interface so that we can make it actually asynchronous in subsequent patches.
Create state structures and callback function signatures. Add the state structure to libxl__destroy_domid_state. Break libxl__destroy_domid down into two functions.
No functional change intended.
---
v2:
- Note that libxl__devicemodel_destroy_cb may be called reentrantly
NB that I retain the comment before libxl__destroy_device_model, in spite of the fact that it looks "pointless", to separate it logically from the previous prototype.
--- tools/libxl/libxl_dm.c | 11 +++++++--- tools/libxl/libxl_domain.c | 40 ++++++++++++++++++++++++++++-------- tools/libxl/libxl_internal.h | 20 ++++++++++++++++-- 3 files changed, 58 insertions(+), 13 deletions(-)
tools/libxl/libxl_dm.c +8 -3
@@ -2696,19 +2696,24 @@ out:return rc; } -int libxl__destroy_device_model (libxl__gc *gc,uint32_t domid) +void libxl__destroy_device_model (libxl__egc *egc, +libxl__destroy_devicemodel_state *ddms) { +STATE_AO_GC (ddms->ao);int rc; +int domid = ddms->domid;char *path =DEVICE_MODEL_XS_PATH (gc,LIBXL_TOOLSTACK_DOMID , domid,"" ); +if (!xs_rm (CTX ->xsh,XBT_NULL , path))LOGD (ERROR , domid,"xs_rm failed for %s" , path); +/* We should try to destroy the device model anyway. */ rc =kill_device_model (gc,GCSPRINTF ("/local/domain/%d/image/device-model-pid" , domid)); - +libxl__qmp_cleanup (gc, domid); -return rc; + ddms->callback (egc, ddms, rc); }/* Return 0 if no dm needed, 1 if needed and <0 if error. */
tools/libxl/libxl_domain.c +32 -8
@@ -1008,6 +1008,10 @@ static void destroy_finish_check(libxl__egc *egc, }/* Callbacks for libxl__destroy_domid */ +static void dm_destroy_cb (libxl__egc *egc, +libxl__destroy_devicemodel_state *ddms, +int rc); +static void devices_destroy_cb (libxl__egc *egc,libxl__devices_remove_state *drs,int rc);
@@ -1066,16 +1070,18 @@ void libxl__destroy_domid(libxl__egc *egc, libxl__destroy_domid_state *dis)if (rc <0 ) {LOGEVD (ERROR , rc, domid,"xc_domain_pause failed" ); } +if (dm_present) { -if (libxl__destroy_device_model (gc, domid) <0 ) -LOGD (ERROR , domid,"libxl__destroy_device_model failed" ); + dis->ddms.ao = ao; + dis->ddms.domid = domid; + dis->ddms.callback = dm_destroy_cb; + +libxl__destroy_device_model (egc, &dis->ddms); +return ; + }else { +dm_destroy_cb (egc, &dis->ddms,0 ); +return ; } - dis->drs.ao = ao; - dis->drs.domid = domid; - dis->drs.callback = devices_destroy_cb; - dis->drs.force =1 ; -libxl__devices_destroy (egc, &dis->drs); -return ; out:assert (rc);
@@ -1083,6 +1089,24 @@ out:return ; } +static void dm_destroy_cb (libxl__egc *egc, +libxl__destroy_devicemodel_state *ddms, +int rc) +{ +libxl__destroy_domid_state *dis =CONTAINER_OF (ddms, *dis, ddms); +STATE_AO_GC (dis->ao); +uint32_t domid = dis->domid; + +if (rc <0 ) +LOGD (ERROR , domid,"libxl__destroy_device_model failed" ); + + dis->drs.ao = ao; + dis->drs.domid = domid; + dis->drs.callback = devices_destroy_cb; + dis->drs.force =1 ; +libxl__devices_destroy (egc, &dis->drs); +} +static void devices_destroy_cb (libxl__egc *egc,libxl__devices_remove_state *drs,int rc)
tools/libxl/libxl_internal.h +18 -2
@@ -1705,8 +1705,6 @@ _hidden int libxl__wait_for_device_model_deprecated(libxl__gc *gc, void *userdata), void *check_callback_userdata); -_hidden int libxl__destroy_device_model(libxl__gc *gc, uint32_t domid); - _hidden const libxl_vnc_info *libxl__dm_vnc(const libxl_domain_config *g_cfg); _hidden char *libxl__abs_path(libxl__gc *gc, const char *s, const char *path);
@@ -3672,6 +3670,7 @@ extern const struct libxl_device_type *device_type_tbl[];typedef struct libxl__domain_destroy_state libxl__domain_destroy_state ;typedef struct libxl__destroy_domid_state libxl__destroy_domid_state ; +typedef struct libxl__destroy_devicemodel_state libxl__destroy_devicemodel_state ;typedef struct libxl__devices_remove_state libxl__devices_remove_state ; typedef void libxl__domain_destroy_cb(libxl__egc *egc,
@@ -3682,6 +3681,10 @@ typedef void libxl__domid_destroy_cb(libxl__egc *egc,libxl__destroy_domid_state *dis, int rc); +typedef void libxl__devicemodel_destroy_cb (libxl__egc *egc, +libxl__destroy_devicemodel_state *ddms, +int rc); +typedef void libxl__devices_remove_callback (libxl__egc *egc,libxl__devices_remove_state *drs,int rc);
@@ -3697,6 +3700,14 @@ struct libxl__devices_remove_state {int num_devices; }; +struct libxl__destroy_devicemodel_state { +/* filled in by user */ +libxl__ao *ao; +uint32_t domid; +libxl__devicemodel_destroy_cb *callback;/* May be called re-entrantly */ +/* private to implementation */ +}; +struct libxl__destroy_domid_state {/* filled in by user */ libxl__ao *ao;
@@ -3704,6 +3715,7 @@ struct libxl__destroy_domid_state {libxl__domid_destroy_cb *callback;/* private to implementation */ libxl__devices_remove_state drs; +libxl__destroy_devicemodel_state ddms;libxl__ev_child destroyer;bool soft_reset; };
@@ -3735,6 +3747,10 @@ _hidden void libxl__domain_destroy(libxl__egc *egc, _hidden void libxl__destroy_domid(libxl__egc *egc,libxl__destroy_domid_state *dis); +/* Used to detroy the device model */ +_hidden void libxl__destroy_device_model(libxl__egc *egc, +libxl__destroy_devicemodel_state *ddms); +/* Entry point for devices destruction */ _hidden void libxl__devices_destroy(libxl__egc *egc,libxl__devices_remove_state *drs);
Signature · 7 lines
2.19.2 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v3 8/11 libxl: Kill QEMU by uid when possible
In reply to George DunlapThe privcmd fd that a dm_restrict'ed QEMU has gives it permission to one specific domain ID. This domain ID will probably eventually be used again. It is therefore necessary to make absolutely sure that a rogue QEMU process cannot hang around after its domain has exited.
Killing QEMU by pid is insufficient in this situation, because QEMU may be able to fork() to escape killing. It is surprisingly tricky to kill a process which can call fork() without races; the only reliable way is to use kill(-1) to kill all processes with a given uid.
We can use this method only when we're sure that there's only one QEMU instance per uid. Add a dm_uid into the domain_build_state struct, and set it in libxl__domain_get_device_model_uid() when it's safe to kill by UID. Store this in xenstore next to device-model-pid.
On domain destroy, check to see if device-model-uid is present in xenstore. If so, fork off a reaper process, setuid to that uid, and do kill(-9) to kill all uids of that type. Otherwise, carry on destroying by pid.
While we're here, make libxl__destroy_device_model() consistently:
1. Return an error when anything fails
2. But continue to do as much clean-up as possible
NOTE that this is not yet completely safe: with ruid == dm_uid, the device model may be able to kill(-9) the 'reaper' process before the reaper process can kill it. Further patches will address this.
---
v3:
- rename dm_uid to dm_kill_uid to indicate that it's only used when it's suitable to be used for kiling.
- rename xenstore node to device-model-kill-uid for the same reason
- Add a comment explaining what dm_runas and dm_kill_uid are for.
- Minor tweak to comment for clarification
- Add an rc = 0; before an out: label
- Make the accumulator macro generic and put in libxl-internal.h
- Fix up child error code return
- Account for undefined behavior on failure of libxl__xs_read_checked.
v2:
- Rebase on top of previous "goto out" refactoring
- Rather than introducing a uid string, Introduce a boolean, "kill_by_uid"; and do the GCSPRINTF() once if that is set.
- Fix typo "starting"
- Always call kill_device_model_uid_cb(); only call libxl__qmp_cleanup() from there
- Refactor libxl__destroy_device_model() to follow "goto out on error" pattern
- Retain and report errors even when we continue trying to clean up
- Report errors removing DM xenstore directory (except -ENOENT)
- Report errors reading device-model-uid
- Put "kill by uid" child logic in a separate function
- Refactor "kill by uid" to follow "goto out on error" pattern
- Change "kill by uid" to return libxl-style error, rather than errno
- Document the intention of when to return errors
- Assert that dm_uid != 0
- Log what the reaper process setresuid'd to
--- tools/libxl/libxl_dm.c | 213 +++++++++++++++++++++++++++++++++-- tools/libxl/libxl_internal.h | 16 ++- 2 files changed, 219 insertions(+), 10 deletions(-)
tools/libxl/libxl_dm.c +204 -9
@@ -129,6 +129,7 @@ static int libxl__domain_get_device_model_uid(libxl__gc *gc,int rc;char *user;uid_t intended_uid =-1 ; +bool kill_by_uid;/* Only qemu-upstream can run as a different uid */ if (b_info->device_model_version !=LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN )
@@ -141,7 +142,8 @@ static int libxl__domain_get_device_model_uid(libxl__gc *gc,* - if rc is an error code, user and intended_uid are ignored. * - if rc is 0, user may be set or not set. * - if user is set, then intended_uid must be set to a UID matching -* the username `user`. This will be checked for root (0). +* the username `user`, and kill_by_uid must be set to the appropriate +* value. intended_uid will be checked for root (0). */ /*
@@ -162,6 +164,7 @@ static int libxl__domain_get_device_model_uid(libxl__gc *gc, } intended_uid = user_base->pw_uid; + kill_by_uid = true; rc =0 ; goto out; }
@@ -205,12 +208,15 @@ static int libxl__domain_get_device_model_uid(libxl__gc *gc,LOGD (DEBUG , guest_domid,"using uid %ld" , (long )intended_uid); user =GCSPRINTF ("%ld:%ld" , (long )intended_uid, (long )user_base->pw_gid); + kill_by_uid = true; rc =0 ; goto out; }/* -* We couldn't find QEMU_USER_BASE_RANGE; look for QEMU_USER_SHARED +* We couldn't find QEMU_USER_BASE_RANGE; look for +* QEMU_USER_SHARED. NB for QEMU_USER_SHARED, all QEMU will run +* as the same UID, we can't kill by uid; therefore don't set uid. */ user =LIBXL_QEMU_USER_SHARED ; rc =userlookup_helper_getpwnam (gc, user, &user_pwbuf, &user_base);
@@ -220,6 +226,7 @@ static int libxl__domain_get_device_model_uid(libxl__gc *gc,LOGD (WARN , guest_domid,"Could not find user %s, falling back to %s" ,LIBXL_QEMU_USER_RANGE_BASE ,LIBXL_QEMU_USER_SHARED ); intended_uid = user_base->pw_uid; + kill_by_uid = false; rc =0 ; goto out; }
@@ -245,6 +252,8 @@ out:/* Then do the final set, if still appropriate */ if (!rc && user) { state->dm_runas = user; +if (kill_by_uid) + state->dm_kill_uid =GCSPRINTF ("%ld" , (long )intended_uid); }return rc;
@@ -2427,6 +2436,15 @@ void libxl__spawn_local_dm(libxl__egc *egc, libxl__dm_spawn_state *dmss)const char *dom_path =libxl__xs_get_dompath (gc, domid); +/* +* If we're starting the dm with a non-root UID, save the UID so +* that we can reliably kill it and any subprocesses +*/ +if (state->dm_kill_uid) +libxl__xs_printf (gc,XBT_NULL , +GCSPRINTF ("%s/image/device-model-kill-uid" , dom_path), +"%s" , state->dm_kill_uid); +if (vnc && vnc->passwd) {/* This xenstore key will only be used by qemu-xen-traditionnal. * The code to supply vncpasswd to qemu-xen is later. */
@@ -2696,24 +2714,201 @@ out:return rc; } +/* Asynchronous device model destroy functions */ + +static int kill_device_model_uid_child (libxl__destroy_devicemodel_state *ddms, +const char *dm_kill_uid_str); + +static void kill_device_model_uid_cb (libxl__egc *egc, +libxl__ev_child *destroyer, +pid_t pid,int status); + +/* +* If we have a uid, we shouldn't kill by pid. This is because a +* hostile QEMU might have exited, in which case the pid we have may +* be that of another process. +* +* The running devicemodel has permission over a specific domain id; +* this means that ideally we wouldn't the domain in question (freeing +* up the domain id for reuse) until we're confident that we've killed +* the domain. +* +* In general, destroy as much as we can; but return an error if there +* are any errors, so that the domain destroy will be aborted, and the +* domain itself will remain, giving the admin an opportunity to fix +* any issues and re-try the domain destroy. +*/ void libxl__destroy_device_model (libxl__egc *egc,libxl__destroy_devicemodel_state *ddms) {STATE_AO_GC (ddms->ao);int rc;int domid = ddms->domid; -char *path =DEVICE_MODEL_XS_PATH (gc,LIBXL_TOOLSTACK_DOMID , domid,"" ); +char *path; +const char *dm_kill_uid_str =NULL ; +int reaper_pid; + + ddms->rc =0 ; -if (!xs_rm (CTX ->xsh,XBT_NULL , path)) + path =DEVICE_MODEL_XS_PATH (gc,LIBXL_TOOLSTACK_DOMID , domid,"" ); + rc =libxl__xs_rm_checked (gc,XBT_NULL , path); +if (rc) { +ACCUMULATE_RC (ddms->rc);LOGD (ERROR , domid,"xs_rm failed for %s" , path); + } + +/* +* See if we should try to kill by uid +*/ + path =GCSPRINTF ("/local/domain/%d/image/device-model-kill-uid" , domid); + rc =libxl__xs_read_checked (gc,XBT_NULL , path, &dm_kill_uid_str); + +/* +* If there was an error here, accumulate the error and fall back +* to killing by pid. +*/ +if (rc) { +/* +* Technically the state of the string passed to libxl__xs_read_checked() is +* "undefined" in the case rc == 0 (according to libxl_internal.h). Set it to +* NULL to prevent undefined behavior. +*/ + dm_kill_uid_str =NULL ; +ACCUMULATE_RC (ddms->rc); +LOGD (ERROR , domid,"Reading dm UID path failed for %s" , path); + } + +/* The DM has its own uid; Attempt to kill all processes with that UID */ +if (dm_kill_uid_str) { +LOGD (DEBUG , domid,"Found DM uid %s, destroying by uid" , + dm_kill_uid_str); + + reaper_pid =libxl__ev_child_fork (gc, &ddms->destroyer, + kill_device_model_uid_cb); +if (reaper_pid <0 ) { + rc =ERROR_FAIL ; +ACCUMULATE_RC (ddms->rc); +/* +* Note that if this fails, we still don't kill by pid, to +* make sure that an untrusted DM has not "maliciously" +* exited (potentially causing us to kill an unrelated +* process which happened to get the same pid). +*/ + goto out; + } + +if (!reaper_pid) {/* child */ + rc =kill_device_model_uid_child (ddms, dm_kill_uid_str); +assert (rc <=0 && rc >=-125 ); +_exit (-rc); + } + +/* +* Parent of successful fork; execution will pick up in +* kill_device_model_uid_cb when child exits +*/ +return ; + } + +/* +* No uid to kill; attept to kill by pid. +*/ +LOGD (DEBUG , domid,"Didn't find dm UID; destroying by pid" ); -/* We should try to destroy the device model anyway. */ - rc =kill_device_model (gc, -GCSPRINTF ("/local/domain/%d/image/device-model-pid" , domid)); + path =GCSPRINTF ("/local/domain/%d/image/device-model-pid" , domid); + rc =kill_device_model (gc, path); + +if (rc) { +ACCUMULATE_RC (ddms->rc); +LOGD (ERROR , domid,"Killing device model pid from path %s" , path); + } + +out: +/* +* NB that we always pass '0' here for the "status of exited +* process"; since there is no process, it always "succeeds". +* Errors are accumulated in ddms->rc and will be handled +* correctly. +*/ +kill_device_model_uid_cb (egc, &ddms->destroyer,-1 ,0 ); +return ; +} + +/* +* Destroy all processes of the given uid by setresuid to the +* specified uid and kill(-1). NB this MUST BE CALLED FROM A SEPARATE +* PROCESS from the normal libxl process. Returns a libxl-style error +* code that is guaranteed to be >= -125. +*/ +static int kill_device_model_uid_child (libxl__destroy_devicemodel_state *ddms, +const char *dm_kill_uid_str) { +STATE_AO_GC (ddms->ao); +int domid = ddms->domid; +int r, rc; +uid_t dm_kill_uid =atoi (dm_kill_uid_str); + +/* +* FIXME: the second uid needs to be distinct to avoid being +* killed by a potential rogue process +*/ + +/* +* Should never happen; but if it does, better to have the +* toolstack crash with an error than nuking dom0. +*/ +assert (dm_kill_uid); + +LOGD (DEBUG , domid,"DM reaper: calling setresuid(%d, %d, 0)" , + dm_kill_uid, dm_kill_uid); + r =setresuid (dm_kill_uid, dm_kill_uid,0 ); +if (r) { +LOGED (ERROR , domid,"setresuid to (%d, %d, 0)" , + dm_kill_uid, dm_kill_uid); + rc =ERROR_FAIL ; + goto out; + } + +/* +* And kill everyone but me. +* +* NB that it's not clear from either POSIX or the Linux man page +* that ESRCH would be returned with a pid value of -1, but it +* doesn't hurt to check. +*/ + r =kill (-1 ,9 ); +if (r && errno !=ESRCH ) { +LOGED (ERROR , domid,"kill(-1,9)" ); + rc =ERROR_FAIL ; + } + + rc =0 ; + +out: +return rc; +} + +static void kill_device_model_uid_cb (libxl__egc *egc, +libxl__ev_child *destroyer, +pid_t pid,int status) +{ +libxl__destroy_devicemodel_state *ddms =CONTAINER_OF (destroyer, *ddms, destroyer); +STATE_AO_GC (ddms->ao); + +if (status) { +int rc =ERROR_FAIL ; + +if (WIFEXITED (status)) + rc = -WEXITSTATUS (status); + +ACCUMULATE_RC (ddms->rc); +libxl_report_child_exitstatus (CTX ,XTL_ERROR , +"async domain destroy" , pid, status); + } -libxl__qmp_cleanup (gc, domid); +/* Always try to clean up qmp, even if something went wrong */ +libxl__qmp_cleanup (gc, ddms->domid); - ddms->callback (egc, ddms, rc); + ddms->callback (egc, ddms, ddms->rc); }/* Return 0 if no dm needed, 1 if needed and <0 if error. */
tools/libxl/libxl_internal.h +15 -1
@@ -160,6 +160,12 @@#endif /* all of these macros preserve errno (saving and restoring) */ +/* +* A macro to help retain the first failure in "do as much as you can" +* situations. Note the hard-coded use of the variable name `rc`. +*/ +#define ACCUMULATE_RC (rc_acc) ((rc_acc) = (rc_acc) ?: rc) +/* Convert pfn to physical address space. */ #define pfn_to_paddr (x) ((uint64_t)(x) << XC_PAGE_SHIFT)
@@ -1135,7 +1141,13 @@ typedef struct {const char *shim_cmdline;const char *pv_cmdline; -char *dm_runas; +/* +* dm_runas: If set, pass qemu the `-runas` parameter with this +* string as an argument +* dm_kill_uid: If set, the devicemodel should be killed by +* destroying all processes with this uid. +*/ +char *dm_runas, *dm_kill_uid;xen_vmemrange_t *vmemranges;uint32_t num_vmemranges;
@@ -3706,6 +3718,8 @@ struct libxl__destroy_devicemodel_state {uint32_t domid;libxl__devicemodel_destroy_cb *callback;/* May be called re-entrantly */ /* private to implementation */ +libxl__ev_child destroyer; +int rc;/* Accumulated return value for the destroy operation */ };struct libxl__destroy_domid_state {
Signature · 7 lines
2.19.2 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v3 08/11] libxl: Kill QEMU by uid when possible
George Dunlap writes ("[PATCH v3 08/11] libxl: Kill QEMU by uid when possible"):
Quoted 4 lines
The privcmd fd that a dm_restrict'ed QEMU has gives it permission to one specific domain ID. This domain ID will probably eventually be used again. It is therefore necessary to make absolutely sure that a rogue QEMU process cannot hang around after its domain has exited.
...
Quoted 4 lines
tools/libxl/libxl_dm.c +3
-0+static int kill_device_model_uid_child(libxl__destroy_devicemodel_state *ddms, +/* +* And kill everyone but me.
tools/libxl/libxl_dm.c out: · line 2882
Quoted 10 lines
tools/libxl/libxl_dm.c +10
-0+* +* NB that it's not clear from either POSIX or the Linux man page +* that ESRCH would be returned with a pid value of -1, but it +* doesn't hurt to check. +*/ + r =kill (-1 ,9 ); +if (r && errno !=ESRCH ) { +LOGED (ERROR , domid,"kill(-1,9)" ); + rc =ERROR_FAIL ; + }
Missing `goto out', there.
Quoted 9 lines
tools/libxl/libxl_dm.c +8
-0+ + rc =0 ; + +out: +return rc; +} +static void kill_device_model_uid_cb(libxl__egc *egc, + libxl__ev_child *destroyer,
tools/libxl/libxl_dm.c out: · line 2901
Quoted 10 lines
tools/libxl/libxl_dm.c +10
-0+ pid_t pid, int status) +{ +libxl__destroy_devicemodel_state *ddms =CONTAINER_OF (destroyer, *ddms, destroyer); +STATE_AO_GC (ddms->ao); + +if (status) { +int rc =ERROR_FAIL ; + +if (WIFEXITED (status)) + rc = -WEXITSTATUS (status);
But WEXITSTATUS might be something weird. See my mail about possible system-invented exit statuses. I suggest you tolerate only the status values you intend to generate, 1..125. (And 0 for success.)
tools/libxl/libxl_internal.h line 168
Quoted 6 lines
tools/libxl/libxl_internal.h +6
-0+/* +* A macro to help retain the first failure in "do as much as you can" +* situations. Note the hard-coded use of the variable name `rc`. +*/ +#define ACCUMULATE_RC (rc_acc) ((rc_acc) = (rc_acc) ?: rc) +
Good, although you have trailing whitespace in the new blank line.
Everything else LGTM.
Thanks,
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v3 9/11 libxl: Kill QEMU with "reaper" ruid
In reply to George DunlapUsing kill(-1) to killing an untrusted dm process with the real uid equal to the dm_uid isn't guaranteed to succeed: the process in question may be able to kill the reaper process after the setresuid() and before the kill().
Instead, set the real uid to the QEMU user for domain 0 (QEMU_USER_RANGE_BASE + 0). The reaper process will still be able to kill the dm process, but not vice versa.
This, in turn, requires locking to make sure that only one reaper process is using that uid at a time; otherwise one reaper process may kill the other reaper process.
Create a lockfile in RUNDIR/dm-reaper-lock, and grab the lock before executing kill.
In the event that we can't get the lock for some reason, go ahead with the kill using dm_uid for both real and effective UIDs. This isn't guaranteed to work, but it's no worse than not trying to kill the process at all.
NB that this effectively requires admins using device_model_user to also define xen_qemuuser_range_base; this will be addressed in subsequent patches.
---
v3:
- Have libxl__get_reaper_uid return an error if a suitable uid is not found.
- Explicitly set reaper_uid to dm_uid if get_reaper_lock_and_uid() returns an error, rather than relying on reaper_uid being unchanged on failure.
- Open the lockfile 0644 rather than 0666.
- Remove bogus comment.
v2:
- Port over previous changes
- libxl__get_reaper_uid() won't set errno, use LOG rather than LOGE.
- Accumulate error and return for all failures
- Move flock() outside of the condition. Also fix EINTR check (check errno rather than return value).
- Add a comment explaining why we return an error even if the kill() succeeds
- Move locking to a separate function to minimize gotos
- Refactor libxl__get_reaper_id to take a pointer for reaper_uid; return only success/failure. Also return EINVAL if reaper_uid would resolve to 0.
- Handle "reaper_uid not found" specially; note issue with device_model_user feature
- Assert that final reaper_uid != 0
--- tools/libxl/libxl_dm.c | 118 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 108 insertions(+), 10 deletions(-)
tools/libxl/libxl_dm.c +108 -10
@@ -259,6 +259,35 @@ out:return rc; } +/* +* Look up "reaper UID". If present and non-root, returns 0 and sets +* reaper_uid. Otherwise returns libxl-style error. +*/ +static int libxl__get_reaper_uid (libxl__gc *gc,uid_t *reaper_uid) +{ +struct passwd *user_base, user_pwbuf; +int rc; + + rc =userlookup_helper_getpwnam (gc,LIBXL_QEMU_USER_RANGE_BASE , + &user_pwbuf, &user_base); +if (rc) +return rc; + +if (!user_base) { +LOG (WARN ,"Couldn't find uid for reaper process" ); +return ERROR_INVAL ; + } + +if (user_base->pw_uid ==0 ) { +LOG (ERROR ,"UID for reaper process maps to root!" ); +return ERROR_INVAL ; + } + + *reaper_uid = user_base->pw_uid; + +return 0 ; +} +const char *libxl__domain_device_model (libxl__gc *gc,const libxl_domain_build_info *info) {
@@ -2834,37 +2863,106 @@ out:return ; } +static int get_reaper_lock_and_uid (libxl__destroy_devicemodel_state *ddms, +uid_t *reaper_uid) +{ +STATE_AO_GC (ddms->ao); +int domid = ddms->domid; +int r; +const char * lockfile; +int fd; + +/* Try to lock the "reaper uid" */ + lockfile =GCSPRINTF ("%s/dm-reaper-lock" ,libxl__run_dir_path ()); + +/* +* NB that since we've just forked, we can't have any +* threads; so we don't need the libxl__carefd +* infrastructure here. +*/ + fd =open (lockfile,O_RDWR |O_CREAT ,0644 ); +if (fd <0 ) { +LOGED (ERROR , domid, +"unexpected error while trying to open lockfile %s, errno=%d" , + lockfile, errno); +return ERROR_FAIL ; + } + +/* Try to lock the file, retrying on EINTR */ +for (;;) { + r =flock (fd,LOCK_EX ); +if (!r) +break ; +if (errno !=EINTR ) { +/* All other errno: EBADF, EINVAL, ENOLCK, EWOULDBLOCK */ +LOGED (ERROR , domid, +"unexpected error while trying to lock %s, fd=%d, errno=%d" , + lockfile, fd, errno); +return ERROR_FAIL ; + } + } + +/* +* Get reaper_uid. If we can't find such a uid, return an error. +* +* FIXME: This means that domain destruction will fail if +* device_model_user is set but QEMU_USER_RANGE_BASE doesn't exist. +*/ +return libxl__get_reaper_uid (gc, reaper_uid); +} + +/* * Destroy all processes of the given uid by setresuid to the * specified uid and kill(-1). NB this MUST BE CALLED FROM A SEPARATE -* PROCESS from the normal libxl process. Returns a libxl-style error -* code that is guaranteed to be >= -125. +* PROCESS from the normal libxl process, and should exit immediately +* after return. Returns a libxl-style error code that is guaranteed +* to be >= -125. */ static int kill_device_model_uid_child (libxl__destroy_devicemodel_state *ddms,const char *dm_kill_uid_str) {STATE_AO_GC (ddms->ao);int domid = ddms->domid; -int r, rc; +int r, rc =0 ;uid_t dm_kill_uid =atoi (dm_kill_uid_str); +uid_t reaper_uid;/* -* FIXME: the second uid needs to be distinct to avoid being -* killed by a potential rogue process +* Try to kill the devicemodel by uid. The safest way to do this +* is to set euid == dm_uid, but the ruid to something else. If +* we can't get a separate ruid, carry on trying to kill the +* process anyway using dm_uid for the ruid. This is racy (the dm +* may be able to kill(-1) us before we kill them), but worth +* trying. +* +* NB: Even if we don't have a separate reaper_uid, the parent can +* know whether we won the race by looking at the status variable; +* so we don't strictly need to return failure in this case. But +* if there's a misconfiguration, it's better to alert the +* administator sooner rather than later; so if we fail to get a +* reaper uid, report an error even if the kill succeeds. */ + rc =get_reaper_lock_and_uid (ddms, &reaper_uid); +if (rc) { + reaper_uid = dm_kill_uid; +LOGD (WARN , domid,"Couldn't get separate reaper uid;" +"carrying on with unsafe kill" ); + }/* * Should never happen; but if it does, better to have the * toolstack crash with an error than nuking dom0. */ +assert (reaper_uid);assert (dm_kill_uid);LOGD (DEBUG , domid,"DM reaper: calling setresuid(%d, %d, 0)" , - dm_kill_uid, dm_kill_uid); - r =setresuid (dm_kill_uid, dm_kill_uid,0 ); + reaper_uid, dm_kill_uid); + r =setresuid (reaper_uid, dm_kill_uid,0 );if (r) {LOGED (ERROR , domid,"setresuid to (%d, %d, 0)" , - dm_kill_uid, dm_kill_uid); - rc =ERROR_FAIL ; + reaper_uid, dm_kill_uid); + rc = rc ?:ERROR_FAIL ; goto out; }
@@ -2878,7 +2976,7 @@ static int kill_device_model_uid_child(libxl__destroy_devicemodel_state *ddms, r =kill (-1 ,9 );if (r && errno !=ESRCH ) {LOGED (ERROR , domid,"kill(-1,9)" ); - rc =ERROR_FAIL ; + rc = rc ?:ERROR_FAIL ; } rc =0 ;
Signature · 7 lines
2.19.2 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v3 09/11] libxl: Kill QEMU with "reaper" ruid
George Dunlap writes ("[PATCH v3 09/11] libxl: Kill QEMU with "reaper" ruid"):
Quoted 4 lines
Using kill(-1) to killing an untrusted dm process with the real uid equal to the
dm_uidisn't guaranteed to succeed: the process in question may be able to kill the reaper process after thesetresuid()and before thekill().
...
Quoted 4 lines
+/*
+ * Look up "reaper UID". If present and non-root, returns 0 and sets
+ *reaper_uid. Otherwise returns libxl-style error.
+ */
Might be worth mentioning that this function expects to be called in a subprocess, for a variety of reasons including because it takes a lock.
Nevertheless,
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v3 10/11 libxl: Introduce specific username to be used as a reaper
In reply to George DunlapUntrusted device models must be killed by uid rather than by pid for safety. To do this reliably, we need another uid, not used for any other purpose, from which to make the kill system call.
When using xen-qemuuser-range-base, we can repurpose xen-qemuuser-range-base itself as a UID from which to kill other devicemodel uids (since domain ID 0 should never have a device model associated with it).
However, we'd like people to be able to use the device_model_user feature without also defining xen-qemuuser-range-base (which requires the ability to 'reserve' 32k+ user IDs).
To that end, introduce the xen-qemuuser-reaper id. When killing by UID, first look for and use that ID if available; then fall back to xen-qemuuser-range-base.
Document the new call in docs/features/qemu-deprivilege.pandoc.
---
v3:
- New in this version
--- docs/features/qemu-deprivilege.pandoc | 9 ++++++ tools/libxl/libxl_dm.c | 40 +++++++++++++++++---------- tools/libxl/libxl_internal.h | 1 + 3 files changed, 35 insertions(+), 15 deletions(-)
docs/features/qemu-deprivilege.pandoc +9 -0
@@ -77,12 +77,21 @@ And then in your config file, the following line: device_model_user="xen-qemuuser-c6-01" +If you use this method, you should also allocate one "reaper" user to +be used for killing device models: + + adduser --system --no-create-home --group xen-qemuuser-reaper + NOTE: It is important when using `device_model_user` that EACH VM HAVE A SEPARATE UID, and that none of these UIDs map to root. xl will throw an error a uid maps to zero, but not if multiple VMs have the same uid. Multiple VMs with the same device model uid will cause problems. +It is also important that `xen-qemuuser-reaper` not have any processes +associated with it, as they will be destroyed when deprivileged qemu +processes are destroyed. + ## Domain config changes The core domain config change is to add the following line to the
tools/libxl/libxl_dm.c +25 -15
@@ -268,24 +268,37 @@ static int libxl__get_reaper_uid(libxl__gc *gc, uid_t *reaper_uid)struct passwd *user_base, user_pwbuf;int rc; + rc =userlookup_helper_getpwnam (gc,LIBXL_QEMU_USER_REAPER , + &user_pwbuf, &user_base); +/* +* Either there was an error, or we found a suitable user; stop +* looking +*/ +if (rc || user_base) + goto out; + rc =userlookup_helper_getpwnam (gc,LIBXL_QEMU_USER_RANGE_BASE , &user_pwbuf, &user_base); -if (rc) -return rc; +if (rc || user_base) + goto out; -if (!user_base) { -LOG (WARN ,"Couldn't find uid for reaper process" ); -return ERROR_INVAL ; - } - -if (user_base->pw_uid ==0 ) { -LOG (ERROR ,"UID for reaper process maps to root!" ); -return ERROR_INVAL ; +LOG (WARN ,"Couldn't find uid for reaper process" ); + rc =ERROR_INVAL ; + + out: +/* First check to see if the discovered user maps to root */ +if (!rc) { +if (user_base->pw_uid ==0 ) { +LOG (ERROR ,"UID for reaper process maps to root!" ); + rc =ERROR_INVAL ; + } } - *reaper_uid = user_base->pw_uid; +/* If everything is OK, set reaper_uid as appropriate */ +if (!rc) + *reaper_uid = user_base->pw_uid; -return 0 ; +return rc; } const char *libxl__domain_device_model(libxl__gc *gc,
@@ -2904,9 +2917,6 @@ static int get_reaper_lock_and_uid(libxl__destroy_devicemodel_state *ddms,/* * Get reaper_uid. If we can't find such a uid, return an error. -* -* FIXME: This means that domain destruction will fail if -* device_model_user is set but QEMU_USER_RANGE_BASE doesn't exist. */ return libxl__get_reaper_uid (gc, reaper_uid); }
tools/libxl/libxl_internal.h +1 -0
@@ -4419,6 +4419,7 @@ _hidden int libxl__read_sysfs_file_contents(libxl__gc *gc,#define LIBXL_QEMU_USER_PREFIX "xen-qemuuser"#define LIBXL_QEMU_USER_SHARED LIBXL_QEMU_USER_PREFIX"-shared"#define LIBXL_QEMU_USER_RANGE_BASE LIBXL_QEMU_USER_PREFIX"-range-base" +#define LIBXL_QEMU_USER_REAPER LIBXL_QEMU_USER_PREFIX"-reaper"static inline bool libxl__acpi_defbool_val (const libxl_domain_build_info *b_info) {
Signature · 7 lines
2.19.2 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v3 10/11] libxl: Introduce specific username to be used as a reaper
George Dunlap writes ("[PATCH v3 10/11] libxl: Introduce specific username to be used as a reaper"):
Quoted 3 lines
Untrusted device models must be killed by uid rather than by pid for safety. To do this reliably, we need another uid, not used for any other purpose, from which to make the kill system call.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v3 11/11 dm_depriv: Mark `UID cleanup` as completed
In reply to George Dunlap---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
--- docs/designs/qemu-deprivilege.md | 40 ++++++++++++++++---------------- 1 file changed, 20 insertions(+), 20 deletions(-)
docs/designs/qemu-deprivilege.md +20 -20
@@ -128,26 +128,6 @@ are specified; this does not apply to QEMU running as a Xen DM. '''Tested''': Not tested -# Restrictions / improvements still to do - -This lists potential restrictions still to do. It is meant to be -listed in order of ease of implementation, with low-hanging fruit -first. - -### Further RLIMITs - -RLIMIT_AS limits the total amount of memory; but this includes the -virtual memory which QEMU uses as a mapcache. xen-mapcache.c already -fiddles with this; it would be straightforward to make it *set* the -rlimit to what it thinks a sensible limit is. - -RLIMIT_NPROC limits total number of processes or threads. QEMU uses -threads for some devices, so this would require some thought. - -Other things that would take some cleverness / changes to QEMU to -utilize due to ordering constrants: - - RLIMIT_NOFILES (after all necessary files are opened) - ### libxl UID cleanup '''Description''': Domain IDs are reused, and thus restricted UIDs are
@@ -223,6 +203,26 @@ Since this will kill all other `reaper_uid` processes as well, we must either allocate a separate `reaper_uid` per domain, or use locking to ensure that only one killing process is active at a time. +# Restrictions / improvements still to do + +This lists potential restrictions still to do. It is meant to be +listed in order of ease of implementation, with low-hanging fruit +first. + +### Further RLIMITs + +RLIMIT_AS limits the total amount of memory; but this includes the +virtual memory which QEMU uses as a mapcache. xen-mapcache.c already +fiddles with this; it would be straightforward to make it *set* the +rlimit to what it thinks a sensible limit is. + +RLIMIT_NPROC limits total number of processes or threads. QEMU uses +threads for some devices, so this would require some thought. + +Other things that would take some cleverness / changes to QEMU to +utilize due to ordering constrants: + - RLIMIT_NOFILES (after all necessary files are opened) + ## libxl: Treat QMP connection as untrusted '''Description''': Currently libxl talks with QEMU via QMP; but its
Signature · 7 lines
2.19.2 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v3 11/11] dm_depriv: Mark `UID cleanup` as completed
George Dunlap writes ("[PATCH v3 11/11] dm_depriv: Mark UID cleanup as completed"):
Quoted 1 line
Signed-off-by George Dunlap <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel