unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Siddhesh Poyarekar via Libc-alpha <libc-alpha@sourceware.org>
To: Florian Weimer <fweimer@redhat.com>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH v2] ld.so: Handle read-only dynamic section gracefully [BZ #28340]
Date: Wed, 15 Sep 2021 18:34:14 +0530	[thread overview]
Message-ID: <bea888d2-6a18-dee5-38d0-dbeab60b2f5d@sourceware.org> (raw)
In-Reply-To: <87zgserpzr.fsf@oldenburg.str.redhat.com>

On 9/15/21 5:48 PM, Florian Weimer via Libc-alpha wrote:
> * Siddhesh Poyarekar:
> 
>> On 9/15/21 4:10 PM, Florian Weimer wrote:
>>> As far as I can tell, this does not check whether the DYNAMIC segment is
>>> actually covered by a read-write LOAD segment.  I wonder how much value
>>> this imperfect check has.
>>
>> I reckon there's less value in trying to make this corner case work; I
>> can't think of a reason for someone (outside of the VDSO use case) to
>> do this on purpose.  Read-only DYNAMIC segments in ET_DYN objects
>> shouldn't be a supported use case.
> 
> Sure, but the corresponding LOAD segment is read-only as well, that's
> what actually matters.

I don't understand.  Why isn't the fact that the DYNAMIC segment is 
read-only sufficient to bail out with at error?  Or to rephrase, what 
valid use case would we be supporting by checking flags on the LOAD 
segment containing the .dynamic section to check for write permission?

I know that the crash wouldn't happen if the LOAD was read-write, but I 
don't know if the additional check covers a valid use case.

> And they do not want multiple LOAD segments because it can fit all on
> the same page.  We would end up with an RWX segment if we made this
> single LOAD segment writable, which is probably even more confusing.

Right.

> So I guess the status quo is probably best.

I don't know about that :)

> Maybe someone else can comment on the additional detection.  In the
> past, we said that crashes on corrupt ELF files weren't something we
> cared about, but I increasingly see th value of good diagnostics for
> common special cases.

This seems like a situation where we can add an inexpensive check and 
not crash.

> (See also the discussion about DSOs without entry points.)

I need to collect my thoughts about that.  I had run into it last year 
and I need to see if I had written something down then.  I'd definitely 
like to know if there is a historical perspective to setting .text as 
the entry point by default.

Siddhesh

      reply	other threads:[~2021-09-15 13:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-15  1:36 [PATCH v2] ld.so: Handle read-only dynamic section gracefully [BZ #28340] Siddhesh Poyarekar via Libc-alpha
2021-09-15 10:40 ` Florian Weimer via Libc-alpha
2021-09-15 12:10   ` Siddhesh Poyarekar via Libc-alpha
2021-09-15 12:18     ` Florian Weimer via Libc-alpha
2021-09-15 13:04       ` Siddhesh Poyarekar via Libc-alpha [this message]

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

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bea888d2-6a18-dee5-38d0-dbeab60b2f5d@sourceware.org \
    --to=libc-alpha@sourceware.org \
    --cc=fweimer@redhat.com \
    --cc=siddhesh@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).