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]
Date:   Tue, 15 May 2018 08:18:53 -0700
From:   Joel Fernandes <joel@...lfernandes.org>
To:     Frederic Weisbecker <frederic@...nel.org>
Cc:     Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        jolsa@...hat.com, namhyung@...nel.org,
        Peter Zijlstra <peterz@...radead.org>,
        torvalds@...ux-foundation.org, ysato@...rs.sourceforge.jp,
        benh@...nel.crashing.org,
        Catalin Marinas <catalin.marinas@....com>, chris@...kel.net,
        paulus@...ba.org, Thomas Gleixner <tglx@...utronix.de>,
        Will Deacon <will.deacon@....com>, mpe@...erman.id.au,
        dalias@...c.org, Ingo Molnar <mingo@...nel.org>,
        mark.rutland@....com, alexander.shishkin@...ux.intel.com,
        luto@...nel.org, acme@...nel.org, jcmvbkbc@...il.com
Subject: Re: [PATCH 8/9] perf/breakpoint: Split breakpoint "check" and
 "commit"

On Tue, May 15, 2018 at 03:53:00PM +0200, Frederic Weisbecker wrote:
> On Mon, May 07, 2018 at 12:46:06AM +0000, Joel Fernandes wrote:
> > On Sun, May 6, 2018 at 12:22 PM Frederic Weisbecker <frederic@...nel.org>
> > wrote:
> > 
> > > arch_validate_hwbkpt_settings() mixes up attribute check and commit into
> > > a single code entity. Therefore the validation may return an error due to
> > > incorrect atributes while still leaving halfway modified architecture
> > > breakpoint struct.
> > 
> > > Now that we have split its logic on all archs, we can remove this
> > > misdesigned function and call directly the arch check and commit
> > > functions instead. This allows us to later avoid commiting
> > > a breakpoint to architecture when its slot couldn't be allocated.
> > 
> > [...]
> > > diff --git a/kernel/events/hw_breakpoint.c b/kernel/events/hw_breakpoint.c
> > > index 6e28d28..6896ceeb 100644
> > > --- a/kernel/events/hw_breakpoint.c
> > > +++ b/kernel/events/hw_breakpoint.c
> > > @@ -402,11 +402,12 @@ int dbg_release_bp_slot(struct perf_event *bp)
> > 
> > >   static int validate_hw_breakpoint(struct perf_event *bp)
> > >   {
> > > -       int ret;
> > > +       int err;
> > 
> > > -       ret = arch_validate_hwbkpt_settings(bp);
> > > -       if (ret)
> > > -               return ret;
> > > +       err = hw_breakpoint_arch_check(bp, &bp->attr);
> > > +       if (err)
> > > +               return err;
> > > +       hw_breakpoint_arch_commit(bp);
> > 
> > minor nit:
> > To preserve bisectability, shouldn't this be the following in this and
> > earlier patches?
> > 
> >         err = hw_breakpoint_arch_check(bp, &bp->attr);
> >         hw_breakpoint_arch_commit(bp);
> >         if (err)
> >                 return err;
> > 
> > And then in patch 9/9 you can fix it the right way?
> 
> I don't see how it was breaking bisectability.

Sorry may be I used wrong words, I meant keeping the restructure patch as
just for restvructuring and then changing the logic later. But I'm Ok with
what you have, and also like Peter's __weak thing suggestion.

> Anyway I'm rewriting it entirely to use:
> 
>     struct arch_hw_breakpoint hw;
>     int err;
> 
>     err = hw_breakpoint_arch_parse(bp, attr, &hw);
>     if (err)
>         return err;

Cool, if you don't mind do CC me on patches, Thanks.

Just to update you about my email address change, the new one is: joel@...lfernandes.org

thanks,

- Joel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ