From: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: How to test Postgres for any unaligned memory accesses? |
Date: | 2021-04-26 14:02:01 |
Message-ID: | CALj2ACU=OtVXRAJmcgNcWLdBmHiNxksuPEgdZD2hnCF8dGHHwg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Apr 23, 2021 at 7:25 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> > I'm not sure this is the right way. I would like to know whether there
> > is a standard way of testing Postgres code for any unaligned memory
> > accesses. Thanks. Any help would be appreciated.
>
> Per c.h, late-model compilers have options for this:
>
> * Testing can be done with "-fsanitize=alignment -fsanitize-trap=alignment"
> * on clang, or "-fsanitize=alignment -fno-sanitize-recover=alignment" on gcc.
Thanks Tom!
I used the above gcc compiler flags to see if they catch memory
alignment issues. The way I tested on my dev system (x86_64 platform
with Ubuntu OS) was that I commented out max aligning specialSize in
PageInit, compiled the source code with and without the alignment
flags. make check failed with the alignment checking flags, it passed
without the flags.
With Regards,
Bharath Rupireddy.
EnterpriseDB: http://www.enterprisedb.com
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2021-04-26 14:08:53 | Re: Does rewriteTargetListIU still need to add UPDATE tlist entries? |
Previous Message | tanghy.fnst@fujitsu.com | 2021-04-26 13:48:55 | RE: use pg_strncasecmp to replace strncmp when compare "pg_" |