pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix memory leak when initializing DH parameters in backend
4+ messages / 2 participants
[nested] [flat]

* pgsql: Fix memory leak when initializing DH parameters in backend
@ 2019-12-14 09:18 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 4+ messages in thread

From: Michael Paquier @ 2019-12-14 09:18 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix memory leak when initializing DH parameters in backend

When loading DH parameters used for the generation of ephemeral DH keys
in the backend, the code has never bothered releasing the memory used
for the DH information loaded from a file or from libpq's default.  This
commit makes sure that the information is properly free()'d.

Note that as SSL parameters can be reloaded, this can cause an accumulation
of memory leaked.  As the leak is minor, no backpatch is done.

Reported-by: Dmitry Uspenskiy
Discussion: https://postgr.es/m/16160-18367e56e9a28264@postgresql.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/e0e569e1d192c3fed942257302f24b550cf982f4

Modified Files
--------------
src/backend/libpq/be-secure-openssl.c | 3 +++
1 file changed, 3 insertions(+)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Fix memory leak when initializing DH parameters in backend
@ 2021-03-20 16:48 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2021-03-20 16:48 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix memory leak when initializing DH parameters in backend

When loading DH parameters used for the generation of ephemeral DH keys
in the backend, the code has never bothered releasing the memory used
for the DH information loaded from a file or from libpq's default.  This
commit makes sure that the information is properly free()'d.

Back-patch of e0e569e1d.  We originally thought the leak was minor and
not worth back-patching, but Jelte Fennema pointed out that repeated
SIGHUP's can result in very serious bloat of the postmaster, which is
then multiplied by being duplicated into eadh forked child.

Back-patch to v10; the code looked different before c0a15e07c,
and didn't have a leak in the actually-live code paths.

Michael Paquier

Discussion: https://postgr.es/m/16160-18367e56e9a28264@postgresql.org

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/992cba94d38ef20765e4c54e4dff00ae8a58a6c5

Modified Files
--------------
src/backend/libpq/be-secure-openssl.c | 3 +++
1 file changed, 3 insertions(+)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Fix memory leak when initializing DH parameters in backend
@ 2021-03-20 16:48 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2021-03-20 16:48 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix memory leak when initializing DH parameters in backend

When loading DH parameters used for the generation of ephemeral DH keys
in the backend, the code has never bothered releasing the memory used
for the DH information loaded from a file or from libpq's default.  This
commit makes sure that the information is properly free()'d.

Back-patch of e0e569e1d.  We originally thought the leak was minor and
not worth back-patching, but Jelte Fennema pointed out that repeated
SIGHUP's can result in very serious bloat of the postmaster, which is
then multiplied by being duplicated into eadh forked child.

Back-patch to v10; the code looked different before c0a15e07c,
and didn't have a leak in the actually-live code paths.

Michael Paquier

Discussion: https://postgr.es/m/16160-18367e56e9a28264@postgresql.org

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/c49e287a8e4dbc3013a56f88793638f79a6ef099

Modified Files
--------------
src/backend/libpq/be-secure-openssl.c | 3 +++
1 file changed, 3 insertions(+)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Fix memory leak when initializing DH parameters in backend
@ 2021-03-20 16:48 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2021-03-20 16:48 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix memory leak when initializing DH parameters in backend

When loading DH parameters used for the generation of ephemeral DH keys
in the backend, the code has never bothered releasing the memory used
for the DH information loaded from a file or from libpq's default.  This
commit makes sure that the information is properly free()'d.

Back-patch of e0e569e1d.  We originally thought the leak was minor and
not worth back-patching, but Jelte Fennema pointed out that repeated
SIGHUP's can result in very serious bloat of the postmaster, which is
then multiplied by being duplicated into eadh forked child.

Back-patch to v10; the code looked different before c0a15e07c,
and didn't have a leak in the actually-live code paths.

Michael Paquier

Discussion: https://postgr.es/m/16160-18367e56e9a28264@postgresql.org

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/7d9629ed2f69cd123514e0338cb20afca9abcd59

Modified Files
--------------
src/backend/libpq/be-secure-openssl.c | 3 +++
1 file changed, 3 insertions(+)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2021-03-20 16:48 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-12-14 09:18 pgsql: Fix memory leak when initializing DH parameters in backend Michael Paquier <michael@paquier.xyz>
2021-03-20 16:48 pgsql: Fix memory leak when initializing DH parameters in backend Tom Lane <tgl@sss.pgh.pa.us>
2021-03-20 16:48 pgsql: Fix memory leak when initializing DH parameters in backend Tom Lane <tgl@sss.pgh.pa.us>
2021-03-20 16:48 pgsql: Fix memory leak when initializing DH parameters in backend Tom Lane <tgl@sss.pgh.pa.us>

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