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: <DM6PR11MB4138B6E8265A903DA8F68E4EF0A49@DM6PR11MB4138.namprd11.prod.outlook.com>
Date:   Wed, 8 Jun 2022 15:46:49 +0000
From:   "Xu, Yanfei" <yanfei.xu@...el.com>
To:     Peter Zijlstra <peterz@...radead.org>
CC:     "mingo@...hat.com" <mingo@...hat.com>,
        "acme@...nel.org" <acme@...nel.org>,
        "mark.rutland@....com" <mark.rutland@....com>,
        "alexander.shishkin@...ux.intel.com" 
        <alexander.shishkin@...ux.intel.com>,
        "jolsa@...nel.org" <jolsa@...nel.org>,
        "namhyung@...nel.org" <namhyung@...nel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-perf-users@...r.kernel.org" <linux-perf-users@...r.kernel.org>
Subject: RE: [PATCH] perf/core: remove a meaningless pair of
 rcu_read_{,un}lock()



> -----Original Message-----
> From: Peter Zijlstra <peterz@...radead.org>
> Sent: Wednesday, June 8, 2022 5:43 PM
> To: Xu, Yanfei <yanfei.xu@...el.com>
> Cc: mingo@...hat.com; acme@...nel.org; mark.rutland@....com;
> alexander.shishkin@...ux.intel.com; jolsa@...nel.org; namhyung@...nel.org;
> linux-kernel@...r.kernel.org; linux-perf-users@...r.kernel.org
> Subject: Re: [PATCH] perf/core: remove a meaningless pair of
> rcu_read_{,un}lock()
> 
> On Wed, Jun 08, 2022 at 05:09:38PM +0800, Yanfei Xu wrote:
> > Per the codes, this pair of rcu_read_{,un}lock() protects nothing.
> > Let's remove it.
> >
> > Further, the variable "pmu" is safe as it is in the SRCU read-side
> > critical scope of "pmus_srcu" and perf_pmu_unregister() delete it
> > after calling synchronize_srcu.
> >
> > Signed-off-by: Yanfei Xu <yanfei.xu@...el.com>
> > ---
> >  kernel/events/core.c | 2 --
> >  1 file changed, 2 deletions(-)
> >
> > diff --git a/kernel/events/core.c b/kernel/events/core.c index
> > 950b25c3f210..36b0df6feab4 100644
> > --- a/kernel/events/core.c
> > +++ b/kernel/events/core.c
> > @@ -11296,9 +11296,7 @@ static struct pmu *perf_init_event(struct
> perf_event *event)
> >  	}
> >
> >  again:
> > -	rcu_read_lock();
> >  	pmu = idr_find(&pmu_idr, type);
> > -	rcu_read_unlock();
> 
> You're mistaken, this is required for the radix tree internal nodes.
> Without it we can't safely traverse the radix tree without full serialization
> against the modifiers.
Thanks your reminder! And after digging and learning these commits: f9c46d6ea5ce ("idr: make idr_find rcu-safe ") and 452a68d0ef34("KVM: hyperv: idr_find needs RCU protection "). Now I understand it.

Thanks,
Yanfei

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ