From patchwork Thu May 19 13:12:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 624060 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3r9WhN4ffYz9t3r for ; Thu, 19 May 2016 23:12:52 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=PAgpaDZx; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:to:subject:mime-version:content-type :content-transfer-encoding:message-id:from; q=dns; s=default; b= VenzjsPrkNWj8zjbqpECXrolmNeSgk5s1thOMG5AFRtSGXza/vYrryQ+4ZQy56GS uhU8BeQy/C3Tdv5JD2dNWM5oc4R+fCRYB+6H2xmJx0pQQSfTdzrhu42xvIUiN96c tqyVqWSRfQ2SbtJCK8dFw1VJnKdgyFHW7WQw6nLnaKE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:to:subject:mime-version:content-type :content-transfer-encoding:message-id:from; s=default; bh=J0XmrW 2FrQ3DnhEcufuOK24Uv2E=; b=PAgpaDZxHdjvBKIQAMAUtQwTwanx+XIql0J6u2 Y1WlL1s4BMvRvTQWyJZGY0Edh5s2lD0sZn6RiIwZe07tODmxsQS5jNOjIivWqehd vTXYVPROAaWJupcLUJ4eTC72MlIAu/dZQ8lSTd0oNVx/as8tK93fV11yUpaoxm5u o7S4E= Received: (qmail 99519 invoked by alias); 19 May 2016 13:12:46 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 99509 invoked by uid 89); 19 May 2016 13:12:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=1667, family X-HELO: mx1.redhat.com Date: Thu, 19 May 2016 15:12:38 +0200 To: libc-alpha@sourceware.org Subject: [PATCH] Make padding in struct sockaddr_storage explicit [BZ #20111] User-Agent: Heirloom mailx 12.5 7/5/10 MIME-Version: 1.0 Message-Id: <20160519131238.1C38540113D03@oldenburg.str.redhat.com> From: fweimer@redhat.com (Florian Weimer) This avoids aliasing issues with GCC 6 in -fno-strict-aliasing mode. (With implicit padding, not all data is copied.) 2016-05-19 Florian Weimer [BZ #20111] * bits/socket.h (struct sockaddr_storage): Avoid implicit padding. * sysdeps/mach/hurd/bits/socket.h (struct sockaddr_storage): Likewise. * sysdeps/unix/sysv/linux/bits/socket.h (struct sockaddr_storage): Likewise. diff --git a/bits/socket.h b/bits/socket.h index ab9f242..b3f2753 100644 --- a/bits/socket.h +++ b/bits/socket.h @@ -164,6 +164,7 @@ struct sockaddr struct sockaddr_storage { __SOCKADDR_COMMON (ss_); /* Address family, etc. */ + char __ss_padding_init[sizeof (__ss_aligntype) - __SOCKADDR_COMMON_SIZE]; __ss_aligntype __ss_align; /* Force desired alignment. */ char __ss_padding[_SS_PADSIZE]; }; diff --git a/sysdeps/mach/hurd/bits/socket.h b/sysdeps/mach/hurd/bits/socket.h index 02c5dac..8d1c2fd 100644 --- a/sysdeps/mach/hurd/bits/socket.h +++ b/sysdeps/mach/hurd/bits/socket.h @@ -168,6 +168,7 @@ struct sockaddr struct sockaddr_storage { __SOCKADDR_COMMON (ss_); /* Address family, etc. */ + char __ss_padding_init[sizeof (__ss_aligntype) - __SOCKADDR_COMMON_SIZE]; __ss_aligntype __ss_align; /* Force desired alignment. */ char __ss_padding[_SS_PADSIZE]; }; diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h index 0581c79..448b436 100644 --- a/sysdeps/unix/sysv/linux/bits/socket.h +++ b/sysdeps/unix/sysv/linux/bits/socket.h @@ -166,6 +166,7 @@ struct sockaddr struct sockaddr_storage { __SOCKADDR_COMMON (ss_); /* Address family, etc. */ + char __ss_padding_init[sizeof (__ss_aligntype) - __SOCKADDR_COMMON_SIZE]; __ss_aligntype __ss_align; /* Force desired alignment. */ char __ss_padding[_SS_PADSIZE]; };