public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Florian Weimer <fweimer@redhat.com>
Cc: Adhemerval Zanella via Libc-alpha <libc-alpha@sourceware.org>,
	jma14 <jma14@rice.edu>, Carlos O'Donell <carlos@redhat.com>,
	John Mellor-Crummey <johnmc@rice.edu>
Subject: Re: [PATCH v10 2/4] elf: Fix initial-exec TLS access on audit modules (BZ #28096)
Date: Tue, 18 Jan 2022 10:46:21 -0300	[thread overview]
Message-ID: <4e8dd46d-541b-7878-016f-6c7445d75abd@linaro.org> (raw)
In-Reply-To: <f254c606-17b0-9418-8ed9-1cd068b44e84@linaro.org>



On 18/01/2022 10:33, Adhemerval Zanella wrote:
> 
> 
> On 18/01/2022 10:29, Florian Weimer wrote:
>> * Adhemerval Zanella:
>>
>>>>> So we need to avoid initialization only for the libc.so loading by
>>>>> audit libraries, the default one should still be initialized (marked
>>>>> as [INIT]).  Later when new threads are created we need to initialized
>>>>> everything.
>>>>
>>>> That's what I tried to express with the LM_ID_BASE check.
>>>
>>> The problem is 'map->l_ns == LM_ID_BASE && !init_tls' will not initilize
>>> the required libc.so for main application during audit module loading.
>>> With tst-audit21:
>>>
>>>    1593586:     [rtld.c:965] load_audit_module
>>>    1593586:     [rtld.c:972] load_audit_module
>>>    1593586:     [rtld.c:2464] dl_main
>>>    1593586:     [../elf/dl-tls.c:605] map->l_name= map->l_ns=0 map->l_auditing=0 init_tls=0
>>>    1593586:     [../elf/dl-tls.c:610] map->l_name=[...]/elf/tst-auditmod21a.so map->l_ns=1 map->l_auditing=1 init_tls=0 [INIT]
>>>    1593586:     [../elf/dl-tls.c:610] map->l_name=[...]/libc.so.6 map->l_ns=1 map->l_auditing=1 init_tls=0 [INIT]
>>>    1593586:     [../elf/dl-tls.c:605] map->l_name=[...]/libc.so.6 map->l_ns=0 map->l_auditing=0 init_tls=0
>>>    1593586:     [../elf/dl-tls.c:627]
>>>    1593586:     [rtld.c:2466] dl_main
>>> Segmentation fault (core dumped)
>>
>> Looks like the condition is simply reversed?  [INIT] should only appear
>> for map->l_ns == 0, right?
> 
> Hum, 'if (map->l_ns != LM_ID_BASE && !init_tls)' seems correct indeed.  
> Let me run a full make check to certify it.

Yes, it is correct.  I will remove the 'l_auditing' field.

  reply	other threads:[~2022-01-18 13:46 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-17 21:31 [PATCH v10 0/4] Multiple rtld-audit fixes Adhemerval Zanella
2022-01-17 21:31 ` [PATCH v10 1/4] elf: Add la_activity during application exit Adhemerval Zanella
2022-01-18 11:29   ` Florian Weimer
2022-01-18 13:10     ` Adhemerval Zanella
2022-01-21 10:50       ` Florian Weimer
2022-01-21 10:50   ` Florian Weimer
2022-01-24 12:53     ` Adhemerval Zanella
2022-01-17 21:31 ` [PATCH v10 2/4] elf: Fix initial-exec TLS access on audit modules (BZ #28096) Adhemerval Zanella
2022-01-18 11:33   ` Florian Weimer
2022-01-18 12:58     ` Adhemerval Zanella
2022-01-18 13:02       ` Florian Weimer
2022-01-18 13:26         ` Adhemerval Zanella
2022-01-18 13:29           ` Florian Weimer
2022-01-18 13:33             ` Adhemerval Zanella
2022-01-18 13:46               ` Adhemerval Zanella [this message]
2022-01-18 13:47                 ` Adhemerval Zanella
2022-01-17 21:31 ` [PATCH v10 3/4] elf: Issue la_symbind for bind-now (BZ #23734) Adhemerval Zanella
2022-01-21 11:18   ` Florian Weimer
2022-01-17 21:31 ` [PATCH v10 4/4] elf: Fix runtime linker auditing on aarch64 (BZ #26643) Adhemerval Zanella
2022-01-18 13:36   ` Szabolcs Nagy
2022-01-21 11:19   ` 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=4e8dd46d-541b-7878-016f-6c7445d75abd@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=carlos@redhat.com \
    --cc=fweimer@redhat.com \
    --cc=jma14@rice.edu \
    --cc=johnmc@rice.edu \
    --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).