This is the mail archive of the libc-alpha@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: [PATCH] Make padding in struct sockaddr_storage explicit [BZ #20111]


On 05/19/2016 05:18 PM, Andreas Schwab wrote:
Florian Weimer <fweimer@redhat.com> writes:

What if we put the padding in the middle, like this?

#define _SS_PADSIZE \
  _SS_SIZE - __SOCKADDR_COMMON_SIZE - sizeof (__ss_aligntype)

That is different from the current definition, potentially increasing
the size of the structure.  The problem with the current definition is
that it assumes that offsetof (struct sockaddr_storage, __ss_align) ==
sizeof (__ss_aligntype), which is not guaranteed.

Are you saying that before my changes, sizeof (struct sockaddr_storage) != _SS_SIZE? Which in-tree ports are affected by this? m68k perhaps, because _ss_aligntype has just two-byte alignment?

(I'm not concerned about out-of-tree ports which redefine __SOCKADDR_COMMON, they can fix this up in any way they want.)

Thanks,
Florian


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