This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Is this an incorrect Qualcomm usage or a glibc bug?


On 09/01/2017 10:34 AM, honan li wrote:
> HI,
> 
> https://patchwork.sourceware.org/patch/12453/
> This modification swapped __ss_align and __ss_padding in struct
> sockaddr_storage. The Qualcomm platform I'm now developing on has lots
> of typecast as follows.
> 
> struct sockaddr_storage prefix_addr //IPV6 address is stored in
> prefix_addr.__ss_padding
> (struct sockaddr_in6 *)&(prefix_addr)->sin6_addr.s6_addr

Please quote actual source doe.  The above snippet seems to have been
garbled.

> Is Qualcomm's usage of typecast wrong, or the usage is reasonable but
> glibc missed to consider this scenario?

Access to __ struct members is generally invalid.  Based on the
information you posted, I still think the glibc change was technically
valid.

Maybe we should rename the fields to reflect their changed offsets, so
that applications which access these __ members run into compiler errors
when being recompiled, instead of silent miscompilation.

Thanks,
Florian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]