[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ddafd707-bae8-d025-dfb2-aa958c23ded8@suse.com>
Date: Mon, 12 Feb 2018 14:51:52 +0100
From: Juergen Gross <jgross@...e.com>
To: Joao Martins <joao.m.martins@...cle.com>,
xen-devel@...ts.xenproject.org, linux-kernel@...r.kernel.org
Cc: Boris Ostrovsky <boris.ostrovsky@...cle.com>,
stable@...r.kernel.org
Subject: Re: [PATCH v2] xenbus: track caller request id
On 02/02/18 18:42, Joao Martins wrote:
> Commit fd8aa9095a95 ("xen: optimize xenbus driver for multiple concurrent
> xenstore accesses") optimized xenbus concurrent accesses but in doing so
> broke UABI of /dev/xen/xenbus. Through /dev/xen/xenbus applications are in
> charge of xenbus message exchange with the correct header and body. Now,
> after the mentioned commit the replies received by application will no
> longer have the header req_id echoed back as it was on request (see
> specification below for reference), because that particular field is being
> overwritten by kernel.
>
> struct xsd_sockmsg
> {
> uint32_t type; /* XS_??? */
> uint32_t req_id;/* Request identifier, echoed in daemon's response. */
> uint32_t tx_id; /* Transaction id (0 if not related to a transaction). */
> uint32_t len; /* Length of data following this. */
>
> /* Generally followed by nul-terminated string(s). */
> };
>
> Before there was only one request at a time so req_id could simply be
> forwarded back and forth. To allow simultaneous requests we need a
> different req_id for each message thus kernel keeps a monotonic increasing
> counter for this field and is written on every request irrespective of
> userspace value.
>
> Forwarding again the req_id on userspace requests is not a solution because
> we would open the possibility of userspace-generated req_id colliding with
> kernel ones. So this patch instead takes another route which is to
> artificially keep user req_id while keeping the xenbus logic as is. We do
> that by saving the original req_id before xs_send(), use the private kernel
> counter as req_id and then once reply comes and was validated, we restore
> back the original req_id.
>
> Cc: <stable@...r.kernel.org> # 4.11
> Fixes: fd8aa9095a ("xen: optimize xenbus driver for multiple concurrent xenstore accesses")
> Reported-by: Bhavesh Davda <bhavesh.davda@...cle.com>
> Signed-off-by: Joao Martins <joao.m.martins@...cle.com>
Committed to xen.tip for-linus-4.16
Juergen
Powered by blists - more mailing lists