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] [day] [month] [year] [list]
Message-ID: <20200619223823.GL576888@hirez.programming.kicks-ass.net>
Date:   Sat, 20 Jun 2020 00:38:23 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Steven Rostedt <rostedt@...dmis.org>
Cc:     LKML <linux-kernel@...r.kernel.org>, philip.li@...el.com,
        Ingo Molnar <mingo@...nel.org>,
        Juri Lelli <juri.lelli@...hat.com>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Dietmar Eggemann <dietmar.eggemann@....com>,
        Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>
Subject: Re: [PATCH] sched: Have BUG_ON() check if linker sched classes don't
 line up correctly

On Fri, Jun 19, 2020 at 06:02:19PM -0400, Steven Rostedt wrote:
> From: Steven Rostedt (VMware) <rostedt@...dmis.org>
> 
> If the sched_class structures do not match how the compiler thinks they
> are in an array, it can cause hard to debug bugs. Change the BUG_ON()
> from making sure each of the sched classes are in the proper order, to
> also making sure they are off by the proper amount.
> 
> Signed-off-by: Steven Rostedt (VMware) <rostedt@...dmis.org>
> ---
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 7ad864dc3ac5..876d7ecdab52 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -6635,12 +6635,13 @@ void __init sched_init(void)
>  	unsigned long ptr = 0;
>  	int i;
>  
> -	BUG_ON(&idle_sched_class > &fair_sched_class ||
> -		&fair_sched_class > &rt_sched_class ||
> -		&rt_sched_class > &dl_sched_class);
> +	/* Make sure the linker didn't screw up */
> +	BUG_ON(&idle_sched_class + 1 != &fair_sched_class ||
> +		&fair_sched_class + 1 != &rt_sched_class ||
> +		&rt_sched_class + 1 != &dl_sched_class);
>  
>  #ifdef CONFIG_SMP
> -	BUG_ON(&dl_sched_class > &stop_sched_class);
> +	BUG_ON(&dl_sched_class + 1 != &stop_sched_class);
>  #endif

Nice, I'll fold that.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ