Return-Path: X-Original-To: apmail-subversion-dev-archive@minotaur.apache.org Delivered-To: apmail-subversion-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A054419000 for ; Tue, 25 Aug 2015 12:16:01 +0000 (UTC) Received: (qmail 97239 invoked by uid 500); 25 Aug 2015 12:16:01 -0000 Delivered-To: apmail-subversion-dev-archive@subversion.apache.org Received: (qmail 97190 invoked by uid 500); 25 Aug 2015 12:16:01 -0000 Mailing-List: contact dev-help@subversion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list dev@subversion.apache.org Received: (qmail 97174 invoked by uid 99); 25 Aug 2015 12:16:01 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Aug 2015 12:16:01 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id C19DF1AAD17 for ; Tue, 25 Aug 2015 12:16:00 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.099 X-Spam-Level: X-Spam-Status: No, score=-0.099 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (1024-bit key) header.d=wandisco.com Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id lnCe8Pd4zFSB for ; Tue, 25 Aug 2015 12:15:52 +0000 (UTC) Received: from mail-wi0-f170.google.com (mail-wi0-f170.google.com [209.85.212.170]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with ESMTPS id 4E38B506F4 for ; Tue, 25 Aug 2015 12:15:52 +0000 (UTC) Received: by widdq5 with SMTP id dq5so13171449wid.0 for ; Tue, 25 Aug 2015 05:15:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wandisco.com; s=gapps; h=subject:to:references:from:organization:message-id:date:user-agent :mime-version:in-reply-to:content-type:content-transfer-encoding; bh=+ndbfYplKfLrvVWaQ5cJqFKZgdliQHcidrVVLlA2Ebc=; b=MhArKPi6YFfwx5Kk2Du+fEFPixs6MR6YKxxnoUQnlqexuxYZ6V9BjFyYc8hjjhC8M4 EXDPwu/le1GFznC6AS3p+WlneyKpNwRQz1cLweUa4E6ovsqlhkgEQhc+4dq8tLfUeLwr qN+WWKxSZZyK1ZnRFrKRuFOxBAi2CzPPVkg98= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to:content-type :content-transfer-encoding; bh=+ndbfYplKfLrvVWaQ5cJqFKZgdliQHcidrVVLlA2Ebc=; b=CO/ogJkYFbX0EuaLff4kRI/Fc4TfK6JqXFMHAZ8vPwiP0etQn5EfksZvxr/7Xmmfra jamgvS4KNP29Cqeoahxtc+VQjhlNzpgy5nDtpYM9NKRZPpNAesayUyDdpBXvmzqkPVhe kvrw6nHeBuU32qdmOo/PYvTV8Hn68lu4HuyAXViFEnu1qCL1yZt4tN+rPuWp6PXdDY7P PdLFdbOyuFUCPyBI8qOHiJrWriSnZFclSJqnQ2E51kScIJLaQFUIVHmbAVYDjQQ7+pDr ajLrpy5rBbsQBFJfctcj1ZOrT5bGxtPa8CFWQ6ixjn4ym6ToTUGzGcTD5BxuJPpCJ5eo RaMw== X-Gm-Message-State: ALoCoQlTNBD9SFN/acYV1GlmPo4JX1PXlRqn9yBOE5cQp9fFJ8LpThyH7hd634b5i4b6bvLk68R1 X-Received: by 10.180.231.40 with SMTP id td8mr4370654wic.9.1440504614729; Tue, 25 Aug 2015 05:10:14 -0700 (PDT) Received: from zulu.local ([77.234.149.122]) by smtp.gmail.com with ESMTPSA id ne7sm2377905wic.12.2015.08.25.05.10.14 for (version=TLS1 cipher=RC4-SHA bits=128/128); Tue, 25 Aug 2015 05:10:14 -0700 (PDT) Received: from zulu.local (localhost [127.0.0.1]) by zulu.local (Postfix) with ESMTP id 4C029F785A22 for ; Tue, 25 Aug 2015 14:10:14 +0200 (CEST) Subject: Re: svn commit: r1694533 - /subversion/trunk/subversion/libsvn_ra_svn/marshal.c To: dev@subversion.apache.org References: <20150806161040.14AE5AC01A7@hades.apache.org> From: =?UTF-8?Q?Branko_=c4=8cibej?= Organization: WANdisco Message-ID: <55DC5B26.50002@wandisco.com> Date: Tue, 25 Aug 2015 14:10:14 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <20150806161040.14AE5AC01A7@hades.apache.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 06.08.2015 18:10, stefan2@apache.org wrote: > Author: stefan2 > Date: Thu Aug 6 16:10:39 2015 > New Revision: 1694533 > > URL: http://svn.apache.org/r1694533 > Log: > Fix an alignment problem on machines with 32 bit pointers but atomic 64 > data access that may not be misaligned. > > * subversion/libsvn_ra_svn/marshal.c > (read_item): Ensure that the array contents are always have the APR > default alignment. > > Found by: Rainer Jung > > Modified: > subversion/trunk/subversion/libsvn_ra_svn/marshal.c > > Modified: subversion/trunk/subversion/libsvn_ra_svn/marshal.c > URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_svn/marshal.c?rev=1694533&r1=1694532&r2=1694533&view=diff > ============================================================================== > --- subversion/trunk/subversion/libsvn_ra_svn/marshal.c (original) > +++ subversion/trunk/subversion/libsvn_ra_svn/marshal.c Thu Aug 6 16:10:39 2015 > @@ -1190,14 +1190,20 @@ static svn_error_t *read_item(svn_ra_svn > } > else if (c == '(') > { > + /* On machines with 32 bit pointers, array headers are only 20 bytes > + * which is not enough for our standard 64 bit alignment. > + * So, determine a suitable block size for the APR array header that > + * keeps proper alignment for following structs. */ > + const apr_size_t header_size > + = APR_ALIGN_DEFAULT(sizeof(apr_array_header_t)); > + > /* Allocate an APR array with room for (initially) 4 items. > * We do this manually because lists are the most frequent protocol > * element, often used to frame a single, optional value. We save > * about 20% of total protocol handling time. */ > - char *buffer = apr_palloc(pool, sizeof(apr_array_header_t) > - + 4 * sizeof(svn_ra_svn_item_t)); > - svn_ra_svn_item_t *data > - = (svn_ra_svn_item_t *)(buffer + sizeof(apr_array_header_t)); > + char *buffer = apr_palloc(pool, > + header_size + 4 * sizeof(svn_ra_svn_item_t)); > + svn_ra_svn_item_t *data = (svn_ra_svn_item_t *)(buffer + header_size); > > item->kind = SVN_RA_SVN_LIST; > item->u.list = (apr_array_header_t *)buffer; How exactly is all this different from: apr_array_make(pool, 4, sizeof(svn_ra_svn_item_t)? Other than relying on magic knowledge of APR implementation details? -- Brane