From: Ian Jackson <ian.jackson@eu.citrix.com>
To: xen-devel@lists.xenproject.org
Cc: "Ian Jackson" <Ian.Jackson@eu.citrix.com>,
"Wei Liu" <wei.liu2@citrix.com>,
"Roger Pau Monné" <roger.pau@citrix.com>
Subject: [PATCH 3/4] tools: xencall, xengnttab, xengntshr: Provide access to internal fds
Date: Mon, 14 May 2018 18:08:58 +0100 [thread overview]
Message-ID: <1526317739-17572-4-git-send-email-ian.jackson@eu.citrix.com> (raw)
In-Reply-To: <1526317739-17572-1-git-send-email-ian.jackson@eu.citrix.com>
I want this to support my qemu depriv descriptor audit tool.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
tools/libs/call/core.c | 5 +++++
tools/libs/call/include/xencall.h | 8 ++++++++
tools/libs/call/libxencall.map | 1 +
tools/libs/gnttab/gntshr_core.c | 6 ++++++
tools/libs/gnttab/gnttab_core.c | 5 +++++
tools/libs/gnttab/include/xengnttab.h | 17 +++++++++++++++++
tools/libs/gnttab/libxengnttab.map | 2 ++
7 files changed, 44 insertions(+)
diff --git a/tools/libs/call/core.c b/tools/libs/call/core.c
index f3a3400..c155bd4 100644
--- a/tools/libs/call/core.c
+++ b/tools/libs/call/core.c
@@ -81,6 +81,11 @@ int xencall_close(xencall_handle *xcall)
return rc;
}
+int xencall_fd(xencall_handle *xcall)
+{
+ return xcall->fd;
+}
+
int xencall0(xencall_handle *xcall, unsigned int op)
{
privcmd_hypercall_t call = {
diff --git a/tools/libs/call/include/xencall.h b/tools/libs/call/include/xencall.h
index bafacdd..24bcafb 100644
--- a/tools/libs/call/include/xencall.h
+++ b/tools/libs/call/include/xencall.h
@@ -74,6 +74,14 @@ xencall_handle *xencall_open(struct xentoollog_logger *logger,
int xencall_close(xencall_handle *xcall);
/*
+ * Return the fd used internally by xencall. selecting on it is not
+ * useful. But it could be useful for unusual use cases; perhaps,
+ * passing to other programs, calling ioctls on directly, or maybe
+ * calling fcntl.
+ */
+int xencall_fd(xencall_handle *xcall);
+
+/*
* Call hypercalls with varying numbers of arguments.
*
* On success the return value of the hypercall is the return value of
diff --git a/tools/libs/call/libxencall.map b/tools/libs/call/libxencall.map
index 2f96144..299ca38 100644
--- a/tools/libs/call/libxencall.map
+++ b/tools/libs/call/libxencall.map
@@ -2,6 +2,7 @@ VERS_1.0 {
global:
xencall_open;
xencall_close;
+ xencall_fd;
xencall0;
xencall1;
diff --git a/tools/libs/gnttab/gntshr_core.c b/tools/libs/gnttab/gntshr_core.c
index 7f6bf9d..1117e29 100644
--- a/tools/libs/gnttab/gntshr_core.c
+++ b/tools/libs/gnttab/gntshr_core.c
@@ -64,6 +64,12 @@ int xengntshr_close(xengntshr_handle *xgs)
free(xgs);
return rc;
}
+
+int xengntshr_fd(xengntshr_handle *xgs)
+{
+ return xgs->fd;
+}
+
void *xengntshr_share_pages(xengntshr_handle *xcg, uint32_t domid,
int count, uint32_t *refs, int writable)
{
diff --git a/tools/libs/gnttab/gnttab_core.c b/tools/libs/gnttab/gnttab_core.c
index 98f1591..bd075f8 100644
--- a/tools/libs/gnttab/gnttab_core.c
+++ b/tools/libs/gnttab/gnttab_core.c
@@ -75,6 +75,11 @@ int xengnttab_close(xengnttab_handle *xgt)
return rc;
}
+int xengnttab_fd(xengnttab_handle *xgt)
+{
+ return xgt->fd;
+}
+
int xengnttab_set_max_grants(xengnttab_handle *xgt, uint32_t count)
{
return osdep_gnttab_set_max_grants(xgt, count);
diff --git a/tools/libs/gnttab/include/xengnttab.h b/tools/libs/gnttab/include/xengnttab.h
index 35be6c1..91d4cd5 100644
--- a/tools/libs/gnttab/include/xengnttab.h
+++ b/tools/libs/gnttab/include/xengnttab.h
@@ -149,6 +149,15 @@ xengnttab_handle *xengnttab_open(struct xentoollog_logger *logger,
*/
int xengnttab_close(xengnttab_handle *xgt);
+
+/*
+ * Return the fd used internally by xengnttab. selecting on it is not
+ * useful. But it could be useful for unusual use cases; perhaps,
+ * passing to other programs, calling ioctls on directly, or maybe
+ * calling fcntl.
+ */
+int xengnttab_fd(xengnttab_handle *xgt);
+
/**
* Memory maps a grant reference from one domain to a local address range.
* Mappings should be unmapped with xengnttab_unmap. Logs errors.
@@ -334,6 +343,14 @@ xengntshr_handle *xengntshr_open(struct xentoollog_logger *logger,
*/
int xengntshr_close(xengntshr_handle *xgs);
+/*
+ * Return the fd used internally by xengntshr. selecting on it is not
+ * useful. But it could be useful for unusual use cases; perhaps,
+ * passing to other programs, calling ioctls on directly, or maybe
+ * calling fcntl.
+ */
+int xengntshr_fd(xengntshr_handle *xgs);
+
/**
* Allocates and shares pages with another domain.
*
diff --git a/tools/libs/gnttab/libxengnttab.map b/tools/libs/gnttab/libxengnttab.map
index f78da22..ce59ec9 100644
--- a/tools/libs/gnttab/libxengnttab.map
+++ b/tools/libs/gnttab/libxengnttab.map
@@ -2,6 +2,7 @@ VERS_1.0 {
global:
xengnttab_open;
xengnttab_close;
+ xengnttab_fd;
xengnttab_set_max_grants;
@@ -14,6 +15,7 @@ VERS_1.0 {
xengntshr_open;
xengntshr_close;
+ xengntshr_fd;
xengntshr_share_page_notify;
xengntshr_share_pages;
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2018-05-14 17:09 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-14 17:08 [PATCH for-4.12 0/4] tools: Internal fd access, etc Ian Jackson
2018-05-14 17:08 ` [PATCH 1/4] libxc: Drop declarations of osdep_privcmd_open and _close Ian Jackson
2018-05-15 8:37 ` Wei Liu
2018-05-15 8:49 ` Roger Pau Monné
2018-05-14 17:08 ` [PATCH 2/4] libxc: Provide access to internal handles Ian Jackson
2018-05-15 8:37 ` Wei Liu
2018-05-15 8:58 ` Roger Pau Monné
2018-06-11 13:49 ` Ian Jackson
2018-05-14 17:08 ` Ian Jackson [this message]
2018-05-14 17:18 ` [PATCH 3/4] tools: xencall, xengnttab, xengntshr: Provide access to internal fds Andrew Cooper
2018-05-15 11:10 ` Ian Jackson
2018-05-14 17:08 ` [PATCH 4/4] libxl: Provide better error message when qemu restrict user not found Ian Jackson
2018-05-15 8:38 ` Wei Liu
2018-05-15 9:02 ` Roger Pau Monné
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1526317739-17572-4-git-send-email-ian.jackson@eu.citrix.com \
--to=ian.jackson@eu.citrix.com \
--cc=roger.pau@citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).