From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Will Deacon <will.deacon@arm.com>
Cc: "Wang, Yalin" <Yalin.Wang@sonymobile.com>,
'richard -rw- weinberger' <richard.weinberger@gmail.com>,
"'linux-arch@vger.kernel.org'" <linux-arch@vger.kernel.org>,
"'linux-kernel@vger.kernel.org'" <linux-kernel@vger.kernel.org>,
"'linux-arm-kernel@lists.infradead.org'"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: A bug about system call on ARM
Date: Mon, 3 Jun 2013 11:45:34 +0100 [thread overview]
Message-ID: <20130603104534.GL18614@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <20130603102723.GD32242@mudshark.cambridge.arm.com>
On Mon, Jun 03, 2013 at 11:27:23AM +0100, Will Deacon wrote:
> Hi Russell,
>
> On Mon, Jun 03, 2013 at 11:18:09AM +0100, Russell King - ARM Linux wrote:
> > On Thu, May 30, 2013 at 12:41:12PM +0100, Will Deacon wrote:
> > > +#if defined(CONFIG_OABI_COMPAT) || !defined(CONFIG_AEABI)
> > > + /*
> > > + * We may have faulted trying to load the SWI instruction due to
> > > + * concurrent page aging on another CPU. In this case, return
> > > + * back to the swi instruction and fault the page back.
> > > + */
> > > +9001:
> > > + sub lr, lr, #4
> > > + str lr, [sp, #S_PC]
> > > + b ret_fast_syscall
> > > +#endif
> >
> > The comment is wrong. If we get here, it means that the fault from
> > trying to loading the instruction can't be fixed up. Arguably, that
> > should result in a SIGSEGV being sent immediately, but we'll get to
> > that when we then try to re-load the instruction.
>
> Why would we kill the application in this case? The reported problem is
> where one CPU ages the page containing the swi instruction (mkold =>
> clears L_PTE_YOUNG => write 0 to the pte) in between the other CPU executing
> the swi and the kernel trying to read the immediate. The VMA is fine.
If you mark the instruction was a user-accessing instruction, the kernel
will handle the resulting exception, trying to make the page accessible.
If it is successful, then execution resumes as normal at the faulting
instruction and continues as if nothing happened.
If it can't make the page accessible (eg, out of memory) the exception
handler path (your code above) will be called instead. Normal action in
that case would be for a system call to return -EFAULT, but in this case
we can't know what the syscall was, so we don't know if userspace will
even pay attention to the returned error code. In any case, if the page
is no longer accessible, it's going to end up being killed by a SEGV
when we eventually return to userspace anyway.
> > What it means is that the page we were trying to execute has been
> > unmapped beneath us.
>
> Yes, as a result of the kernel aging it.
No - see above. The exception path is for more serious conditions than
that.
next prev parent reply other threads:[~2013-06-03 10:45 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-29 6:52 A bug about system call on ARM Wang, Yalin
2013-05-29 7:34 ` richard -rw- weinberger
2013-05-29 7:37 ` Wang, Yalin
2013-05-29 8:24 ` Wang, Yalin
2013-05-29 8:46 ` richard -rw- weinberger
2013-05-29 9:48 ` Will Deacon
2013-05-29 9:50 ` Wang, Yalin
2013-05-30 1:41 ` Wang, Yalin
2013-05-30 9:09 ` Will Deacon
2013-05-30 11:41 ` Will Deacon
2013-05-30 11:41 ` Will Deacon
2013-05-31 2:56 ` Wang, Yalin
2013-05-31 8:46 ` Will Deacon
2013-05-31 11:02 ` Wang, Yalin
2013-05-31 11:13 ` Will Deacon
2013-05-31 11:30 ` Wang, Yalin
2013-06-03 5:25 ` Wang, Yalin
2013-06-03 9:54 ` Will Deacon
2013-06-03 9:58 ` Wang, Yalin
2013-06-04 5:33 ` Wang, Yalin
2013-06-04 8:48 ` Will Deacon
2013-06-04 8:48 ` Will Deacon
2013-06-04 9:30 ` Wang, Yalin
2013-06-04 11:27 ` Will Deacon
2013-06-14 6:53 ` Wang, Yalin
2013-05-31 16:48 ` Nicolas Pitre
2013-05-31 16:52 ` Will Deacon
2013-05-31 3:54 ` Nicolas Pitre
2013-05-31 3:54 ` Nicolas Pitre
2013-05-31 8:45 ` Will Deacon
2013-06-03 10:18 ` Russell King - ARM Linux
2013-06-03 10:27 ` Will Deacon
2013-06-03 10:45 ` Russell King - ARM Linux [this message]
2013-06-03 12:39 ` Will Deacon
2013-05-29 8:54 ` Mikael Pettersson
2013-05-29 8:54 ` Mikael Pettersson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130603104534.GL18614@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=Yalin.Wang@sonymobile.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=richard.weinberger@gmail.com \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).