From: | Andres Freund <andres(at)anarazel(dot)de> |
---|---|
To: | Aleksander Alekseev <a(dot)alekseev(at)postgrespro(dot)ru>,Heikki Linnakangas <hlinnaka(at)iki(dot)fi> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>,Chapman Flack <chap(at)anastigmatix(dot)net>,pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>,Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> |
Subject: | Re: Re: PROPOSAL: make PostgreSQL sanitizers-friendly (and prevent information disclosure) |
Date: | 2016-08-19 15:20:06 |
Message-ID: | D6352779-0C7A-4997-9135-6D4D7D1E023C@anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On August 19, 2016 2:50:30 AM PDT, Aleksander Alekseev <a(dot)alekseev(at)postgrespro(dot)ru> wrote:
>Heikki, Peter, thanks a lot for code review!
>
>> What's going on here? Surely pg_atomic_init_u64() should initialize
>> the value?
>
>It's because of how pg_atomic_exchange_u64_impl is implemented:
>
>```
>while (true)
>{
> old = ptr->value; /* <-- reading of uninitialized value! */
> if (pg_atomic_compare_exchange_u64_impl(ptr, &old, xchg_))
> break;
>}
>```
>
>Currently pg_atomic_init_u64 works like this:
>
>pg_atomic_init_u64
>`- pg_atomic_init_u64_impl
> `- pg_atomic_write_u64_impl
> `- pg_atomic_exchange_u64_impl
>
>I suspect there is actually no need to make an atomic exchange during
>initialization of an atomic variable. Regular `mov` should be enough
>(IIRC there is no need to do `lock mov` since `mov` is already atomic).
>Anyway I don't feel brave enough right now to mess with atomic
>operations since it involves all sort of portability issues. So I
>removed this change for now.
There's platforms with atomic 8 byte compare exchange, without atomic 8 byte regular stores.
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
From | Date | Subject | |
---|---|---|---|
Next Message | Jim Nasby | 2016-08-19 15:38:50 | Re: [PATCH] add option to pg_dumpall to exclude tables from the dump |
Previous Message | Peter Eisentraut | 2016-08-19 14:56:20 | Make better use of existing enums in plpgsql |