public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: GNU C Library <libc-alpha@sourceware.org>
Subject: Re: [PATCH 2/2] elf: Detect PT_LOAD segments that extend beyond EOF and refuse loading
Date: Fri, 05 Nov 2021 15:07:39 +0100	[thread overview]
Message-ID: <871r3uvgpg.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <CAMe9rOogTBkdye+hc83umJhkrGLB8x-ja-L0JFUREKS7Q2=GzA@mail.gmail.com> (H. J. Lu's message of "Fri, 5 Nov 2021 07:04:48 -0700")

* H. J. Lu:

>> diff --git a/sysdeps/generic/dl-fileid.h b/sysdeps/generic/dl-fileid.h
>> index bf437f3d71..c59627429c 100644
>> --- a/sysdeps/generic/dl-fileid.h
>> +++ b/sysdeps/generic/dl-fileid.h
>> @@ -27,10 +27,10 @@ struct r_file_id
>>      ino64_t ino;
>>    };
>>
>> -/* Sample FD to fill in *ID.  Returns true on success.
>> -   On error, returns false, with errno set.  */
>> +/* Sample FD to fill in *ID, *SIZE.  Returns true on success.  On
>> +   error, returns false, with errno set.  */
>>  static inline bool
>> -_dl_get_file_id (int fd, struct r_file_id *id)
>> +_dl_get_file_id (int fd, struct r_file_id *id, off64_t *size)
>>  {
>>    struct __stat64_t64 st;
>>
>> @@ -39,6 +39,7 @@ _dl_get_file_id (int fd, struct r_file_id *id)
>>
>>    id->dev = st.st_dev;
>>    id->ino = st.st_ino;
>> +  *size = st.st_size;
>
> Why not add a size field to struct r_file_id?

struct r_file_d is stored in the link map, but we don't need the size
information there.

Thanks,
Florian


  reply	other threads:[~2021-11-05 14:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-05 13:59 [PATCH 0/2] Avoid some crashes when loading separate debuginfo Florian Weimer
2021-11-05 13:59 ` [PATCH 1/2] Use sysdeps/posix/dl-fileid.h as the generic and only implementation Florian Weimer
2021-11-08 15:54   ` H.J. Lu
2021-11-05 13:59 ` [PATCH 2/2] elf: Detect PT_LOAD segments that extend beyond EOF and refuse loading Florian Weimer
2021-11-05 14:04   ` H.J. Lu
2021-11-05 14:07     ` Florian Weimer [this message]
2021-11-05 14:26   ` H.J. Lu
2021-11-05 14:31     ` Florian Weimer
2021-11-05 14:37       ` H.J. Lu
2021-11-05 14:41         ` Florian Weimer
2021-11-05 15:03           ` H.J. Lu
2021-11-05 15:50             ` Florian Weimer
2021-11-05 14:30   ` Adhemerval Zanella
2021-11-05 14:35     ` 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=871r3uvgpg.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=hjl.tools@gmail.com \
    --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).