Re: pgsql: Implementation of subscripting for jsonb

From: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Alexander Korotkov <akorotkov(at)postgresql(dot)org>, pgsql-committers <pgsql-committers(at)lists(dot)postgresql(dot)org>
Subject: Re: pgsql: Implementation of subscripting for jsonb
Date: 2021-02-01 12:41:59
Message-ID: CAPpHfdsne3=T=fMNU45PtxdhSL_J2PjLTeS8rwKnJzUR4YNd4w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Mon, Feb 1, 2021 at 10:06 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Heikki Linnakangas <hlinnaka(at)iki(dot)fi> writes:
> > On 31/01/2021 22:54, Alexander Korotkov wrote:
> >> Implementation of subscripting for jsonb
>
> > The Itanium and sparc64 buildfarm members didn't like this, and are
> > crashing at "select ('123'::jsonb)['a'];". Unaligned memory access, perhaps?
>
> I think I just identified the cause.

Thanks again for fixing this.

BTW, I managed to reproduce the issue by compiling with CFLAGS="-O0
-fsanitize=alignment -fsanitize-trap=alignment" and the patch
attached.

I can propose the following to catch such issues earlier. We could
finish (wrap attribute with macro and apply it to other places with
misalignment access if any) and apply the attached patch and make
commitfest.cputube.org check patches with CFLAGS="-O0
-fsanitize=alignment -fsanitize-trap=alignment". What do you think?

------
Regards,
Alexander Korotkov

Attachment Content-Type Size
pg_comp_crc32c_sse42_no_sanitize_alignment.patch application/octet-stream 348 bytes

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Alexander Korotkov 2021-02-01 13:00:21 Re: pgsql: Implementation of subscripting for jsonb
Previous Message Alexander Korotkov 2021-02-01 11:07:58 pgsql: Get rid of unnecessary memory allocation in jsonb_subscript_assi

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2021-02-01 13:00:21 Re: pgsql: Implementation of subscripting for jsonb
Previous Message Greg Nancarrow 2021-02-01 12:41:41 Re: Parallel INSERT (INTO ... SELECT ...)