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:   Thu, 21 Nov 2019 19:32:57 +0100
From:   Ingo Molnar <mingo@...nel.org>
To:     Marco Elver <elver@...gle.com>
Cc:     peterz@...radead.org, mingo@...hat.com, will@...nel.org,
        linux-kernel@...r.kernel.org, Qian Cai <cai@....pw>,
        Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH] spinlock_debug: Fix various data races


* Marco Elver <elver@...gle.com> wrote:

>  static inline void debug_spin_lock_after(raw_spinlock_t *lock)
>  {
> -	lock->owner_cpu = raw_smp_processor_id();
> -	lock->owner = current;
> +	WRITE_ONCE(lock->owner_cpu, raw_smp_processor_id());
> +	WRITE_ONCE(lock->owner, current);
>  }

debug_spin_lock_after() runs inside the spinlock itself - why do these 
writes have to be WRITE_ONCE()?

> @@ -197,8 +197,8 @@ static inline void debug_write_unlock(rwlock_t *lock)
>  	RWLOCK_BUG_ON(lock->owner != current, lock, "wrong owner");
>  	RWLOCK_BUG_ON(lock->owner_cpu != raw_smp_processor_id(),
>  							lock, "wrong CPU");
> -	lock->owner = SPINLOCK_OWNER_INIT;
> -	lock->owner_cpu = -1;
> +	WRITE_ONCE(lock->owner, SPINLOCK_OWNER_INIT);
> +	WRITE_ONCE(lock->owner_cpu, -1);
>  }

This too is running inside the critical section of the spinlock - why are 
the WRITE_ONCE() calls necessary?

Thanks,

	Ingo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ