From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 67674 invoked by alias); 23 Jun 2016 16:15:34 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 67613 invoked by uid 89); 23 Jun 2016 16:15:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=our X-HELO: mail-qk0-f177.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Ux6381CeJz8raN5ruFCsZJbgGn+C2YGYPY8z55mA9OQ=; b=eq86rut6ankiIHpUWeJXnfJVkqEyD+EkKrD5d4kmEcnC0A7no6EMhD7s8dab50B6r7 MC0JBsp/DTjSg5WK/aOJtVXhdOoGP+OQRfbAulTvN/t5cphXmV7s6RIZTtS+RmR74UKi me48ZQnYx0O/u8ii/mMFNmbKjb76YWUN9XgguEMAkwnSkyD0D8Jc8l3nj/gaiLGRD5P8 x4DDUQbPxL9htForXzvIuVSkwwKneM/DtQleaK+uAKzzpVEDAP6WPjxo82hYZUFeR15Y cWnFp3fjp3oKa5ffx+y+iH9VH7rA/u/NGFTxdb27PjpBVLaRnD8zMut9AROkGJcL8uwW 44bw== X-Gm-Message-State: ALyK8tIA/UTxcng6aHiX8huP6+KRWTbu07dbgCcZuij3Jy4FeUew2BsSr5RwvbWZRK561cqMU2Q7d+zVpjGdGw== X-Received: by 10.55.5.144 with SMTP id 138mr47123964qkf.196.1466698519692; Thu, 23 Jun 2016 09:15:19 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <7b71fba2-3afd-4eae-329e-3530cf828607@redhat.com> References: <20160621111702.39A5B402F6E95@oldenburg.str.redhat.com> <6ca009d9-433e-31f5-c3c0-c84ecc587059@redhat.com> <0ef86d34-0642-8e47-9fe4-dcd7638c6153@redhat.com> <7b71fba2-3afd-4eae-329e-3530cf828607@redhat.com> From: "H.J. Lu" Date: Thu, 23 Jun 2016 16:15:00 -0000 Message-ID: Subject: Re: [PATCH] elf: dl-minimal malloc needs to respect fundamental alignment To: Florian Weimer Cc: GNU C Library Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2016-06/txt/msg00924.txt.bz2 On Thu, Jun 23, 2016 at 8:01 AM, Florian Weimer wrote: > On 06/21/2016 03:20 PM, H.J. Lu wrote: >> >> On Tue, Jun 21, 2016 at 6:06 AM, Florian Weimer >> wrote: >>> >>> On 06/21/2016 03:00 PM, H.J. Lu wrote: >>> >>>>> MALLOC_ALIGNMENT is potentially larger. malloc/tst-malloc-thread-fail >>>>> tests >>>>> for alignment. To my knowledge, it passes on all regularly tested >>>>> architectures after commit dea39b13e2958a7f0e75b5594a06d97d61cc439f. >>>> >>>> >>>> >>>> MALLOC_ALIGNMENT is kind of mapped to the malloc alignment of >>>> a psABI. Shouldn't ld.so malloc have the same alignment of libc malloc? >>> >>> >>> >>> I don't see why. MALLOC_ALIGNMENT has to match both the ABI constraint >>> and >>> the malloc/malloc.c implementation constraint (which requires a minimum >>> alignment of 2 * sizeof (size_t)). >> >> >> My understanding is since the minimum constraint of malloc alignment >> <= ABI alignment, MALLOC_ALIGNMENT == ABI alignment. Do you >> have a glibc platform where it isn't true? > > > If I'm not mistaken, m68k has fundamental alignment 2 (the alignment of > long, double, and long double), but our malloc still aligns to 8 (2 * sizeof > (size_t)). > Malloc alignment has been an isssie. GCC defines MALLOC_ABI_ALIGNMENT as #ifndef MALLOC_ABI_ALIGNMENT #define MALLOC_ABI_ALIGNMENT BITS_PER_WORD #endif which is incorrect for Linux and unusable: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36159 I'd like to see a reasonable solution to address malloc alignment on Linux, not just in ld.so. -- H.J.