public inbox for gnu-gabi@sourceware.org
 help / color / mirror / Atom feed
From: Carlos O'Donell <carlos@redhat.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: gnu-gabi@sourceware.org
Subject: Re: RFC: ABI support for special memory area
Date: Sun, 01 Jan 2017 00:00:00 -0000	[thread overview]
Message-ID: <4982fddd-e7bb-e7f1-d2ee-7aa73066bc8e@redhat.com> (raw)
In-Reply-To: <CAMe9rOodZ+UXPFWr_LYQ12Hci_PNLyY1F=FO-yL5N3j_iF69pA@mail.gmail.com>

On 02/23/2017 09:59 PM, H.J. Lu wrote:
>> Why does it run _after_ all shared objects and the executable file are loaded?
> 
> Since __gnu_mbind_setup may call any external functions, it can only
> be done after everything is loaded and relocated.

Who defines this function?

Where is it implemented?

What does a typical implementation look like for MCDRAM use?

>> Why not let the dynamic loader choose when it needs to setup the memory?
> 
> 1. We want to be able to add support for new type memory by just
> updating the run-time library of __gnu_mbind_setup, instead of
> updating glibc.

Which library defines it?

Can two libraries define it? Does the dynamic loader run every DSO's
version of __gnu_mbind_setup?

> 2. Since __gnu_mbind_setup may depend on other libraries, we
> don't want a simple executable requires libfoo and libbar, in addition
> to glibc, nor make libfoo and libbar part of glibc.

Why can't this be run in a constructor? Is that too late?

This seems like a specialized form of constructor that is guaranteed
to run before all other constructors?

>>> int
>>> __gnu_mbind_setup (unsigned int type, void *addr, size_t length)
>>> {
>>>   return 0;
>>> }
>>>
>>> which can be overridden by a different implementation at link-time.
>>
>> What if you _can't_ bind at ADDR?
> 
> It happens on systems without special memory.  __gnu_mbind_setup
> returns a positive value and ld.so keeps going.

Isn't this a violation of what the application binary requested?

This is a soft-failure that that application doesn't know about.

Might this become a security issue if the application expected the
specific memory type?

>> What if the binding would work if ADD was any value?
>>
> 
> GNU_MBIND isn't a LOAD segment,  similar to GNU_RELRO:
> 
> Program Headers:
>   Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
>   LOAD           0x000000 0x00000000 0x00000000 0x54624 0x54624 R E 0x1000
>   LOAD           0x054e9c 0x00055e9c 0x00055e9c 0x001b0 0x001b8 RW  0x1000
>   DYNAMIC        0x054eac 0x00055eac 0x00055eac 0x00110 0x00110 RW  0x4
>   NOTE           0x000114 0x00000114 0x00000114 0x00044 0x00044 R   0x4
>   GNU_EH_FRAME   0x048eb8 0x00048eb8 0x00048eb8 0x00ff4 0x00ff4 R   0x4
>   GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RW  0x10
>   GNU_RELRO      0x054e9c 0x00055e9c 0x00055e9c 0x00164 0x00164 R   0x1
> 
> ADDR contains the start of a memory region within the LOAD segment.

What are the constraints of GNU_MBIND then?

Is it required that it covers only the SHF_GNU_MBIND marked sections which
are part of a PT_LOAD segment?

-- 
Cheers,
Carlos.

  reply	other threads:[~2017-02-28 16:19 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-01  0:00 H.J. Lu
2017-01-01  0:00 ` Carlos O'Donell
2017-01-01  0:00   ` H.J. Lu
2017-01-01  0:00     ` Carlos O'Donell [this message]
2017-01-01  0:00       ` H.J. Lu
2017-01-01  0:00         ` Florian Weimer
2017-01-01  0:00           ` H.J. Lu
2017-01-01  0:00 ` Suprateeka R Hegde
2017-01-01  0:00   ` H.J. Lu
2017-01-01  0:00     ` Suprateeka R Hegde
2017-01-01  0:00       ` H.J. Lu
2017-01-01  0:00         ` Carlos O'Donell
2017-01-01  0:00           ` Suprateeka R Hegde
2017-01-01  0:00             ` H.J. Lu
2017-01-01  0:00               ` Suprateeka R Hegde
2017-01-01  0:00                 ` H.J. Lu
2017-01-01  0:00                   ` H.J. Lu
2017-01-01  0:00                     ` Suprateeka R Hegde
2017-01-01  0:00                       ` H.J. Lu
2017-01-01  0:00                         ` Suprateeka R Hegde
2017-01-01  0:00                           ` H.J. Lu
2017-01-01  0:00                             ` Suprateeka R Hegde
2017-01-01  0:00                               ` H.J. Lu
2017-01-01  0:00                                 ` Suprateeka R Hegde
2017-01-01  0:00                                   ` H.J. Lu
2017-01-01  0:00                                     ` Suprateeka R Hegde
2017-01-01  0:00                                       ` H.J. Lu
2017-01-01  0:00                     ` Florian Weimer
2017-01-01  0:00                       ` H.J. Lu
2017-01-01  0:00                         ` Florian Weimer
2017-01-01  0:00                           ` H.J. Lu
2017-01-01  0:00                             ` Florian Weimer
2017-01-01  0:00                               ` H.J. Lu

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=4982fddd-e7bb-e7f1-d2ee-7aa73066bc8e@redhat.com \
    --to=carlos@redhat.com \
    --cc=gnu-gabi@sourceware.org \
    --cc=hjl.tools@gmail.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 read-only IMAP folder(s) and NNTP newsgroup(s).