Re: BUG #14897: Segfault on statitics SQL request

From: Andres Freund <andres(at)anarazel(dot)de>
To: Dmitry Dolgov <9erthalion6(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Vincent Lachenal <vincent(dot)lachenal(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14897: Segfault on statitics SQL request
Date: 2017-11-11 17:16:20
Message-ID: 20171111171620.td6vtnmijcloj6k5@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 2017-11-11 17:52:34 +0100, Dmitry Dolgov wrote:
> > On 11 November 2017 at 17:36, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> >
> > Would you guys who are seeing the problem note whether the address of
> > the int128 field is 16-aligned, or only 8-aligned?
>
> __alignof__(__int128) returns 16 on my machine.
>
> > Also, it'd be real useful to see some disassembly around the point of
> > the crash, so that we can check whether the compiler is using SIMD
> > instructions. (Or just get the compiler to generate a numeric.s file
> > with -S.)
>
> Here is the disassembly section I've got in my case:
>
> 0x00000000007fc474 numericvar_to_int128+458 je 0x7fc48c
> <numericvar_to_int128+482>
> 0x00000000007fc476 numericvar_to_int128+460 mov -0x88(%rbp),%rax
> 0x00000000007fc47d numericvar_to_int128+467 movdqa -0x60(%rbp),%xmm0
> --> 0x00000000007fc482 numericvar_to_int128+472 movaps %xmm0,(%rax)
> 0x00000000007fc485 numericvar_to_int128+475 mov $0x1,%eax
> 0x00000000007fc48a numericvar_to_int128+480 jmp 0x7fc455
> <numericvar_to_int128+427>
> 0x00000000007fc48c numericvar_to_int128+482 negq -0x60(%rbp)

That's using SSE, which requires 16byte alignment IIRC. I think we need
a function that properly allocate int128 vars with the right alignment -
don't think we want to go for full 16byte alignment for everything.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2017-11-11 17:21:13 Re: BUG #14897: Segfault on statitics SQL request
Previous Message Dmitry Dolgov 2017-11-11 16:52:34 Re: BUG #14897: Segfault on statitics SQL request