[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFwpts0X=V67+wUchJN9Bgjh17eZJqOo0Y0oc2Mzbfa7QA@mail.gmail.com>
Date: Sun, 15 Apr 2012 16:42:45 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Oleg Nesterov <oleg@...hat.com>
Cc: "H. Peter Anvin" <hpa@...or.com>,
Chuck Ebbert <chuckebbert.lk@...il.com>,
Jan Kratochvil <jan.kratochvil@...hat.com>,
linux-kernel@...r.kernel.org
Subject: Re: ptrace && fpu_lazy_restore
On Sun, Apr 15, 2012 at 3:38 PM, Oleg Nesterov <oleg@...hat.com> wrote:
>
> Suppose that fpu_owner_task exits on CPU_0, and then fork() reuses
> its task_struct. The new child is still fpu_owner_task and this is
> obviously wrong (unless of course another thread uses fpu).
>
> Initially I thought this should be fixed too, but it seems that
> "p->fpu_counter = 0" in copy_thread() saves us.
>
> This looks a bit fragile... And could you confirm this is really
> fine?
That one is done by design. That fpu_counter=0 in copy_thread() is
there explicitly to avoid the problem. Although it's possible that we
should reset last_cpu instead. However, that line was actually added
before the lazy thing - see commit cea20ca3f318.
> Btw, do we really need this "old->thread.fpu.last_cpu = ~0" in
> the "else" branch of switch_fpu_prepare()? Just curious, I guees
> this doesn't matter since we reset old->fpu_counter. But if we
> can remove this line, then perhaps we can another optimization.
Possibly not needed, but quite frankly, I'd rather have last_cpu never
contain some stale value.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists