From patchwork Tue Jun 21 11:17:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 13273 X-Patchwork-Delegate: carlos@redhat.com Received: (qmail 46460 invoked by alias); 21 Jun 2016 11:17:06 -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 45686 invoked by uid 89); 21 Jun 2016 11:17:05 -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=Allocate, _alignof, _Alignof, Hx-languages-length:829 X-HELO: mx1.redhat.com Date: Tue, 21 Jun 2016 13:17:02 +0200 To: libc-alpha@sourceware.org Subject: [PATCH] elf: dl-minimal malloc needs to respect fundamental alignment User-Agent: Heirloom mailx 12.5 7/5/10 MIME-Version: 1.0 Message-Id: <20160621111702.39A5B402F6E95@oldenburg.str.redhat.com> From: fweimer@redhat.com (Florian Weimer) If malloc is used instead of memalign for small alignments, malloc needs to provide the ABI-required alignment. 2016-06-21 Florian Weimer * elf/dl-minimal.c (malloc): Allocate with fundamental alignment. diff --git a/elf/dl-minimal.c b/elf/dl-minimal.c index c8a8f8d..2d7d139 100644 --- a/elf/dl-minimal.c +++ b/elf/dl-minimal.c @@ -27,6 +27,7 @@ #include #include #include <_itoa.h> +#include #include @@ -90,7 +91,7 @@ __libc_memalign (size_t align, size_t n) void * weak_function malloc (size_t n) { - return __libc_memalign (sizeof (double), n); + return __libc_memalign (_Alignof (max_align_t), n); } /* We use this function occasionally since the real implementation may