Re: pgsql: Implementation of subscripting for jsonb
Alexander Korotkov <aekorotkov@gmail.com>
From: Alexander Korotkov <aekorotkov@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Heikki Linnakangas <hlinnaka@iki.fi>,
Alexander Korotkov <akorotkov@postgresql.org>, pgsql-committers <pgsql-committers@lists.postgresql.org>
Date: 2021-02-01T13:00:21Z
Lists: pgsql-hackers
Attachments
- pg_attribute_no_sanitize_alignment.patch (application/octet-stream) patch
On Mon, Feb 1, 2021 at 3:41 PM Alexander Korotkov <aekorotkov@gmail.com> wrote:
> On Mon, Feb 1, 2021 at 10:06 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> > Heikki Linnakangas <hlinnaka@iki.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?
The revised patch is attached. The attribute is wrapped into
pg_attribute_no_sanitize_alignment() macro. I've checked it works for
me with gcc-10 and clang-11.
------
Regards,
Alexander Korotkov
Commits
-
pg_attribute_no_sanitize_alignment() macro
- cc7ea0717b12 9.6.22 landed
- c86eae39ce1e 13.3 landed
- c3dc311ffd64 12.7 landed
- 22001684623b 11.12 landed
- 02e7da01a436 10.17 landed
- 993bdb9f935a 14.0 landed
-
Tweak compiler version cutoff for no_sanitize("alignment") support.
- ad2ad698ac16 14.0 landed
-
Implementation of subscripting for jsonb
- 676887a3b0b8 14.0 cited