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: <20171101183414.GA2929@roeck-us.net>
Date:   Wed, 1 Nov 2017 11:34:14 -0700
From:   Guenter Roeck <linux@...ck-us.net>
To:     Don Zickus <dzickus@...hat.com>
Cc:     Thomas Gleixner <tglx@...utronix.de>,
        Peter Zijlstra <peterz@...radead.org>,
        linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...nel.org>
Subject: Re: Crashes in perf_event_ctx_lock_nested

On Wed, Nov 01, 2017 at 02:11:27PM -0400, Don Zickus wrote:
> > 
> > Maybe watchdog_cpus needs to be atomic ?
> 
> I switched it to atomic and it solves that problem.  The functionality isn't
> broken currently, just the informational message.
> 
> Patch attached to try.
> 

Tested-by: Guenter Roeck <linux@...ck-us.net>

Thanks!
Guenter

> Cheers,
> Don
> 
> ---8<--------------
> 
> diff --git a/kernel/watchdog_hld.c b/kernel/watchdog_hld.c
> index a7f137c1933a..8ee4da223b35 100644
> --- a/kernel/watchdog_hld.c
> +++ b/kernel/watchdog_hld.c
> @@ -14,6 +14,7 @@
>  #include <linux/nmi.h>
>  #include <linux/module.h>
>  #include <linux/sched/debug.h>
> +#include <linux/atomic.h>

Alphabetical order, maybe ?

>  
>  #include <asm/irq_regs.h>
>  #include <linux/perf_event.h>
> @@ -25,7 +26,7 @@ static DEFINE_PER_CPU(struct perf_event *, dead_event);
>  static struct cpumask dead_events_mask;
>  
>  static unsigned long hardlockup_allcpu_dumped;
> -static unsigned int watchdog_cpus;
> +static atomic_t watchdog_cpus = ATOMIC_INIT(0);
>  
>  void arch_touch_nmi_watchdog(void)
>  {
> @@ -189,7 +190,8 @@ void hardlockup_detector_perf_enable(void)
>  	if (hardlockup_detector_event_create())
>  		return;
>  
> -	if (!watchdog_cpus++)
> +	/* use original value for check */
> +	if (!atomic_fetch_inc(&watchdog_cpus))
>  		pr_info("Enabled. Permanently consumes one hw-PMU counter.\n");
>  
>  	perf_event_enable(this_cpu_read(watchdog_ev));
> @@ -207,7 +209,7 @@ void hardlockup_detector_perf_disable(void)
>  		this_cpu_write(watchdog_ev, NULL);
>  		this_cpu_write(dead_event, event);
>  		cpumask_set_cpu(smp_processor_id(), &dead_events_mask);
> -		watchdog_cpus--;
> +		atomic_dec(&watchdog_cpus);
>  	}
>  }
>  

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ