Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w718I-004sNe-0e for pgsql-bugs@arkaria.postgresql.org; Mon, 30 Mar 2026 01:09:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w718G-000ElI-2A for pgsql-bugs@arkaria.postgresql.org; Mon, 30 Mar 2026 01:09:33 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w718G-000El9-1P for pgsql-bugs@lists.postgresql.org; Mon, 30 Mar 2026 01:09:32 +0000 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w718D-00000001j14-2zjL for pgsql-bugs@lists.postgresql.org; Mon, 30 Mar 2026 01:09:30 +0000 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-43b949bf4easo2227612f8f.0 for ; Sun, 29 Mar 2026 18:09:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774832968; cv=none; d=google.com; s=arc-20240605; b=hI7xbF5SioBIxHPEqEndpRfUm6E1pzJJ6q2j6AUQJ9ol6sefPvSXE3sCyUGLyB1NxQ jHRR+A2AMSgIeapbvb0BUxWuZ+A8Yb/Ay/OKCRDHrUWPw00dOC0PKWlCrA8dcGQfouA8 kNkfvaXT14QDjrnstX3NVYR/RgkI+HVymY9rNczhgQs3vj4ZhPxFuFxK/dise0FMtH92 N2h8kSj6fjRRXuvyMVSApBP6GjKQlVNBlU9BCA7dehRXJlTsD5Myh3Mfrq9NP1r+k5W6 lUtyEsqc7nsZBuuWZcb/jJXlfLxO9TKg2R7SgFz0fJ4/fEZ9eK+9uTthJIWKbWSlSlJK qQew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=/0lbcPfYlA6ATPk8re/bd7f7STCfcjbJB1RAYLcGskI=; fh=tInmfoQmuva+JOYgnkCDZe4kwOs2DHr7JxZ0nifTTm8=; b=iipD/UwJYkn5UgSB7H3MxV8vs0+n6s900f7FyCWV8EVQUyg8yJV0RD9IaVTi9YIcrt baclJQ4vac0g3Gd0Mfku47Ew/TonXemIbQXpLUS10xyqe1cvp49TUm14Xi18dq2lUwsd 4sNML1BmmRT+XeGWygwTrDcVqsMXHGG+7jAlQgXDFpu6BxYtLvhelUjZWu7rOCBv/1LX pG4hl5Lb/z/s1uJKYARGfyN1TZzGNdq4gOIOLC1harrIxYz9BEw86+mlddxLSCOGIRuG YYDlHawBqqqvTvr5cZ039OovLHPXR6nWXv5v3cLy/EheZVDcike+qyG36LNisCUvolM0 L9jg==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774832968; x=1775437768; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=/0lbcPfYlA6ATPk8re/bd7f7STCfcjbJB1RAYLcGskI=; b=QgLiPtGGwp6ALGzyGdMrAagHTR5vArkLpnncciMMsAZVgtlIgxhSjM1YFpUvBDfgdR lTW0Ch6IW7QwzrESfXMR08iWDA5RxP/N/CxNrh8VGm5dKnJLh4VfUTUK4xt9o99VwYdj LFso/EAtz6jiDm9lX1R/m9RzzGJkVFQ9eewzWO1IUv+lwfDxUbFRhmFlXdT+r2ymMsmx 5Nsf7SDzhrXdbA5l8q+RdwmfEtoEXkiKne5WgMPk+X1yG/LlKQ/u7J+RCkeapGWtd4ZZ QxaYpEu3N4RM2kCw9gZkGE0QLOgzR91JIul2UJn5d2jFvDT+kAkAQAJpG5KECsdYPIAf Bl2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774832968; x=1775437768; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=/0lbcPfYlA6ATPk8re/bd7f7STCfcjbJB1RAYLcGskI=; b=mHciFkmndBN7obpvGoIHYHsKn47PtnVhzHBHwGdfUaEm1JiMR39Y2dYQIQyPMw8bZW gtOfWs1JSJgmn5mTsnCaauDRtUk0ZvKn+N/ltKok8UWkkOYSQsDrZKkqPE3cTuRZ1IOr PFbILJdC8MoQbiq6LR6lONgca7jkAnHU6iliKgCToTIRdfdTeoHi938N7vxRElmZmJ2B jACmZYVsRfP5vMM38rILhSoR0TzvRvIO05YHaWh6BkKZ+9XHOoTq2piLtiLG2GlXOI4g U8+DQAe/U0BganI3zHa4xIAN4DuOldyqlALKZArNGI+pzUOT+EWxj9ED4/zpNDYVQPRg NtGA== X-Forwarded-Encrypted: i=1; AJvYcCUFi6yKnxpz6pu8uEPraXrCbsENeKqmQhisRBULx/QiQFZmjFfXgQ+gaQrYBDQ/rMm6XImWi78Afjqc@lists.postgresql.org X-Gm-Message-State: AOJu0YysRPDYyMxH29oFFlrDowIwPch/9pCxJILU3mvcqVz2l4Bnmxjy +guLDY3qVuMklqDAsX7O+QG9PKM8FLYuRW+94x2YKP9YUOaHVr6Rq2ERrppdmRaktz23oCjHllx DukD/jRDvCS20AGYpeqcBGQsNwYRmCf0= X-Gm-Gg: ATEYQzxwqOVicJlVFO0UgEMB+xQMneFMJwSYkpvFr4D/ZE22NCjVWxr4iTUcz1hMM+Q WPtjWG8yJeXNUFKdQnKS3NN6J9Kdj6wcGbNrWsQY46/k4LEXhrpc5T+2JWjbBdOUcAXxBfRUvM2 7jmN/bh0RZteMAURwsuu8L45ce4JUN+ONQf527iaiK3h/qcbys2Jl03GBWB2MT+61COUh66ff28 S5WJKjBkjxCg44Ge5LnKbaW4L2W2yEhzYr3RCR2LEDFhJlkqolrfH1dtbAwfiWq3Xr2fStmi4AD 0MajHweQr0p4er59P2/RwlqwfdbWWTL1MI3Xan1rZOROwxoAD8/4pJqVREB3f0YvxPX7076nxQ= = X-Received: by 2002:a05:6000:240d:b0:439:bb46:7457 with SMTP id ffacd0b85a97d-43b97a4b813mr22466090f8f.16.1774832968209; Sun, 29 Mar 2026 18:09:28 -0700 (PDT) MIME-Version: 1.0 References: <19438-9d37b179c56d43aa@postgresql.org> <1106026.1774573371@sss.pgh.pa.us> <1338824.1774633289@sss.pgh.pa.us> <1830345.1774798374@sss.pgh.pa.us> <1881853.1774828272@sss.pgh.pa.us> <1886754.1774830888@sss.pgh.pa.us> In-Reply-To: <1886754.1774830888@sss.pgh.pa.us> From: David Rowley Date: Mon, 30 Mar 2026 14:09:16 +1300 X-Gm-Features: AQROBzAIFIg-x85tA7jQXgoyLygFusJ4ddpoTneVZ8IpZTQ1hseTmB56Qi6h_T0 Message-ID: Subject: Re: BUG #19438: segfault with temp_file_limit inside cursor To: Tom Lane Cc: kuzmin.db4@gmail.com, pgsql-bugs@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, 30 Mar 2026 at 13:34, Tom Lane wrote: > > David Rowley writes: > > On Mon, 30 Mar 2026 at 12:51, Tom Lane wrote: > >> Seems like a reasonable answer. What do you think of making the > >> double-free cases ERRORs across the board? If we don't error out, > >> there will likely be cascading problems in all the mcxt types not > >> just this one. > > > I think it's a good idea. It might slightly increase the chances that > > we get a report about an issue. I suppose the logic in deciding which > > elevel to make it could be applied about equally to the sentinel byte > > check as well. Maybe that should also be an error for the same reason. > > I thought about that, but it's been a WARNING for a long time and I'm > hesitant to change that. We've seen many cases where scribbling one > or two bytes past the end of the requested size doesn't actually cause > fatal problems, because that was padding or unused space anyway. > Double frees are in a different category: if we let one happen, > it's pretty much guaranteed to cause hard-to-decipher problems down > the road. (The fact that that didn't happen in the particular case > reported here doesn't mean it's usually okay.) Fair. Maybe worth a short comment in the code to explain why we don't use the same elevel then? Just considering someone stumbling upon the variation in the future and reporting or asking why, and us having to dig up the reason why in the archives to answer them. Maybe something like this? /* * Test for someone scribbling on unused space in chunk. Small * overwrites are less likely to cause issues than a double-free, so * warn for this instead of erroring. */ David