Re: Re: PROPOSAL: make PostgreSQL sanitizers-friendly (and prevent information disclosure)
От | Andres Freund |
---|---|
Тема | Re: Re: PROPOSAL: make PostgreSQL sanitizers-friendly (and prevent information disclosure) |
Дата | |
Msg-id | D6352779-0C7A-4997-9135-6D4D7D1E023C@anarazel.de обсуждение исходный текст |
Ответ на | Re: Re: PROPOSAL: make PostgreSQL sanitizers-friendly (and prevent information disclosure) (Aleksander Alekseev <a.alekseev@postgrespro.ru>) |
Список | pgsql-hackers |
On August 19, 2016 2:50:30 AM PDT, Aleksander Alekseev <a.alekseev@postgrespro.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.
В списке pgsql-hackers по дате отправления: