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]
Message-ID: <20111214121124.GA18317@amt.cnet>
Date:	Wed, 14 Dec 2011 10:11:24 -0200
From:	Marcelo Tosatti <mtosatti@...hat.com>
To:	Eric B Munson <emunson@...bm.net>
Cc:	Avi Kivity <avi@...hat.com>, mingo@...hat.com, hpa@...or.com,
	arnd@...db.de, ryanh@...ux.vnet.ibm.com, aliguori@...ibm.com,
	jeremy.fitzhardinge@...rix.com, levinsasha928@...il.com,
	Jan Kiszka <jan.kiszka@...mens.com>, kvm@...r.kernel.org,
	linux-arch@...r.kernel.org, x86@...nel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/5 V5] Add functions to check if the host has stopped
 the vm

On Thu, Dec 08, 2011 at 10:23:10AM -0500, Eric B Munson wrote:
> On Wed, 07 Dec 2011, Avi Kivity wrote:
> 
> > On 12/05/2011 10:19 PM, Eric B Munson wrote:
> > > When a host stops or suspends a VM it will set a flag to show this.  The
> > > watchdog will use these functions to determine if a softlockup is real, or the
> > > result of a suspended VM.
> > >  
> > > +bool kvm_check_and_clear_guest_paused(int cpu)
> > > +{
> > > +	bool ret = false;
> > > +	struct pvclock_vcpu_time_info *src;
> > > +
> > > +	/*
> > > +	 * per_cpu() is safe here because this function is only called from
> > > +	 * timer functions where preemption is already disabled.
> > > +	 */
> > > +	WARN_ON(!in_atomic());
> > > +	src = &per_cpu(hv_clock, cpu);
> > 
> > __get_cpu_var(); drop the cpu argument
> > 
> 
> Will change for V6.
> 
> > > +	if ((src->flags & PVCLOCK_GUEST_STOPPED) != 0) {
> > > +		src->flags = src->flags & (~PVCLOCK_GUEST_STOPPED);
> > 
> > Isn't this racy?  Between reading and writing src->flags, we can exit to
> > the hypervisor and add/remove new flags.  The write then overrides those
> > new flags.
> > 
> 
> If I understand (please correct me if this is wrong) because this is only
> called from the watchdog, which disables preemption, we should be protected
> from something else writing to these flags.

The host can write, but in that case race is harmless.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ