* [PATCH v3] ld.so: Initialize bootstrap_map.l_ld_readonly [BZ #28340]
@ 2021-10-18 18:00 H.J. Lu
2021-10-18 18:06 ` H.J. Lu
0 siblings, 1 reply; 3+ messages in thread
From: H.J. Lu @ 2021-10-18 18:00 UTC (permalink / raw)
To: libc-alpha
Before calling elf_get_dynamic_info to get dynamic info in bootstrap_map,
initalize bootstrap_map.l_ld_readonly with BOOTSTRAP_MAP_RO_DYN_SECTION.
This updates BZ #28340 fix.
---
elf/rtld.c | 1 +
sysdeps/generic/dl-relocate-ld.h | 3 +++
sysdeps/mips/dl-relocate-ld.h | 3 +++
sysdeps/riscv/dl-relocate-ld.h | 4 ++++
4 files changed, 11 insertions(+)
diff --git a/elf/rtld.c b/elf/rtld.c
index c66a1d00bc..51a471e6b7 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -547,6 +547,7 @@ _dl_start (void *arg)
/* Read our own dynamic section and fill in the info array. */
bootstrap_map.l_ld = (void *) bootstrap_map.l_addr + elf_machine_dynamic ();
+ bootstrap_map.l_ld_readonly = BOOTSTRAP_MAP_RO_DYN_SECTION;
elf_get_dynamic_info (&bootstrap_map, true, false);
#if NO_TLS_OFFSET != 0
diff --git a/sysdeps/generic/dl-relocate-ld.h b/sysdeps/generic/dl-relocate-ld.h
index 5fae206db9..09c7ba0448 100644
--- a/sysdeps/generic/dl-relocate-ld.h
+++ b/sysdeps/generic/dl-relocate-ld.h
@@ -19,6 +19,9 @@
#ifndef _DL_RELOCATE_LD_H
#define _DL_RELOCATE_LD_H
+/* The dynamic section in bootstrap_map is writable. */
+#define BOOTSTRAP_MAP_RO_DYN_SECTION 0
+
/* Return true if dynamic section in the shared library L should be
relocated. */
diff --git a/sysdeps/mips/dl-relocate-ld.h b/sysdeps/mips/dl-relocate-ld.h
index 0c18d9a567..2c4edbe9f4 100644
--- a/sysdeps/mips/dl-relocate-ld.h
+++ b/sysdeps/mips/dl-relocate-ld.h
@@ -19,6 +19,9 @@
#ifndef _DL_RELOCATE_LD_H
#define _DL_RELOCATE_LD_H
+/* The dynamic section in bootstrap_map is readonly. */
+#define BOOTSTRAP_MAP_RO_DYN_SECTION 1
+
/* Return true if dynamic section in the shared library L should be
relocated. */
diff --git a/sysdeps/riscv/dl-relocate-ld.h b/sysdeps/riscv/dl-relocate-ld.h
index 10327454b1..240f85b79e 100644
--- a/sysdeps/riscv/dl-relocate-ld.h
+++ b/sysdeps/riscv/dl-relocate-ld.h
@@ -19,6 +19,10 @@
#ifndef _DL_RELOCATE_LD_H
#define _DL_RELOCATE_LD_H
+/* The dynamic section in bootstrap_map is writable. This is ignored
+ on RISC-V. */
+#define BOOTSTRAP_MAP_RO_DYN_SECTION 0
+
/* Return true if dynamic section in the shared library L should be
relocated. */
--
2.32.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3] ld.so: Initialize bootstrap_map.l_ld_readonly [BZ #28340]
2021-10-18 18:00 [PATCH v3] ld.so: Initialize bootstrap_map.l_ld_readonly [BZ #28340] H.J. Lu
@ 2021-10-18 18:06 ` H.J. Lu
2021-10-18 18:38 ` H.J. Lu
0 siblings, 1 reply; 3+ messages in thread
From: H.J. Lu @ 2021-10-18 18:06 UTC (permalink / raw)
To: GNU C Library
On Mon, Oct 18, 2021 at 11:00 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> Before calling elf_get_dynamic_info to get dynamic info in bootstrap_map,
> initalize bootstrap_map.l_ld_readonly with BOOTSTRAP_MAP_RO_DYN_SECTION.
>
> This updates BZ #28340 fix.
> ---
> elf/rtld.c | 1 +
> sysdeps/generic/dl-relocate-ld.h | 3 +++
> sysdeps/mips/dl-relocate-ld.h | 3 +++
> sysdeps/riscv/dl-relocate-ld.h | 4 ++++
> 4 files changed, 11 insertions(+)
>
> diff --git a/elf/rtld.c b/elf/rtld.c
> index c66a1d00bc..51a471e6b7 100644
> --- a/elf/rtld.c
> +++ b/elf/rtld.c
> @@ -547,6 +547,7 @@ _dl_start (void *arg)
>
> /* Read our own dynamic section and fill in the info array. */
> bootstrap_map.l_ld = (void *) bootstrap_map.l_addr + elf_machine_dynamic ();
> + bootstrap_map.l_ld_readonly = BOOTSTRAP_MAP_RO_DYN_SECTION;
> elf_get_dynamic_info (&bootstrap_map, true, false);
>
> #if NO_TLS_OFFSET != 0
> diff --git a/sysdeps/generic/dl-relocate-ld.h b/sysdeps/generic/dl-relocate-ld.h
> index 5fae206db9..09c7ba0448 100644
> --- a/sysdeps/generic/dl-relocate-ld.h
> +++ b/sysdeps/generic/dl-relocate-ld.h
> @@ -19,6 +19,9 @@
> #ifndef _DL_RELOCATE_LD_H
> #define _DL_RELOCATE_LD_H
>
> +/* The dynamic section in bootstrap_map is writable. */
> +#define BOOTSTRAP_MAP_RO_DYN_SECTION 0
> +
> /* Return true if dynamic section in the shared library L should be
> relocated. */
>
> diff --git a/sysdeps/mips/dl-relocate-ld.h b/sysdeps/mips/dl-relocate-ld.h
> index 0c18d9a567..2c4edbe9f4 100644
> --- a/sysdeps/mips/dl-relocate-ld.h
> +++ b/sysdeps/mips/dl-relocate-ld.h
> @@ -19,6 +19,9 @@
> #ifndef _DL_RELOCATE_LD_H
> #define _DL_RELOCATE_LD_H
>
> +/* The dynamic section in bootstrap_map is readonly. */
> +#define BOOTSTRAP_MAP_RO_DYN_SECTION 1
> +
> /* Return true if dynamic section in the shared library L should be
> relocated. */
>
> diff --git a/sysdeps/riscv/dl-relocate-ld.h b/sysdeps/riscv/dl-relocate-ld.h
> index 10327454b1..240f85b79e 100644
> --- a/sysdeps/riscv/dl-relocate-ld.h
> +++ b/sysdeps/riscv/dl-relocate-ld.h
> @@ -19,6 +19,10 @@
> #ifndef _DL_RELOCATE_LD_H
> #define _DL_RELOCATE_LD_H
>
> +/* The dynamic section in bootstrap_map is writable. This is ignored
> + on RISC-V. */
> +#define BOOTSTRAP_MAP_RO_DYN_SECTION 0
> +
> /* Return true if dynamic section in the shared library L should be
> relocated. */
>
> --
> 2.32.0
>
This patch is wrong. Don't use it.
--
H.J.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3] ld.so: Initialize bootstrap_map.l_ld_readonly [BZ #28340]
2021-10-18 18:06 ` H.J. Lu
@ 2021-10-18 18:38 ` H.J. Lu
0 siblings, 0 replies; 3+ messages in thread
From: H.J. Lu @ 2021-10-18 18:38 UTC (permalink / raw)
To: GNU C Library
On Mon, Oct 18, 2021 at 11:06 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Mon, Oct 18, 2021 at 11:00 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> >
> > Before calling elf_get_dynamic_info to get dynamic info in bootstrap_map,
> > initalize bootstrap_map.l_ld_readonly with BOOTSTRAP_MAP_RO_DYN_SECTION.
> >
> > This updates BZ #28340 fix.
> > ---
> > elf/rtld.c | 1 +
> > sysdeps/generic/dl-relocate-ld.h | 3 +++
> > sysdeps/mips/dl-relocate-ld.h | 3 +++
> > sysdeps/riscv/dl-relocate-ld.h | 4 ++++
> > 4 files changed, 11 insertions(+)
> >
> > diff --git a/elf/rtld.c b/elf/rtld.c
> > index c66a1d00bc..51a471e6b7 100644
> > --- a/elf/rtld.c
> > +++ b/elf/rtld.c
> > @@ -547,6 +547,7 @@ _dl_start (void *arg)
> >
> > /* Read our own dynamic section and fill in the info array. */
> > bootstrap_map.l_ld = (void *) bootstrap_map.l_addr + elf_machine_dynamic ();
> > + bootstrap_map.l_ld_readonly = BOOTSTRAP_MAP_RO_DYN_SECTION;
> > elf_get_dynamic_info (&bootstrap_map, true, false);
> >
> > #if NO_TLS_OFFSET != 0
> > diff --git a/sysdeps/generic/dl-relocate-ld.h b/sysdeps/generic/dl-relocate-ld.h
> > index 5fae206db9..09c7ba0448 100644
> > --- a/sysdeps/generic/dl-relocate-ld.h
> > +++ b/sysdeps/generic/dl-relocate-ld.h
> > @@ -19,6 +19,9 @@
> > #ifndef _DL_RELOCATE_LD_H
> > #define _DL_RELOCATE_LD_H
> >
> > +/* The dynamic section in bootstrap_map is writable. */
> > +#define BOOTSTRAP_MAP_RO_DYN_SECTION 0
> > +
> > /* Return true if dynamic section in the shared library L should be
> > relocated. */
> >
> > diff --git a/sysdeps/mips/dl-relocate-ld.h b/sysdeps/mips/dl-relocate-ld.h
> > index 0c18d9a567..2c4edbe9f4 100644
> > --- a/sysdeps/mips/dl-relocate-ld.h
> > +++ b/sysdeps/mips/dl-relocate-ld.h
> > @@ -19,6 +19,9 @@
> > #ifndef _DL_RELOCATE_LD_H
> > #define _DL_RELOCATE_LD_H
> >
> > +/* The dynamic section in bootstrap_map is readonly. */
> > +#define BOOTSTRAP_MAP_RO_DYN_SECTION 1
> > +
> > /* Return true if dynamic section in the shared library L should be
> > relocated. */
> >
> > diff --git a/sysdeps/riscv/dl-relocate-ld.h b/sysdeps/riscv/dl-relocate-ld.h
> > index 10327454b1..240f85b79e 100644
> > --- a/sysdeps/riscv/dl-relocate-ld.h
> > +++ b/sysdeps/riscv/dl-relocate-ld.h
> > @@ -19,6 +19,10 @@
> > #ifndef _DL_RELOCATE_LD_H
> > #define _DL_RELOCATE_LD_H
> >
> > +/* The dynamic section in bootstrap_map is writable. This is ignored
> > + on RISC-V. */
> > +#define BOOTSTRAP_MAP_RO_DYN_SECTION 0
> > +
> > /* Return true if dynamic section in the shared library L should be
> > relocated. */
> >
> > --
> > 2.32.0
> >
>
> This patch is wrong. Don't use it.
>
The right one is at
https://sourceware.org/pipermail/libc-alpha/2021-October/132063.html
--
H.J.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-10-18 18:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-18 18:00 [PATCH v3] ld.so: Initialize bootstrap_map.l_ld_readonly [BZ #28340] H.J. Lu
2021-10-18 18:06 ` H.J. Lu
2021-10-18 18:38 ` H.J. Lu
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).