Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1491345 > unrolled thread

[PATCH 0/3] Kill off show_stack() NULL-implies-current idiom

Started byMark Rutland <mark.rutland@arm.com>
First post2016-09-26 17:20 +0200
Last post2016-09-27 20:00 +0200
Articles 4 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/3] Kill off show_stack() NULL-implies-current idiom Mark Rutland <mark.rutland@arm.com> - 2016-09-26 17:20 +0200
    Re: [PATCH 0/3] Kill off show_stack() NULL-implies-current idiom Josh Poimboeuf <jpoimboe@redhat.com> - 2016-09-26 22:10 +0200
      Re: [PATCH 0/3] Kill off show_stack() NULL-implies-current idiom Mark Rutland <mark.rutland@arm.com> - 2016-09-26 23:40 +0200
      Re: [PATCH 0/3] Kill off show_stack() NULL-implies-current idiom Mark Rutland <mark.rutland@arm.com> - 2016-09-27 20:00 +0200

#1491345 — [PATCH 0/3] Kill off show_stack() NULL-implies-current idiom

FromMark Rutland <mark.rutland@arm.com>
Date2016-09-26 17:20 +0200
Subject[PATCH 0/3] Kill off show_stack() NULL-implies-current idiom
Message-ID<slFRg-5rZ-9@gated-at.bofh.it>
Today, show_stack() accepts a NULL task parameter, which it takes to mean the
current task. However, as noted in tip/x86/asm commit:

  81539169f283329f ("x86/dumpstack: Remove NULL task pointer convention")

... having a NULL task parameter imply current leads to subtle bugs in stack
walking code (so far seen on both 86 and arm64), makes callsites harder to
read, and is unnecessary as all callers have access to current.

As a step towards removing the problematic NULL-implies-current idiom entirely,
these patches ensure that generic code explictly passes current to
show_stack(), rather than relying on arch code to handle NULL.

Thanks,
Mark.

Mark Rutland (3):
  sched: document that show_stack() should not be passed a NULL task
  drivers/tty: Explicitly pass current to show_stack
  lib: dump_stack: explicitly pass current to show_stack

 drivers/tty/sysrq.c   | 2 +-
 include/linux/sched.h | 3 +++
 lib/dump_stack.c      | 2 +-
 3 files changed, 5 insertions(+), 2 deletions(-)

-- 
2.7.4

[toc] | [next] | [standalone]


#1491535

FromJosh Poimboeuf <jpoimboe@redhat.com>
Date2016-09-26 22:10 +0200
Message-ID<slKnT-8jM-1@gated-at.bofh.it>
In reply to#1491345
On Mon, Sep 26, 2016 at 04:16:16PM +0100, Mark Rutland wrote:
> Today, show_stack() accepts a NULL task parameter, which it takes to mean the
> current task. However, as noted in tip/x86/asm commit:
> 
>   81539169f283329f ("x86/dumpstack: Remove NULL task pointer convention")
> 
> ... having a NULL task parameter imply current leads to subtle bugs in stack
> walking code (so far seen on both 86 and arm64), makes callsites harder to
> read, and is unnecessary as all callers have access to current.
> 
> As a step towards removing the problematic NULL-implies-current idiom entirely,
> these patches ensure that generic code explictly passes current to
> show_stack(), rather than relying on arch code to handle NULL.

This is a good step, though it would be really nice to fix this
tree-wide.  Do you have any plans to do so?

Regardless, for the series:

Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com>

-- 
Josh

[toc] | [prev] | [next] | [standalone]


#1491563

FromMark Rutland <mark.rutland@arm.com>
Date2016-09-26 23:40 +0200
Message-ID<slLMZ-D5-15@gated-at.bofh.it>
In reply to#1491535
On Mon, Sep 26, 2016 at 03:01:36PM -0500, Josh Poimboeuf wrote:
> On Mon, Sep 26, 2016 at 04:16:16PM +0100, Mark Rutland wrote:
> > Today, show_stack() accepts a NULL task parameter, which it takes to mean the
> > current task. However, as noted in tip/x86/asm commit:
> > 
> >   81539169f283329f ("x86/dumpstack: Remove NULL task pointer convention")
> > 
> > ... having a NULL task parameter imply current leads to subtle bugs in stack
> > walking code (so far seen on both 86 and arm64), makes callsites harder to
> > read, and is unnecessary as all callers have access to current.
> > 
> > As a step towards removing the problematic NULL-implies-current idiom entirely,
> > these patches ensure that generic code explictly passes current to
> > show_stack(), rather than relying on arch code to handle NULL.
> 
> This is a good step, though it would be really nice to fix this
> tree-wide.  Do you have any plans to do so?

FWIW, I completely agree, though I have no plans to do so currently.

I'd meant to Cc linux-arch for this series in order to make people aware,
though evidently I did not. I can Cc subsequent arm64 NULL-implies-current
cleanup patches there, if that's helpful?

> Regardless, for the series:
> 
> Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com>

Cheers!

Thanks,
Mark.

[toc] | [prev] | [next] | [standalone]


#1492078

FromMark Rutland <mark.rutland@arm.com>
Date2016-09-27 20:00 +0200
Message-ID<sm4PD-441-7@gated-at.bofh.it>
In reply to#1491535
On Mon, Sep 26, 2016 at 03:01:36PM -0500, Josh Poimboeuf wrote:
> On Mon, Sep 26, 2016 at 04:16:16PM +0100, Mark Rutland wrote:
> > Today, show_stack() accepts a NULL task parameter, which it takes to mean the
> > current task. However, as noted in tip/x86/asm commit:
> > 
> >   81539169f283329f ("x86/dumpstack: Remove NULL task pointer convention")
> > 
> > ... having a NULL task parameter imply current leads to subtle bugs in stack
> > walking code (so far seen on both 86 and arm64), makes callsites harder to
> > read, and is unnecessary as all callers have access to current.
> > 
> > As a step towards removing the problematic NULL-implies-current idiom entirely,
> > these patches ensure that generic code explictly passes current to
> > show_stack(), rather than relying on arch code to handle NULL.
> 
> This is a good step, though it would be really nice to fix this
> tree-wide.  Do you have any plans to do so?

I started having a go, and in doing so I've realised that as things stand,
these patches are broken, as some architectures don't handle current
explicitly.

Please disregard all patches in this series.

Apologies,
Mark.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web