[PATCH] Fix #27777 - now use a doubly-linked list for _IO_list_all

alexandre.ferrieux@orange.com alexandre.ferrieux@orange.com
Fri Apr 26 18:44:13 GMT 2024



On 26/04/2024 20:20, FERRIEUX Alexandre INNOV/NET wrote:
> 
> 
> On 26/04/2024 19:51, Florian Weimer wrote:
>>
>> * alexandre ferrieux:
>>
>>> diff --git a/libio/bits/types/struct_FILE.h b/libio/bits/types/struct_FILE.h
>>> index 7cdaae86f8..daebd6ce0a 100644
>>> --- a/libio/bits/types/struct_FILE.h
>>> +++ b/libio/bits/types/struct_FILE.h
>>> @@ -67,7 +67,7 @@ struct _IO_FILE
>>>
>>>    struct _IO_marker *_markers;
>>>
>>> -  struct _IO_FILE *_chain;
>>> +  struct _IO_FILE *_chain,**_prevchain;
>>>
>>>    int _fileno;
>>>    int _flags2;
>>
>> Unfortunately, this struct is part of the ABI for several reasons.  For
>> example, _IO_2_1_stdin_ is a global variable exported by libc.so.6, and
>> it has a struct _IO_FILE member.  It cannot change size due to copy
>> relocations, even if nothing accesses members after _chain.

Now what about sticking the field to the end of _IO_FILE_plus ?

  struct _IO_FILE_plus
  {
    FILE file;
    const struct _IO_jump_t *vtable;
+  struct _IO_FILE_plus **_prevchain;
  };

Wouldn't that be backwards compatible with everything ?
Or do you suspect that some aircraft, dams and power plants routinely rely on 
sizeof(_IO_FILE_plus) as they allocate and fill their file pointers by hand ?
____________________________________________________________________________________________________________
Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc
pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler
a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration,
Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.

This message and its attachments may contain confidential or privileged information that may be protected by law;
they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete this message and its attachments.
As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified.
Thank you.


More information about the Libc-alpha mailing list