public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
From: Will Newton <will.newton@linaro.org>
To: "Carlos O'Donell" <carlos@redhat.com>
Cc: "Joseph S. Myers" <joseph@codesourcery.com>,
		"libc-ports@sourceware.org" <libc-ports@sourceware.org>,
	Patch Tracking <patches@linaro.org>
Subject: Re: [PATCH] ARM: Don't apply pointer encryption to the frame pointer
Date: Tue, 10 Dec 2013 20:05:00 -0000	[thread overview]
Message-ID: <CANu=Dmhrc-yJZuafQXqEiJUmBv0FdGxqi2e_9iCAkr0-ob4Ozg@mail.gmail.com> (raw)
In-Reply-To: <52A7641C.7020400@redhat.com>

On 10 December 2013 18:57, Carlos O'Donell <carlos@redhat.com> wrote:
> On 12/10/2013 01:06 PM, Joseph S. Myers wrote:
>> On Tue, 10 Dec 2013, Will Newton wrote:
>>
>>> 2013-12-10  Will Newton  <will.newton@linaro.org>
>>>
>>>      * sysdeps/arm/__longjmp.S: Don't apply pointer encryption
>>>      to fp register.
>>>      * sysdeps/arm/setjmp.S: Likewise.
>>>      * sysdeps/arm/include/bits/setjmp.h (JMP_BUF_REGLIST): Add
>>>      fp to register list, remove a4.
>>>      * sysdeps/unix/sysv/linux/arm/sysdep.h: (PTR_MANGLE_LOAD):
>>>      New macro.
>>
>> OK, presuming you've tested this with the glibc testsuite.
>>
>
> Is it really true that ruby checks the FP?
>
> I don't see such code? Can you please point it out?

In vm_core.h:

   474      jmp_buf machine_regs;

In vm.c:

  1589          if (GET_THREAD() != th && th->machine_stack_start &&
th->machine_stack_end) {
  1590              rb_gc_mark_machine_stack(th);
  1591              rb_gc_mark_locations((VALUE *)&th->machine_regs,
  1592                                   (VALUE *)(&th->machine_regs) +
  1593                                   sizeof(th->machine_regs) /
sizeof(VALUE));
  1594          }

So it looks like a conservative GC that uses the jmp_buf as a data
array to find potentially reachable objects. If fp contained a pointer
to an object then the pointer encryption would render it
undiscoverable and it would not get marked as live and could be
collected in error.

There are a number of "ifs" involved and I haven't got the testsuite
running yet but it looks like a possibility.

-- 
Will Newton
Toolchain Working Group, Linaro

  reply	other threads:[~2013-12-10 20:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-10 17:28 Will Newton
2013-12-10 18:07 ` Joseph S. Myers
2013-12-10 18:57   ` Carlos O'Donell
2013-12-10 20:05     ` Will Newton [this message]
2013-12-10 20:11       ` Carlos O'Donell
2013-12-13 15:57 ` Carlos O'Donell

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='CANu=Dmhrc-yJZuafQXqEiJUmBv0FdGxqi2e_9iCAkr0-ob4Ozg@mail.gmail.com' \
    --to=will.newton@linaro.org \
    --cc=carlos@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=libc-ports@sourceware.org \
    --cc=patches@linaro.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 read-only IMAP folder(s) and NNTP newsgroup(s).