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:   Fri, 14 Sep 2018 11:01:14 +0200
From:   Juergen Gross <jgross@...e.com>
To:     Dongli Zhang <dongli.zhang@...cle.com>,
        xen-devel@...ts.xenproject.org, linux-kernel@...r.kernel.org
Cc:     boris.ostrovsky@...cle.com, paul.durrant@...rix.com,
        wei.liu2@...rix.com, konrad.wilk@...cle.com, roger.pau@...rix.com,
        srinivas.eeda@...cle.com
Subject: Re: [PATCH 3/6] xenbus: dispatch per-domU watch event to per-domU
 xenwatch thread

On 14/09/18 09:34, Dongli Zhang wrote:
> This is the 3rd patch of a (6-patch) patch set.
> 
> This patch dispatches the watch event to per-domU xenwatch thread when the
> event meets all of below conditions:
> 
> 1. The watch is registered to use xenwatch multithreading feature and the
>    get_domid() method returns valid domid.
> 2. There is xenwatch thread (mtwatch domain) available for the domid
>    obtained from get_domid() method.
> 3. The xenwatch thread is forked successfully by kthread_run() during
>    initialization and therefore its state should be MTWATCH_DOMAIN_UP.
> 
> Signed-off-by: Dongli Zhang <dongli.zhang@...cle.com>
> ---
>  drivers/xen/xenbus/xenbus_xs.c | 53 ++++++++++++++++++++++++++++++++++++++----
>  1 file changed, 49 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c
> index 741dc54..7335e19 100644
> --- a/drivers/xen/xenbus/xenbus_xs.c
> +++ b/drivers/xen/xenbus/xenbus_xs.c
> @@ -896,6 +896,32 @@ static struct xenbus_watch *find_watch(const char *token)
>  	return NULL;
>  }
>  
> +static int xs_watch_insert_event(struct xs_watch_event *event, domid_t domid)
> +{
> +	struct mtwatch_domain *domain;
> +	int ret = -1;
> +
> +	rcu_read_lock();
> +
> +	domain = mtwatch_find_domain(domid);
> +	if (!domain) {
> +		rcu_read_unlock();
> +		return ret;
> +	}
> +
> +	spin_lock(&domain->events_lock);
> +	if (domain->state == MTWATCH_DOMAIN_UP) {
> +		list_add_tail(&event->list, &domain->events);
> +		wake_up(&domain->events_wq);
> +		ret = 0;
> +	}
> +	spin_unlock(&domain->events_lock);
> +
> +	rcu_read_unlock();
> +
> +	return ret;
> +}
> +
>  int xs_watch_msg(struct xs_watch_event *event)
>  {
>  	if (count_strings(event->body, event->len) != 2) {
> @@ -908,10 +934,29 @@ int xs_watch_msg(struct xs_watch_event *event)
>  	spin_lock(&watches_lock);
>  	event->handle = find_watch(event->token);
>  	if (event->handle != NULL) {
> -		spin_lock(&watch_events_lock);
> -		list_add_tail(&event->list, &watch_events);
> -		wake_up(&watch_events_waitq);
> -		spin_unlock(&watch_events_lock);
> +		domid_t domid = 0;

I won't repeat it again (including following patches): use another
special value like DOMID_SELF.


Juergen

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ