Re: [BUGS] Fwd: race in pg_ctl start -w

2012-10-18 Thread Heikki Linnakangas
On 18.10.2012 22:15, Alvaro Herrera wrote: Dave Vitek wrote: Heikki, It's happy about the overruns. It did flag an issue where the file descriptor can leak when the various early returns get taken. This is a common problem with static analysers; they don't realise we don't care about the le

Re: [BUGS] Fwd: race in pg_ctl start -w

2012-10-18 Thread Alvaro Herrera
Dave Vitek wrote: > Heikki, > > It's happy about the overruns. It did flag an issue where the file > descriptor can leak when the various early returns get taken. This is a common problem with static analysers; they don't realise we don't care about the leaked resource because the program is sh

Re: [BUGS] Fwd: race in pg_ctl start -w

2012-10-18 Thread Dave Vitek
On 10/15/2012 4:06 AM, Heikki Linnakangas wrote: On 11.10.2012 22:36, Tom Lane wrote: Heikki Linnakangas writes: Hmm, starting with 9.3, postmaster can not only create and append to the end of file, it can also inject a line in the middle, shifting the following lines forwards. In theory, if

Re: [BUGS] Fwd: race in pg_ctl start -w

2012-10-15 Thread Heikki Linnakangas
On 11.10.2012 22:36, Tom Lane wrote: Heikki Linnakangas writes: Hmm, starting with 9.3, postmaster can not only create and append to the end of file, it can also inject a line in the middle, shifting the following lines forwards. In theory, if a new line is injected into the middle of the file

Re: [BUGS] Fwd: race in pg_ctl start -w

2012-10-11 Thread Tom Lane
Heikki Linnakangas writes: > Hmm, starting with 9.3, postmaster can not only create and append to the > end of file, it can also inject a line in the middle, shifting the > following lines forwards. In theory, if a new line is injected into the > middle of the file between fgets() calls, readfi

Re: [BUGS] Fwd: race in pg_ctl start -w

2012-10-11 Thread Heikki Linnakangas
On 11.10.2012 20:29, Tom Lane wrote: Heikki Linnakangas writes: A straightforward fix would be to just allocate one large-enough buffer to begin with, e.g 8k, and read the whole file in one go. I'll write up a patch for that. This makes the readfile function very usage-specific though. The f

Re: [BUGS] Fwd: race in pg_ctl start -w

2012-10-11 Thread Tom Lane
Heikki Linnakangas writes: > A straightforward fix would be to just allocate one large-enough buffer > to begin with, e.g 8k, and read the whole file in one go. I'll write up > a patch for that. This makes the readfile function very usage-specific though. The fix I was thinking about was to mo

[BUGS] Fwd: race in pg_ctl start -w

2012-10-11 Thread Heikki Linnakangas
Forwarding this to pgsql-bugs, since this isn't a security issue, as pg_ctl can only be called an admin. My replies inline. Original Message Subject: [pgsql-security] race in pg_ctl start -w Date: Thu, 11 Oct 2012 12:39:02 -0400 From: Dave Vitek To: Hi, I don't really thin