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


Groups > linux.kernel > #1440748

Re: [kernel-hardening] [PATCH v4 26/29] sched: Allow putting thread_info into task_struct

From Mark Rutland <mark.rutland@arm.com>
Newsgroups linux.kernel
Subject Re: [kernel-hardening] [PATCH v4 26/29] sched: Allow putting thread_info into task_struct
Date 2016-07-11 18:40 +0200
Message-ID <rTMpr-19f-13@gated-at.bofh.it> (permalink)
References <rOqfT-8f8-5@gated-at.bofh.it> <rOqfU-8f8-33@gated-at.bofh.it> <rTGk2-5Co-29@gated-at.bofh.it> <rTKQG-8n2-1@gated-at.bofh.it> <rTMpr-19f-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Jul 11, 2016 at 09:06:58AM -0700, Linus Torvalds wrote:
> On Jul 11, 2016 7:55 AM, "Andy Lutomirski" <[1]luto@amacapital.net> wrote:
> >
> > How do you intend to find 'current' to get to the preempt count
> > without first disabling preemption?
>
> Actually, that is the classic case of "not a problem".
>
> The thing is, it doesn't matter if you schedule away while looking up
> current or the preempt count - because both values are idempotent wet
> scheduling.
>
> So until you do the wire that actually disables preemption you can
> schedule away as much as you want, and after that write you no longer
> will.

I was assuming a percpu pointer to current (or preempt count).

The percpu offset might be stale at the point you try to dereference
that, even though current itself hasn't changed, and you may access the
wrong CPU's value.

> This is different wrt a per-cpu area - which is clearly not idempotent wrt
> scheduling.
>
> The reason per-cpu works on x86 is that we have an atomic rmw operation
> that is *also* atomic wrt the CPU lookup (thanks to the segment base)

Sure, understood.

Mark.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [kernel-hardening] [PATCH v4 26/29] sched: Allow putting  thread_info into task_struct Mark Rutland <mark.rutland@arm.com> - 2016-07-11 12:10 +0200
  Re: [kernel-hardening] [PATCH v4 26/29] sched: Allow putting  thread_info into task_struct Andy Lutomirski <luto@amacapital.net> - 2016-07-11 17:00 +0200
    Re: [kernel-hardening] [PATCH v4 26/29] sched: Allow putting  thread_info into task_struct Mark Rutland <mark.rutland@arm.com> - 2016-07-11 17:10 +0200
    Re: [kernel-hardening] [PATCH v4 26/29] sched: Allow putting  thread_info into task_struct Mark Rutland <mark.rutland@arm.com> - 2016-07-11 18:40 +0200
      Re: [kernel-hardening] [PATCH v4 26/29] sched: Allow putting  thread_info into task_struct Linus Torvalds <torvalds@linux-foundation.org> - 2016-07-11 18:50 +0200

csiph-web