patch: prevent user from setting wal_buffers over 2GB bytes

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: patch: prevent user from setting wal_buffers over 2GB bytes
Date: 2015-07-31 01:17:08
Message-ID: 55BACC94.6040207@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hackers,

In guc.c, the maximum for wal_buffers is INT_MAX. However, wal_buffers
is actually measured in 8KB buffers, not in bytes. This means that
users are able to set wal_buffers > 2GB. When the database is started,
this can cause a core dump if the WAL offset is > 2GB.

Attached patch fixes this issue by lowering the maximum for wal_buffers:

josh(at)Radegast:~/pg94a$ bin/pg_ctl -D data start
server starting
josh(at)Radegast:~/pg94a$ LOG: 393216 is outside the valid range for
parameter "wal_buffers" (-1 .. 262143)
FATAL: configuration file "/home/josh/pg94a/data/postgresql.conf"
contains errors

Thanks to Andrew Gierth for diagnosing this issue.

--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com

Attachment Content-Type Size
fix_wal_buffer_max.patch text/x-patch 520 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2015-07-31 01:46:49 Re: Doubt about AccessExclusiveLock in ALTER TABLE .. SET ( .. );
Previous Message Michael Paquier 2015-07-31 01:03:12 Re: creating extension including dependencies