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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 18 May 2022 17:09:55 +0200
From:   nicolas saenz julienne <nsaenz@...nel.org>
To:     Frederic Weisbecker <frederic@...nel.org>,
        LKML <linux-kernel@...r.kernel.org>
Cc:     Peter Zijlstra <peterz@...radead.org>,
        Phil Auld <pauld@...hat.com>,
        Alex Belits <abelits@...vell.com>,
        Xiongfeng Wang <wangxiongfeng2@...wei.com>,
        Neeraj Upadhyay <quic_neeraju@...cinc.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Yu Liao <liaoyu15@...wei.com>,
        Boqun Feng <boqun.feng@...il.com>,
        "Paul E . McKenney" <paulmck@...nel.org>,
        Marcelo Tosatti <mtosatti@...hat.com>,
        Paul Gortmaker <paul.gortmaker@...driver.com>,
        Uladzislau Rezki <uladzislau.rezki@...y.com>,
        Joel Fernandes <joel@...lfernandes.org>
Subject: Re: [PATCH 20/21] context_tracking: Convert state to atomic_t

On Tue, 2022-05-03 at 12:00 +0200, Frederic Weisbecker wrote:

[...]

> +/**
> + * ct_state() - return the current context tracking state if known
> + *
> + * Returns the current cpu's context tracking state if context tracking
> + * is enabled.  If context tracking is disabled, returns
> + * CONTEXT_DISABLED.  This should be used primarily for debugging.
> + */
> +static __always_inline int ct_state(void)
> +{
> +	int ret;
> +
> +	if (!context_tracking_enabled())
> +		return CONTEXT_DISABLED;
> +
> +	preempt_disable();
> +	ret = __ct_state();
> +	preempt_enable();
> +
> +	return ret;
> +}
> +

I can't see any use for this function with preemption enabled. You can't trust
the data due to CPU migration and it could be a source of bugs in the future.
Wouldn't it make more sense to move the burden into the callers? They all DTRT,
plus, this_cpu_ptr() will spew warnings if someone shows up and doesn't comply.

Regards,

-- 
Nicolás Sáenz

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ