pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: bret.shao@outlook.com
To: pgsql-bugs@postgresql.org
Subject: BUG #14615: ReplicationOriginShmemInit Memory access cross-border
Date: Mon, 10 Apr 2017 06:26:21 +0000
Message-ID: <20170410062621.25948.74646@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

The following bug has been logged on the website:

Bug reference:      14615
Logged by:          bret shao
Email address:      bret.shao@outlook.com
PostgreSQL version: 9.6.2
Operating system:   linux
Description:        

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. 


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


view thread (4+ messages)  latest in thread

Message-ID: <20170410062621.25948.74646@wrigleys.postgresql.org>
Permalink:  ../20170410062621.25948.74646@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/20170410062621.25948.74646@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: bret.shao@outlook.com
  Subject: Re: BUG #14615: ReplicationOriginShmemInit Memory access cross-border
  In-Reply-To: <20170410062621.25948.74646@wrigleys.postgresql.org>
  References: <20170410062621.25948.74646@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox