public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Florian Weimer <fw@deneb.enyo.de>
Cc: "H.J. Lu via Libc-alpha" <libc-alpha@sourceware.org>
Subject: V2 [PATCH] rtld: Get architecture specific initializer in rtld_global
Date: Sat, 16 May 2020 11:24:13 -0700	[thread overview]
Message-ID: <CAMe9rOqZP3i1mztT+nnkUm5KOYNDdaC02WVui=gEM5yAwcR+Dg@mail.gmail.com> (raw)
In-Reply-To: <87sgfzn47x.fsf@mid.deneb.enyo.de>

[-- Attachment #1: Type: text/plain, Size: 1907 bytes --]

On Sat, May 16, 2020 at 11:07 AM Florian Weimer <fw@deneb.enyo.de> wrote:
>
> * H. J. Lu:
>
> > On Sat, May 16, 2020 at 10:52 AM Florian Weimer <fw@deneb.enyo.de> wrote:
> >>
> >> * H. J. Lu via Libc-alpha:
> >>
> >> > Include <dl-procruntime.c> to get architecture specific initializer in
> >> > rtld_global.
> >> > ---
> >> >  elf/rtld.c | 2 ++
> >> >  1 file changed, 2 insertions(+)
> >> >
> >> > diff --git a/elf/rtld.c b/elf/rtld.c
> >> > index 0016db86a7..44b9fb0b3c 100644
> >> > --- a/elf/rtld.c
> >> > +++ b/elf/rtld.c
> >> > @@ -315,6 +315,8 @@ rtld_hidden_def (_dl_starting_up)
> >> >     (except those which cannot be added for some reason).  */
> >> >  struct rtld_global _rtld_global =
> >> >    {
> >> > +    /* Get architecture specific initializer.  */
> >> > +#include <dl-procruntime.c>
> >> >      /* Generally the default presumption without further information is an
> >> >       * executable stack but this is not true for all platforms.  */
> >> >      ._dl_stack_flags = DEFAULT_STACK_PERMS,
> >>
> >> This patch does not build on its own.  I'm surprised that it works in
> >> combination with the third patch.
> >
> > It should build.
>
> It doesn't if I do not apply the third patch.

Fixed.

> >> Is _rtld_global really the right place for this data?  Is it even
> >> needed from outside the dynamic loader?
> >
> > Yes,  it matches:
> >
> > struct rtld_global
> > {
> > ...
> > #include <dl-procruntime.c>
> > ...
> > };
> >
> > in sysdeps/generic/ldsodefs.h.
>
> I mean conceptually—it's not clear to me why these fields have to be
> in _rtld_global.  It makes things harder to maintain.  Sorry, this is
> a more general question, it's not about the patch itself.

What is the alternative?  These fields are initialized very early
and don't change after it.

Here is the updated patch.  OK for master?

-- 
H.J.

[-- Attachment #2: 0001-rtld-Get-architecture-specific-initializer-in-rtld_g.patch --]
[-- Type: text/x-patch, Size: 1343 bytes --]

From 83015ce9f4e56faa772bfab4f9717365af353ced Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Tue, 28 Apr 2020 10:05:25 -0700
Subject: [PATCH] rtld: Get architecture specific initializer in rtld_global

Include <dl-procruntime.c> to get architecture specific initializer in
rtld_global.
---
 elf/rtld.c                   | 2 ++
 sysdeps/x86/dl-procruntime.c | 5 +++++
 2 files changed, 7 insertions(+)

diff --git a/elf/rtld.c b/elf/rtld.c
index 5ccc3c2dbb..882b070cc0 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -315,6 +315,8 @@ rtld_hidden_def (_dl_starting_up)
    (except those which cannot be added for some reason).  */
 struct rtld_global _rtld_global =
   {
+    /* Get architecture specific initializer.  */
+#include <dl-procruntime.c>
     /* Generally the default presumption without further information is an
      * executable stack but this is not true for all platforms.  */
     ._dl_stack_flags = DEFAULT_STACK_PERMS,
diff --git a/sysdeps/x86/dl-procruntime.c b/sysdeps/x86/dl-procruntime.c
index 5e39a38133..88a7cac646 100644
--- a/sysdeps/x86/dl-procruntime.c
+++ b/sysdeps/x86/dl-procruntime.c
@@ -49,6 +49,11 @@
 # else
 PROCINFO_CLASS unsigned int _dl_x86_feature_1[2]
 # endif
+# ifndef PROCINFO_DECL
+= {
+    0,
+  }
+# endif
 # if !defined SHARED || defined PROCINFO_DECL
 ;
 # else
-- 
2.26.2


  reply	other threads:[~2020-05-16 18:24 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-28 21:52 [PATCH 0/3] x86: Add --enable-cet=permissive H.J. Lu
2020-04-28 21:52 ` [PATCH 1/3] CET: Rename CET_MAX to CET_CONTROL_MASK [BZ #25887] H.J. Lu
2020-05-16 16:37   ` PING: " H.J. Lu
2020-05-16 17:27   ` Florian Weimer
2020-05-16 23:44     ` [PATCH] x86: Move CET control to _dl_x86_feature_control " H.J. Lu
2020-05-18  7:19       ` Florian Weimer
2020-05-18 12:26         ` V2 " H.J. Lu
2020-05-18 12:36           ` Florian Weimer
2020-04-28 21:52 ` [PATCH 2/3] rtld: Get architecture specific initializer in rtld_global H.J. Lu
2020-05-16 16:38   ` PING: " H.J. Lu
2020-05-16 17:51   ` Florian Weimer
2020-05-16 18:01     ` H.J. Lu
2020-05-16 18:07       ` Florian Weimer
2020-05-16 18:24         ` H.J. Lu [this message]
2020-04-28 21:52 ` [PATCH 3/3] x86: Add --enable-cet=permissive H.J. Lu
2020-04-29 17:19 ` [PATCH 0/3] " Adhemerval Zanella
2020-04-29 20:29   ` H.J. Lu
2020-04-29 20:46   ` Florian Weimer
2020-04-29 21:14     ` Adhemerval Zanella
2020-05-18 13:50       ` V2 [PATCH] " H.J. Lu
2020-05-18 14:43         ` Florian Weimer

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='CAMe9rOqZP3i1mztT+nnkUm5KOYNDdaC02WVui=gEM5yAwcR+Dg@mail.gmail.com' \
    --to=hjl.tools@gmail.com \
    --cc=fw@deneb.enyo.de \
    --cc=libc-alpha@sourceware.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).