Re: [BUGS] BUG #14615: ReplicationOriginShmemInit Memory access cross-border

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: [BUGS] BUG #14615: ReplicationOriginShmemInit Memory access cross-border
Дата
Msg-id CAB7nPqTOsW3WnxELtOAcs8vYB5o823DM3BTYwS2tuPEqKYcwOw@mail.gmail.com
обсуждение исходный текст
Ответ на [BUGS] BUG #14615: ReplicationOriginShmemInit Memory access cross-border  (bret.shao@outlook.com)
Ответы [BUGS] 答复: [BUGS] BUG #14615: ReplicationOriginShmemInit Memory access cross-border  (shao bret <bret.shao@outlook.com>)
Re: [BUGS] BUG #14615: ReplicationOriginShmemInit Memory accesscross-border  (Andres Freund <andres@anarazel.de>)
Список pgsql-bugs
On Mon, Apr 10, 2017 at 3:26 PM,  <bret.shao@outlook.com> wrote:
> MemSet(replication_states, 0, ReplicationOriginShmemSize()); in function
> ReplicationOriginShmemInit cause cross-border,because that start address of
> the share memory allocated is replication_states_ctl, but call MemSet to
> initialize this memory start from replication_states which is variable
> states's address in struct ReplicationStateCtl.so call MemSet to set 0 with
> the total size of this share memory will cross border of this share memory.
>
> Although, this cross-border will not caused the system failure due to share
> memory allocation strategy after my analysis. but i still believe we
> shouldn't do like this.
>
> Fix suggestion:
> change to
>  MemSet(replication_states_ctl, 0, ReplicationOriginShmemSize()); then move
> to the beginning of if statement.

Yes, there is a mistake here, but I don't agree with your solution. It
seems to me that using mul_size(max_replication_slots,
sizeof(ReplicationState)) is the way to go as you would reinitialize
what has been set in tranche_id. Per se the attached.
-- 
Michael

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Вложения

В списке pgsql-bugs по дате отправления:

Предыдущее
От: bret.shao@outlook.com
Дата:
Сообщение: [BUGS] BUG #14615: ReplicationOriginShmemInit Memory access cross-border
Следующее
От: shao bret
Дата:
Сообщение: [BUGS] 答复: [BUGS] BUG #14615: ReplicationOriginShmemInit Memory access cross-border