From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-f66.google.com (mail-lf1-f66.google.com [209.85.167.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id A68B3469710 for ; Mon, 8 Jun 2020 16:58:59 +0300 (MSK) Received: by mail-lf1-f66.google.com with SMTP id 82so10272873lfh.2 for ; Mon, 08 Jun 2020 06:58:59 -0700 (PDT) Date: Mon, 8 Jun 2020 16:58:57 +0300 From: Cyrill Gorcunov Message-ID: <20200608135857.GF134822@grain> References: <7bdb9ea8c65f01e3ca1f0cc70a20e9e60fd207e1.1590093222.git.v.shpilevoy@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7bdb9ea8c65f01e3ca1f0cc70a20e9e60fd207e1.1590093222.git.v.shpilevoy@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH 05/10] sql: make BtCursor's memory aligned List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladislav Shpilevoy Cc: tarantool-patches@dev.tarantool.org On Thu, May 21, 2020 at 10:37:28PM +0200, Vladislav Shpilevoy wrote: > Vdbe at runtime allocates VdbeCursor structure using > allocateCursor() function. Inside there is a pointer at BtCursor > structure. To make the allocation faster and improve cache > locality, both cursors are allocated in one memory block + some > extra memory for uint32_t array, where BtCursor followed > VdbeCursor and the array without any padding: > > VdbeCursor + uint32_t * N + BtCursor > > The problem is that BtCursor needs 8 byte alignment. When it > followed VdbeCursor (aligned by 8) + some uint32_t values, its > actual alignment could become 4 bytes. That led to a crash when > alignment sanitizer is enabled in clang. > > The patch makes BtCursor offset aligned by 8 bytes. > > Part of #4609 Reviewed-by: Cyrill Gorcunov