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: <PH0PR11MB588065795A247B479F692401DAFD9@PH0PR11MB5880.namprd11.prod.outlook.com>
Date:   Thu, 12 Jan 2023 01:51:15 +0000
From:   "Zhang, Qiang1" <qiang1.zhang@...el.com>
To:     Frederic Weisbecker <frederic@...nel.org>,
        "paulmck@...nel.org" <paulmck@...nel.org>
CC:     "quic_neeraju@...cinc.com" <quic_neeraju@...cinc.com>,
        "joel@...lfernandes.org" <joel@...lfernandes.org>,
        "rcu@...r.kernel.org" <rcu@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] rcu: Fix the start_poll_synchronize_rcu_expedited() be
 invoked very early

On Wed, Jan 11, 2023 at 09:14:53PM +0800, Zqiang wrote:
> Currently, the start_poll_synchronize_rcu_expedited() can be invoked
> very early. before rcu_init(), the rcu_data structure's->mynode is not
> initialized, if invoke start_poll_synchronize_rcu_expedited() before
> rcu_init(), will access to NULL mynode pointer.
> 
> This commit therefore add exp_seq_poll_rq member to rcu_state structure
> to store snap seq number
>
>Is it even sane to poll that early in the morning? :-)

According to d96c52fe4907c ("rcu: Add polled expedited grace-period primitives "),
the start_poll_synchronize_rcu_expedited() can be invoked very early, that is to say
can be invoked before rcu_init(),  the following code snippet also shows that the 
start_poll_synchronize_rcu_expedited()  may be called early.

// Kick-start any polled grace periods that started early.
         if (!(per_cpu_ptr(&rcu_data, cpu)->mynode->exp_seq_poll_rq & 0x1))
                 (void)start_poll_synchronize_rcu_expedited();

But before rcu_init(), the rcu_data structure's->mynode is not initialized,
so at least, we set rnp->exp_seq_poll_rq should be in case the rcu_init_invoked()
returns true in start_poll_synchronize_rcu_expedited() .


>
> 
> Signed-off-by: Zqiang <qiang1.zhang@...el.com>
> ---
>  kernel/rcu/tree.c     | 3 ++-
>  kernel/rcu/tree.h     | 1 +
>  kernel/rcu/tree_exp.h | 6 ++++--
>  3 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index 63545d79da51..34b13d6bd8c4 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -92,6 +92,7 @@ static struct rcu_state rcu_state = {
>  	.exp_mutex = __MUTEX_INITIALIZER(rcu_state.exp_mutex),
>  	.exp_wake_mutex = __MUTEX_INITIALIZER(rcu_state.exp_wake_mutex),
>  	.ofl_lock = __ARCH_SPIN_LOCK_UNLOCKED,
> +	.exp_seq_poll_rq = RCU_GET_STATE_COMPLETED,
>
>I don't know if we really want to fix this, but assuming we do,
>can we rename it to boot_exp_seq_poll_rq? To avoid later confusion.

Will fix in next version.

Thanks
Zqiang

>
>Thanks.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ