From 2e8bfb005277fd1651ee3ab11f04717abee3d370 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 4 Oct 2016 10:19:36 +0100 Subject: [PATCH] libxl: Mark libxl_retrieve_domain_configuration as for external callers only This function takes the userdata lock. Incautious use inside libxl can result in nested acquisition of that lock, and deadlock. There is no good reason to use this function inside libxl, but it is a superficially attractive option. Make future regressions easier to spot by marking the function for external use only. Similar arguments apply for the application-facing userdata accessors, so do those too. Signed-off-by: Ian Jackson Acked-by: Wei Liu --- tools/libxl/libxl.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h index 969a089486..acbf47690e 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -1352,7 +1352,8 @@ void libxl_domain_config_dispose(libxl_domain_config *d_config); * works with DomU. */ int libxl_retrieve_domain_configuration(libxl_ctx *ctx, uint32_t domid, - libxl_domain_config *d_config); + libxl_domain_config *d_config) + LIBXL_EXTERNAL_CALLERS_ONLY; int libxl_domain_suspend(libxl_ctx *ctx, uint32_t domid, int fd, int flags, /* LIBXL_SUSPEND_* */ @@ -1945,12 +1946,14 @@ void libxl_cpuid_set(libxl_ctx *ctx, uint32_t domid, */ int libxl_userdata_store(libxl_ctx *ctx, uint32_t domid, const char *userdata_userid, - const uint8_t *data, int datalen); + const uint8_t *data, int datalen) + LIBXL_EXTERNAL_CALLERS_ONLY; /* If datalen==0, data is not used and the user data for * that domain and userdata_userid is deleted. */ int libxl_userdata_retrieve(libxl_ctx *ctx, uint32_t domid, const char *userdata_userid, - uint8_t **data_r, int *datalen_r); + uint8_t **data_r, int *datalen_r) + LIBXL_EXTERNAL_CALLERS_ONLY; /* On successful return, *data_r is from malloc. * If there is no data for that domain and userdata_userid, * *data_r and *datalen_r will be set to 0. -- 2.30.2