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: <CAL26m8+0BC8Tbyaoh+VzGdE_ebr2_=hqV7eeH2m5=9v_v8=yOw@mail.gmail.com>
Date:   Fri, 7 Sep 2018 12:28:57 -0700
From:   Vaibhav Nagarnaik <vnagarnaik@...gle.com>
To:     Steven Rostedt <rostedt@...dmis.org>
Cc:     linux-kernel@...r.kernel.org, Jason Behmer <jbehmer@...gle.com>
Subject: Re: [PATCH] ring-buffer: Allow for rescheduling when removing pages

On Fri, Sep 7, 2018 at 11:30 AM Steven Rostedt <rostedt@...dmis.org> wrote:
>
> On Fri,  7 Sep 2018 11:21:31 -0700
> Vaibhav Nagarnaik <vnagarnaik@...gle.com> wrote:
>
> > When reducing ring buffer size, pages are removed by scheduling a work
> > item on each CPU for the corresponding CPU ring buffer. After the pages
> > are removed from ring buffer linked list, the pages are free()d in a
> > tight loop. The loop does not give up CPU until all pages are removed.
> > In a worst case behavior, when lot of pages are to be freed, it can
> > cause system stall.
> >
> > After the pages are removed from the list, the free() can happen while
> > the work is rescheduled. Add a check for need_sched() within the loop
> > to prevent the system hangup.
> >
> > Reported-by: Jason Behmer <jbehmer@...gle.com>
> > Signed-off-by: Vaibhav Nagarnaik <vnagarnaik@...gle.com>
> > ---
> >  kernel/trace/ring_buffer.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
> > index 1d92d4a982fd..bc1789df7c53 100644
> > --- a/kernel/trace/ring_buffer.c
> > +++ b/kernel/trace/ring_buffer.c
> > @@ -1546,6 +1546,9 @@ rb_remove_pages(struct ring_buffer_per_cpu *cpu_buffer, unsigned long nr_pages)
> >       tmp_iter_page = first_page;
> >
> >       do {
> > +             if (need_resched())
> > +                     schedule();
> > +
>
> Hi, thanks for the patch, but the proper way to do this is to stick in:
>
>                 cond_resched();
>
> And that should solve it for you. Want to send in another patch?

Sounds good. Let me update the patch. Testing it first though.

Vaibhav

> -- Steve
>
> >               to_remove_page = tmp_iter_page;
> >               rb_inc_page(cpu_buffer, &tmp_iter_page);
> >
>

Download attachment "smime.p7s" of type "application/pkcs7-signature" (4851 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ