From: ccross@android.com (Colin Cross)
To: linux-arm-kernel@lists.infradead.org
Subject: MT_HIGH_VECTOR mapping set read-only creating illegal access
Date: Tue, 19 Apr 2011 20:26:27 -0700 [thread overview]
Message-ID: <BANLkTinyqs392n1v4M7ZKqPhkJU3Nzs5MA@mail.gmail.com> (raw)
In-Reply-To: <alpine.LFD.2.00.1104192249440.24613@xanadu.home>
On Tue, Apr 19, 2011 at 8:01 PM, Nicolas Pitre <nico@fluxnic.net> wrote:
> On Tue, 19 Apr 2011, Michael Bohan wrote:
>
>> On 4/19/2011 5:21 PM, Nicolas Pitre wrote:
>> > Are you saying that your user space libc was reading at 0xffff0ff0
>> > directly? ?I hope not, because if you did so, you clearly abused the
>> > interface and the contract between user space and the kernel. ?Here's
>> > what I wrote in the comment right above the related code:
>> >
>> > ? * These are segment of kernel provided user code reachable from user space
>> > ? * at a fixed address in kernel memory. ?This is used to provide user space
>> > ? * with some operations which require kernel help because of unimplemented
>> > ? * native feature and/or instructions in many ARM CPUs. The idea is for
>> > ? * this code to be executed directly in user mode for best efficiency but
>> > ? * which is too intimate with the kernel counter part to be left to user
>> > ? * libraries. ?In fact this code might even differ from one CPU to another
>> > ? * depending on the available ?instruction set and restrictions like on
>> > ? * SMP systems. ?In other words, the kernel reserves the right to change
>> > ? * this code as needed without warning. Only the entry points and their
>> > ? * results are guaranteed to be stable.
>> >
>> > This has been there since April 29th 2005 i.e. 6 years ago.
>>
>> Yes, unfortunately Android appears to do this as an 'optimization' in the case
>> of dynamically linked execs. That is, it skips the helper code all together.
>
> You should find the persons responsible for this aberration and flame
> them with extreme prejudice! ?As if this could make any measurable
> difference on any benchmark...
>
> Either you have the hw reg for TLS and may use it directly, or you use
> the provided helper dammit! ?I think I'll just move the implementation
> private 0xffff0ff0 location around just to make sure it breaks any user
> code that wrongly started to abuse this interface.
>
I believe the original implementation used the helper, and then it was
modified to skip the helper due to a measured performance impact.
Something to do with cache pressure and a specific vendor GL library
that heavily used get_tls(), I think, but it was before my time. It
is already fixed on the Android userspace side by defining
ARCH_ARM_HAVE_TLS_REGISTER, which will prevent libc from ever
accessing the private location, and we have dropped the hacks from our
recent kernel trees.
next prev parent reply other threads:[~2011-04-20 3:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-13 0:42 MT_HIGH_VECTOR mapping set read-only creating illegal access Michael Bohan
2011-04-13 3:31 ` Nicolas Pitre
2011-04-19 22:34 ` Michael Bohan
2011-04-20 0:21 ` Nicolas Pitre
2011-04-20 1:44 ` Michael Bohan
2011-04-20 3:01 ` Nicolas Pitre
2011-04-20 3:26 ` Colin Cross [this message]
2011-04-13 7:26 ` Russell King - ARM Linux
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=BANLkTinyqs392n1v4M7ZKqPhkJU3Nzs5MA@mail.gmail.com \
--to=ccross@android.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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).