From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Szabolcs Nagy <szabolcs.nagy@arm.com>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH v2 3/4] elf: Avoid RELATIVE relocs in __tunables_init
Date: Mon, 11 Jan 2021 09:13:49 -0300 [thread overview]
Message-ID: <aa3efde7-91d2-dc1f-99d8-ce6b48cfd554@linaro.org> (raw)
In-Reply-To: <20210111105607.GY2379@arm.com>
On 11/01/2021 07:56, Szabolcs Nagy wrote:
> The 01/08/2021 14:59, Adhemerval Zanella wrote:
>> On 08/01/2021 13:20, Szabolcs Nagy via Libc-alpha wrote:
>>> With static pie linking pointers in the tunables list need
>>> RELATIVE relocs since the absolute address is not known at link
>>> time. We want to avoid relocations so the static pie self
>>> relocation can be done after tunables are initialized.
>>>
>>> This is a quick fix that increases the tunable list size a bit.
> ...
>>> --- a/elf/dl-tunables.h
>>> +++ b/elf/dl-tunables.h
>>> @@ -38,7 +38,7 @@ __tunables_init (char **unused __attribute__ ((unused)))
>>> /* A tunable. */
>>> struct _tunable
>>> {
>>> - const char *name; /* Internal name of the tunable. */
>>> + const char name[64]; /* Internal name of the tunable. */
>>> tunable_type_t type; /* Data type of the tunable. */
>>> tunable_val_t val; /* The value. */
>>> bool initialized; /* Flag to indicate that the tunable is
>>> @@ -54,7 +54,7 @@ struct _tunable
>>> target module if the value is
>>> considered unsafe. */
>>> /* Compatibility elements. */
>>> - const char *env_alias; /* The compatibility environment
>>> + const char env_alias[24]; /* The compatibility environment
>>> variable name. */
>>> };
>>
>> The change is ok, although I think we can at least not make the maximum r
>> equired size being automatically generated at build time:
>>
> ...
>> --- a/elf/dl-tunables.h
>> +++ b/elf/dl-tunables.h
>> @@ -34,11 +34,12 @@ __tunables_init (char **unused __attribute__ ((unused)))
>>
>> # include <stddef.h>
>> # include "dl-tunable-types.h"
>> +# include "dl-tunable-list-max.h"
>>
>> /* A tunable. */
>> struct _tunable
>> {
>> - const char *name; /* Internal name of the tunable. */
>> + const char name[TUNABLES_NAME_MAX]; /* Internal name of the tunable. */
>> tunable_type_t type; /* Data type of the tunable. */
>> tunable_val_t val; /* The value. */
>> bool initialized; /* Flag to indicate that the tunable is
>> @@ -54,7 +55,7 @@ struct _tunable
>> target module if the value is
>> considered unsafe. */
>> /* Compatibility elements. */
>> - const char *env_alias; /* The compatibility environment
>> + const char env_alias[TUNABLES_ALIAS_MAX];/* The compatibility environment
>> variable name. */
>> };
>
> yeah i can do this,
> it's also possible to collect all strings
> in one char array and iterate over them or
> keep offsets to them in struct _tunable
> instead of pointers.
>
Yes, this is pretty much what stdio-common/errlist.c does for errno names.
next prev parent reply other threads:[~2021-01-11 12:13 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-08 16:19 [PATCH v2 0/4] fix ifunc with static pie [BZ #27072] Szabolcs Nagy
2021-01-08 16:19 ` [PATCH v2 1/4] configure: Require PI_STATIC_AND_HIDDEN for static pie Szabolcs Nagy
2021-01-08 16:20 ` [PATCH v2 2/4] Make libc symbols hidden in static PIE Szabolcs Nagy
2021-01-08 16:20 ` [PATCH v2 3/4] elf: Avoid RELATIVE relocs in __tunables_init Szabolcs Nagy
2021-01-08 17:59 ` Adhemerval Zanella
2021-01-08 18:22 ` Siddhesh Poyarekar
2021-01-08 18:25 ` Adhemerval Zanella
2021-01-11 10:56 ` Szabolcs Nagy
2021-01-11 12:13 ` Adhemerval Zanella [this message]
2021-01-08 16:20 ` [PATCH v2 4/4] csu: Move static pie self relocation later [BZ #27072] Szabolcs Nagy
2021-01-08 17:04 ` [PATCH v2 0/4] fix ifunc with static pie " H.J. Lu
2021-01-11 10:50 ` Szabolcs Nagy
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=aa3efde7-91d2-dc1f-99d8-ce6b48cfd554@linaro.org \
--to=adhemerval.zanella@linaro.org \
--cc=libc-alpha@sourceware.org \
--cc=szabolcs.nagy@arm.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).