Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Jan 2013 15:50:51 +0100
From:      Olivier Houchard <mlfbsd@ci0.org>
To:        Oleksandr Tymoshenko <gonzo@bluezbox.com>
Cc:        arm@freebsd.org, okuno.kohji@jp.panasonic.com
Subject:   Re: Fwd: arm: cpu_switch() has bug?
Message-ID:  <20130114145051.GA77459@ci0.org>
In-Reply-To: <50F1E092.1050905@bluezbox.com>
References:  <20130109.193945.561808600309975779.okuno.kohji@jp.panasonic.com> <50F1E092.1050905@bluezbox.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

> Hi,
> 
> I have doubt if cpu_switch() of arm has a bug.
> 
> In swtch.S:L.334, if newtd->td_pcb (this is in stack pointer for
> kernel) has an address accessed first for the old(current) thread,
> data_abort_fault may occur.
> 
> When data_abort_fault occurs, data_abort_handler() tries to solve this
> address from kernel_map. In this time, curthread and curpcb are
> already updated in swtch.S:L.223-231. As this result,
> data_abort_handler() will occur data_abort_fault in trap.c:L.301, again.
> 
> When I check, in other CPUs, after updating the root pointer of MMU,
> curthread and curpcb are updated.
> 
> Would you please check this?
> 
> Thanks,
>  Kohji Okuno

I don't think it can happen, when we reach cpu_switch(), both the old thread
and the new thread should be swapped in, so the kstack for both will be mapped,
and we won't get a data abort when trying to access it.
I agree however it may come back to hunt us one day, so I'll see if I can not
easily move that later in the process, after we switched the page tables.

Regards,

Olivier



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130114145051.GA77459>