This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH] Make padding in struct sockaddr_storage explicit [BZ #20111]
- From: Florian Weimer <fweimer at redhat dot com>
- To: Andreas Schwab <schwab at suse dot de>
- Cc: libc-alpha at sourceware dot org
- Date: Thu, 19 May 2016 17:28:44 +0200
- Subject: Re: [PATCH] Make padding in struct sockaddr_storage explicit [BZ #20111]
- Authentication-results: sourceware.org; auth=none
- References: <20160519131238 dot 1C38540113D03 at oldenburg dot str dot redhat dot com> <mvm60ua5fpa dot fsf at hawking dot suse dot de> <ba52d849-7100-ffbb-0319-8844a31e11b3 at redhat dot com> <mvm1t4y5b62 dot fsf at hawking dot suse dot de>
On 05/19/2016 05:18 PM, Andreas Schwab wrote:
Florian Weimer <firstname.lastname@example.org> 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.)