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-next>] [day] [month] [year] [list]
Date:   Mon, 29 Jun 2020 18:19:46 +0000
From:   Andres Beltran <t-mabelt@...rosoft.com>
To:     Wei Liu <wei.liu@...nel.org>, Andres Beltran <lkmlabelt@...il.com>
CC:     KY Srinivasan <kys@...rosoft.com>,
        Haiyang Zhang <haiyangz@...rosoft.com>,
        Stephen Hemminger <sthemmin@...rosoft.com>,
        "linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Michael Kelley <mikelley@...rosoft.com>,
        "parri.andrea@...il.com" <parri.andrea@...il.com>
Subject: Re: [PATCH 1/3] Drivers: hv: vmbus: Add vmbus_requestor data
 structure for VMBus hardening

From: linux-hyperv-owner@...r.kernel.org <linux-hyperv-owner@...r.kernel.org> On Behalf
Of Wei Liu. Sent: Friday, June 26, 2020 9:20 AM
> >  static int __vmbus_open(struct vmbus_channel *newchannel,
> >  		       void *userdata, u32 userdatalen,
> >  		       void (*onchannelcallback)(void *context), void *context)
> > @@ -122,6 +186,7 @@ static int __vmbus_open(struct vmbus_channel *newchannel,
> >  	u32 send_pages, recv_pages;
> >  	unsigned long flags;
> >  	int err;
> > +	int rqstor;
> >
> >  	if (userdatalen > MAX_USER_DEFINED_BYTES)
> >  		return -EINVAL;
> > @@ -132,6 +197,14 @@ static int __vmbus_open(struct vmbus_channel *newchannel,
> >  	if (newchannel->state != CHANNEL_OPEN_STATE)
> >  		return -EINVAL;
> >
> > +	/* Create and init requestor */
> > +	if (newchannel->rqstor_size) {
> > +		rqstor = vmbus_alloc_requestor(&newchannel->requestor,
> > +					       newchannel->rqstor_size);
> 
> You can simply use err here to store the return value or even get rid of
> rqstor by doing

Right. I will do that.

> > @@ -937,3 +1014,75 @@ int vmbus_recvpacket_raw(struct vmbus_channel *channel, void
> *buffer,
> >  				  buffer_actual_len, requestid, true);
> >  }
> >  EXPORT_SYMBOL_GPL(vmbus_recvpacket_raw);
> > +
> > +/*
> > + * vmbus_next_request_id - Returns a new request id. It is also
> > + * the index at which the guest memory address is stored.
> > + * Uses a spin lock to avoid race conditions.
> > + * @rqstor: Pointer to the requestor struct
> > + * @rqst_add: Guest memory address to be stored in the array
> > + */
> > +u64 vmbus_next_request_id(struct vmbus_requestor *rqstor, u64 rqst_addr)
> > +{
> > +	unsigned long flags;
> > +	u64 current_id;
> > +
> > +	spin_lock_irqsave(&rqstor->req_lock, flags);
> 
> Do you really need the irqsave variant here? I.e. is there really a
> chance this code is reachable from an interrupt handler?

Other VMBus drivers will also need to use this functionality, and
some of them will be called with interrupts disabled. So, I think
we should keep the irqsave variant here.

Andres.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ