Message ID | 20231101093325.30302-22-jgross@suse.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | tools: enable xenstore-stubdom to use 9pfs | expand |
On 01/11/2023 9:33 am, Juergen Gross wrote: > Pass the domid as a boot parameter when starting xenstore-stubdom. > It will be needed to administrate its own Xenstore entries. > > Signed-off-by: Juergen Gross <jgross@suse.com> I'm going to fix this differently. Because I'm utterly sick and tired of the absurd position at the moment where HVM guests can ask the hypervisor for their domid but PV cant. (Despite both being able to figure it out anyway through other information leaks in hypercalls.) The only reason I didn't nack the patch which created this problem to begin with was because it was part of the original Spectre/Meltdown work. ~Andrew
diff --git a/tools/helpers/init-xenstore-domain.c b/tools/helpers/init-xenstore-domain.c index a65abae2ac..718cb3ba4e 100644 --- a/tools/helpers/init-xenstore-domain.c +++ b/tools/helpers/init-xenstore-domain.c @@ -240,9 +240,9 @@ static int build(xc_interface *xch) } if ( param ) - snprintf(cmdline, 512, "--event %d %s", rv, param); + snprintf(cmdline, 512, "--event %d --domid %u %s", rv, domid, param); else - snprintf(cmdline, 512, "--event %d", rv); + snprintf(cmdline, 512, "--event %d --domid %u", rv, domid); dom->guest_domid = domid; dom->cmdline = xc_dom_strdup(dom, cmdline); diff --git a/tools/xenstored/core.c b/tools/xenstored/core.c index edd07711db..bb4612455d 100644 --- a/tools/xenstored/core.c +++ b/tools/xenstored/core.c @@ -2732,12 +2732,16 @@ static struct option options[] = { { "watch-nb", 1, NULL, 'W' }, #ifndef NO_LIVE_UPDATE { "live-update", 0, NULL, 'U' }, +#endif +#ifdef __MINIOS__ + { "domid", 1, NULL, 2 }, #endif { NULL, 0, NULL, 0 } }; int dom0_domid = 0; int dom0_event = 0; int priv_domid = 0; +int stub_domid = -1; static unsigned int get_optval_uint(const char *arg) { @@ -2927,6 +2931,11 @@ int main(int argc, char *argv[]) case 'U': live_update = true; break; +#endif +#ifdef __MINIOS__ + case 2: + stub_domid = get_optval_uint(optarg); + break; #endif } } diff --git a/tools/xenstored/core.h b/tools/xenstored/core.h index 480b0f5f7b..f7a27a4131 100644 --- a/tools/xenstored/core.h +++ b/tools/xenstored/core.h @@ -359,6 +359,7 @@ do { \ extern int dom0_domid; extern int dom0_event; extern int priv_domid; +extern int stub_domid; extern bool keep_orphans; extern unsigned int timeout_watch_event_msec;
Pass the domid as a boot parameter when starting xenstore-stubdom. It will be needed to administrate its own Xenstore entries. Signed-off-by: Juergen Gross <jgross@suse.com> --- tools/helpers/init-xenstore-domain.c | 4 ++-- tools/xenstored/core.c | 9 +++++++++ tools/xenstored/core.h | 1 + 3 files changed, 12 insertions(+), 2 deletions(-)