lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 3 Mar 2020 10:11:59 +0000
From:   Julien Grall <julien@....org>
To:     Dongli Zhang <dongli.zhang@...cle.com>,
        xen-devel@...ts.xenproject.org, linux-kernel@...r.kernel.org
Cc:     jgross@...e.com, boris.ostrovsky@...cle.com,
        sstabellini@...nel.org, joe.jin@...cle.com
Subject: Re: [Xen-devel] [PATCH 2/2] xenbus: req->err should be updated before
 req->state

Hi,

On 03/03/2020 01:58, Dongli Zhang wrote:
> This patch adds the barrier to guarantee that req->err is always updated
> before req->state.
> 
> Otherwise, read_reply() would not return ERR_PTR(req->err) but
> req->body, when process_writes()->xb_write() is failed.

The memory barrier below looks good. However, as mentionned in patch #1, 
barrier() is not the correct barrier to pair with virt_wmb().

> 
> Signed-off-by: Dongli Zhang <dongli.zhang@...cle.com>
> ---
>   drivers/xen/xenbus/xenbus_comms.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/xen/xenbus/xenbus_comms.c b/drivers/xen/xenbus/xenbus_comms.c
> index 852ed161fc2a..eb5151fc8efa 100644
> --- a/drivers/xen/xenbus/xenbus_comms.c
> +++ b/drivers/xen/xenbus/xenbus_comms.c
> @@ -397,6 +397,8 @@ static int process_writes(void)
>   	if (state.req->state == xb_req_state_aborted)
>   		kfree(state.req);
>   	else {
> +		/* write err, then update state */
> +		virt_wmb();
>   		state.req->state = xb_req_state_got_reply;
>   		wake_up(&state.req->wq);
>   	}
> 

Cheers,

-- 
Julien Grall

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ