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: <20211118110931.GB5233@lakrids.cambridge.arm.com>
Date:   Thu, 18 Nov 2021 11:09:31 +0000
From:   Mark Rutland <mark.rutland@....com>
To:     Marco Elver <elver@...gle.com>
Cc:     "Paul E. McKenney" <paulmck@...nel.org>,
        Alexander Potapenko <glider@...gle.com>,
        Boqun Feng <boqun.feng@...il.com>,
        Borislav Petkov <bp@...en8.de>,
        Dmitry Vyukov <dvyukov@...gle.com>,
        Ingo Molnar <mingo@...nel.org>,
        Josh Poimboeuf <jpoimboe@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Waiman Long <longman@...hat.com>,
        Will Deacon <will@...nel.org>, kasan-dev@...glegroups.com,
        linux-arch@...r.kernel.org, linux-doc@...r.kernel.org,
        linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-mm@...ck.org, x86@...nel.org
Subject: Re: [PATCH v2 02/23] kcsan: Remove redundant zero-initialization of
 globals

On Thu, Nov 18, 2021 at 09:10:06AM +0100, Marco Elver wrote:
> They are implicitly zero-initialized, remove explicit initialization.
> It keeps the upcoming additions to kcsan_ctx consistent with the rest.
> 
> No functional change intended.
> 
> Signed-off-by: Marco Elver <elver@...gle.com>
> ---
>  init/init_task.c    | 9 +--------
>  kernel/kcsan/core.c | 5 -----
>  2 files changed, 1 insertion(+), 13 deletions(-)
> 
> diff --git a/init/init_task.c b/init/init_task.c
> index 2d024066e27b..61700365ce58 100644
> --- a/init/init_task.c
> +++ b/init/init_task.c
> @@ -181,14 +181,7 @@ struct task_struct init_task
>  	.kasan_depth	= 1,
>  #endif
>  #ifdef CONFIG_KCSAN
> -	.kcsan_ctx = {
> -		.disable_count		= 0,
> -		.atomic_next		= 0,
> -		.atomic_nest_count	= 0,
> -		.in_flat_atomic		= false,
> -		.access_mask		= 0,
> -		.scoped_accesses	= {LIST_POISON1, NULL},
> -	},
> +	.kcsan_ctx = { .scoped_accesses = {LIST_POISON1, NULL} },

I'd recommend leaving this as:

	.kcsan_ctx = {
		.scoped_accesses = {LIST_POISON1, NULL},
	},

... which'd be consistent with the DEFINE_PER_CPU() usage below, and
makes it easier to add fields to in future without needing structural
changes.

Either way:

Acked-by: Mark Rutland <mark.rutland@....com>

>  #endif
>  #ifdef CONFIG_TRACE_IRQFLAGS
>  	.softirqs_enabled = 1,
> diff --git a/kernel/kcsan/core.c b/kernel/kcsan/core.c
> index 6bfd3040f46b..e34a1710b7bc 100644
> --- a/kernel/kcsan/core.c
> +++ b/kernel/kcsan/core.c
> @@ -44,11 +44,6 @@ bool kcsan_enabled;
>  
>  /* Per-CPU kcsan_ctx for interrupts */
>  static DEFINE_PER_CPU(struct kcsan_ctx, kcsan_cpu_ctx) = {
> -	.disable_count		= 0,
> -	.atomic_next		= 0,
> -	.atomic_nest_count	= 0,
> -	.in_flat_atomic		= false,
> -	.access_mask		= 0,
>  	.scoped_accesses	= {LIST_POISON1, NULL},
>  };
>  
> -- 
> 2.34.0.rc2.393.gf8c9666880-goog
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ