Is this an incorrect Qualcomm usage or a glibc bug?

Florian Weimer fweimer@redhat.com
Fri Sep 1 09:00:00 GMT 2017


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



More information about the Libc-help mailing list