* [PATCH] xen: xenbus_dev_frontend: Really return response string
@ 2018-03-15 3:08 Simon Gaiser
2018-04-17 7:33 ` Juergen Gross
0 siblings, 1 reply; 3+ messages in thread
From: Simon Gaiser @ 2018-03-15 3:08 UTC (permalink / raw)
To: xen-devel; +Cc: Simon Gaiser, Boris Ostrovsky, Juergen Gross, linux-kernel
xenbus_command_reply() did not actually copy the response string and
leaked stack content instead.
Fixes: 9a6161fe73bd ("xen: return xenstore command failures via response instead of rc")
Signed-off-by: Simon Gaiser <simon@invisiblethingslab.com>
---
PS: AFAICS this is not a security issue since /dev/xen/xenbus is
normally only accessible by root and giving xenstore access to a less
trusted entity probably has a bunch of other unintended consequences.
drivers/xen/xenbus/xenbus_dev_frontend.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/xen/xenbus/xenbus_dev_frontend.c b/drivers/xen/xenbus/xenbus_dev_frontend.c
index a493e99bed21..845a70fa7f79 100644
--- a/drivers/xen/xenbus/xenbus_dev_frontend.c
+++ b/drivers/xen/xenbus/xenbus_dev_frontend.c
@@ -403,7 +403,7 @@ static int xenbus_command_reply(struct xenbus_file_priv *u,
{
struct {
struct xsd_sockmsg hdr;
- const char body[16];
+ char body[16];
} msg;
int rc;
@@ -412,6 +412,7 @@ static int xenbus_command_reply(struct xenbus_file_priv *u,
msg.hdr.len = strlen(reply) + 1;
if (msg.hdr.len > sizeof(msg.body))
return -E2BIG;
+ memcpy(&msg.body, reply, msg.hdr.len);
mutex_lock(&u->reply_mutex);
rc = queue_reply(&u->read_buffers, &msg, sizeof(msg.hdr) + msg.hdr.len);
--
2.16.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] xen: xenbus_dev_frontend: Really return response string
2018-03-15 3:08 [PATCH] xen: xenbus_dev_frontend: Really return response string Simon Gaiser
@ 2018-04-17 7:33 ` Juergen Gross
2018-04-17 15:12 ` Boris Ostrovsky
0 siblings, 1 reply; 3+ messages in thread
From: Juergen Gross @ 2018-04-17 7:33 UTC (permalink / raw)
To: Simon Gaiser, xen-devel; +Cc: Boris Ostrovsky, linux-kernel
On 15/03/18 04:08, Simon Gaiser wrote:
> xenbus_command_reply() did not actually copy the response string and
> leaked stack content instead.
>
> Fixes: 9a6161fe73bd ("xen: return xenstore command failures via response instead of rc")
> Signed-off-by: Simon Gaiser <simon@invisiblethingslab.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Juergen
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] xen: xenbus_dev_frontend: Really return response string
2018-04-17 7:33 ` Juergen Gross
@ 2018-04-17 15:12 ` Boris Ostrovsky
0 siblings, 0 replies; 3+ messages in thread
From: Boris Ostrovsky @ 2018-04-17 15:12 UTC (permalink / raw)
To: Juergen Gross, Simon Gaiser, xen-devel; +Cc: linux-kernel
On 04/17/2018 03:33 AM, Juergen Gross wrote:
> On 15/03/18 04:08, Simon Gaiser wrote:
>> xenbus_command_reply() did not actually copy the response string and
>> leaked stack content instead.
>>
>> Fixes: 9a6161fe73bd ("xen: return xenstore command failures via response instead of rc")
>> Signed-off-by: Simon Gaiser <simon@invisiblethingslab.com>
> Reviewed-by: Juergen Gross <jgross@suse.com>
>
Applied to for-linus-4.17.
-boris
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-04-17 15:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-15 3:08 [PATCH] xen: xenbus_dev_frontend: Really return response string Simon Gaiser
2018-04-17 7:33 ` Juergen Gross
2018-04-17 15:12 ` Boris Ostrovsky
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).