mbox series

[0/5] sched refcount_t conversions

Message ID 1547814450-18902-1-git-send-email-elena.reshetova@intel.com (mailing list archive)
Headers show
Series sched refcount_t conversions | expand

Message

Reshetova, Elena Jan. 18, 2019, 12:27 p.m. UTC
I would really love finally to merge these old patches
(now rebased on top of linux-next/master as of last friday),
since as far as I remember none has raised any more concerns
on them.

refcount_t has been now successfully used in kernel in many places,
helped to detect bugs and mistakes in logic of refcounters.

This series, for scheduler and task struct specifically,
replaces atomic_t reference counters with the new refcount_t type
and API (see include/linux/refcount.h).
By doing this we prevent intentional or accidental
underflows or overflows that can lead to use-after-free vulnerabilities.

The patches are fully independent and can be cherry-picked separately.
More information about each conversion in each patch separately.

Elena Reshetova (5):
  sched: convert sighand_struct.count to refcount_t
  sched: convert signal_struct.sigcnt to refcount_t
  sched: convert numa_group.refcount to refcount_t
  sched/task_struct: convert task_struct.usage to refcount_t
  sched/task_struct: convert task_struct.stack_refcount to refcount_t

 fs/exec.c                        |  4 ++--
 fs/proc/task_nommu.c             |  2 +-
 include/linux/init_task.h        |  1 +
 include/linux/sched.h            |  5 +++--
 include/linux/sched/signal.h     |  5 +++--
 include/linux/sched/task.h       |  4 ++--
 include/linux/sched/task_stack.h |  2 +-
 init/init_task.c                 |  6 +++---
 kernel/fork.c                    | 24 ++++++++++++------------
 kernel/sched/fair.c              | 12 ++++++------
 10 files changed, 34 insertions(+), 31 deletions(-)

Comments

Andrea Parri Jan. 18, 2019, 3:06 p.m. UTC | #1
On Fri, Jan 18, 2019 at 02:27:25PM +0200, Elena Reshetova wrote:
> I would really love finally to merge these old patches
> (now rebased on top of linux-next/master as of last friday),
> since as far as I remember none has raised any more concerns
> on them.
> 
> refcount_t has been now successfully used in kernel in many places,
> helped to detect bugs and mistakes in logic of refcounters.
> 
> This series, for scheduler and task struct specifically,
> replaces atomic_t reference counters with the new refcount_t type
> and API (see include/linux/refcount.h).
> By doing this we prevent intentional or accidental
> underflows or overflows that can lead to use-after-free vulnerabilities.
> 
> The patches are fully independent and can be cherry-picked separately.
> More information about each conversion in each patch separately.
> 
> Elena Reshetova (5):
>   sched: convert sighand_struct.count to refcount_t
>   sched: convert signal_struct.sigcnt to refcount_t
>   sched: convert numa_group.refcount to refcount_t
>   sched/task_struct: convert task_struct.usage to refcount_t
>   sched/task_struct: convert task_struct.stack_refcount to refcount_t

For the series, please feel free to add:

Reviewed-by: Andrea Parri <andrea.parri@amarulasolutions.com>

(You may still want to update the references to the 'refcount-vs-atomic'
 doc. in the commit messages.)

  Andrea


> 
>  fs/exec.c                        |  4 ++--
>  fs/proc/task_nommu.c             |  2 +-
>  include/linux/init_task.h        |  1 +
>  include/linux/sched.h            |  5 +++--
>  include/linux/sched/signal.h     |  5 +++--
>  include/linux/sched/task.h       |  4 ++--
>  include/linux/sched/task_stack.h |  2 +-
>  init/init_task.c                 |  6 +++---
>  kernel/fork.c                    | 24 ++++++++++++------------
>  kernel/sched/fair.c              | 12 ++++++------
>  10 files changed, 34 insertions(+), 31 deletions(-)
> 
> -- 
> 2.7.4
>
Peter Zijlstra Jan. 18, 2019, 4:03 p.m. UTC | #2
On Fri, Jan 18, 2019 at 02:27:25PM +0200, Elena Reshetova wrote:
> Elena Reshetova (5):
>   sched: convert sighand_struct.count to refcount_t
>   sched: convert signal_struct.sigcnt to refcount_t

These should really be seen by Oleg (bounced) and I'll await his reply.

>   sched: convert numa_group.refcount to refcount_t
>   sched/task_struct: convert task_struct.usage to refcount_t
>   sched/task_struct: convert task_struct.stack_refcount to refcount_t

Those are ok and I'll queue them.
Reshetova, Elena Jan. 18, 2019, 5:40 p.m. UTC | #3
> On Fri, Jan 18, 2019 at 02:27:25PM +0200, Elena Reshetova wrote:
> > Elena Reshetova (5):
> >   sched: convert sighand_struct.count to refcount_t
> >   sched: convert signal_struct.sigcnt to refcount_t
> 
> These should really be seen by Oleg (bounced) and I'll await his reply.
> 
> >   sched: convert numa_group.refcount to refcount_t
> >   sched/task_struct: convert task_struct.usage to refcount_t
> >   sched/task_struct: convert task_struct.stack_refcount to refcount_t
> 
> Those are ok and I'll queue them.

Thank you Peter! 

Best Regards,
Elena
Reshetova, Elena Jan. 18, 2019, 5:41 p.m. UTC | #4
> On Fri, Jan 18, 2019 at 02:27:25PM +0200, Elena Reshetova wrote:
> > I would really love finally to merge these old patches
> > (now rebased on top of linux-next/master as of last friday),
> > since as far as I remember none has raised any more concerns
> > on them.
> >
> > refcount_t has been now successfully used in kernel in many places,
> > helped to detect bugs and mistakes in logic of refcounters.
> >
> > This series, for scheduler and task struct specifically,
> > replaces atomic_t reference counters with the new refcount_t type
> > and API (see include/linux/refcount.h).
> > By doing this we prevent intentional or accidental
> > underflows or overflows that can lead to use-after-free vulnerabilities.
> >
> > The patches are fully independent and can be cherry-picked separately.
> > More information about each conversion in each patch separately.
> >
> > Elena Reshetova (5):
> >   sched: convert sighand_struct.count to refcount_t
> >   sched: convert signal_struct.sigcnt to refcount_t
> >   sched: convert numa_group.refcount to refcount_t
> >   sched/task_struct: convert task_struct.usage to refcount_t
> >   sched/task_struct: convert task_struct.stack_refcount to refcount_t
> 
> For the series, please feel free to add:
> 
> Reviewed-by: Andrea Parri <andrea.parri@amarulasolutions.com>

Thank you for your review!

Best Regards,
Elena
Reshetova, Elena Feb. 5, 2019, 11:57 a.m. UTC | #5
> On Fri, Jan 18, 2019 at 02:27:25PM +0200, Elena Reshetova wrote:
> > Elena Reshetova (5):
> >   sched: convert sighand_struct.count to refcount_t
> >   sched: convert signal_struct.sigcnt to refcount_t
> 
> These should really be seen by Oleg (bounced) and I'll await his reply.
> 
> >   sched: convert numa_group.refcount to refcount_t
> >   sched/task_struct: convert task_struct.usage to refcount_t
> >   sched/task_struct: convert task_struct.stack_refcount to refcount_t
> 
> Those are ok and I'll queue them.

Just to double check that nothing got lost in between: 
I noticed that above task_struct patches got merged, is numa_group one also
coming soon?

Best Regards,
Elena.
Peter Zijlstra Feb. 5, 2019, 12:31 p.m. UTC | #6
On Tue, Feb 05, 2019 at 11:57:00AM +0000, Reshetova, Elena wrote:
> > On Fri, Jan 18, 2019 at 02:27:25PM +0200, Elena Reshetova wrote:
> > > Elena Reshetova (5):
> > >   sched: convert sighand_struct.count to refcount_t
> > >   sched: convert signal_struct.sigcnt to refcount_t
> > 
> > These should really be seen by Oleg (bounced) and I'll await his reply.
> > 
> > >   sched: convert numa_group.refcount to refcount_t
> > >   sched/task_struct: convert task_struct.usage to refcount_t
> > >   sched/task_struct: convert task_struct.stack_refcount to refcount_t
> > 
> > Those are ok and I'll queue them.
> 
> Just to double check that nothing got lost in between: 
> I noticed that above task_struct patches got merged, is numa_group one also
> coming soon?

I have tip commit mails for all 5