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 1vyJTO-00012C-0n for pgsql-hackers@arkaria.postgresql.org; Fri, 06 Mar 2026 00:55:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vyJTM-00249T-0b for pgsql-hackers@arkaria.postgresql.org; Fri, 06 Mar 2026 00:55:20 +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 1vyJTL-00249K-2g for pgsql-hackers@lists.postgresql.org; Fri, 06 Mar 2026 00:55:20 +0000 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vyJTK-00000000gz2-0ztg for pgsql-hackers@postgresql.org; Fri, 06 Mar 2026 00:55:19 +0000 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-2ae46fc8ec1so35618255ad.3 for ; Thu, 05 Mar 2026 16:55:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772758517; x=1773363317; darn=postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=o1JOwxfvhzfoA2oCSVh3omld/E7Bx29pVrf8LjfqnR8=; b=XgYTQfX3m0xsDS22ZFR83rrXXCIGlR4uh23+tjDvRqnGAX9GySg1q7q/UH/JqqRc1N qiTTlsHiOlMIWP9aO37/pPC9Z2hxg/NbpghLR54zSxJbXzeMUfJk1hkaIWScXS19p/nw EExZzO7Nso1z0c9vh06qCYCr+5UA7KiZukTb5byIfwxcwMj0X5T05N3j15nzQZ7mdlcb ykU0VyayY3wdcIAo0i6C71eLXm61/vITMSAQEIi25Dnacqxrbqtp/FwhiQJNZ28zFK0G Reu5xRBHeDOLdzIC9SmBNuzWCziC4gpe5BO9VwY7+NLdctJAFtZt2mAIN80cP2L2ZOdY GJSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772758517; x=1773363317; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=o1JOwxfvhzfoA2oCSVh3omld/E7Bx29pVrf8LjfqnR8=; b=SWdav/h2oGOLGCPLRwYc6dLtahtVCdRPayPAe2PJJSVUD8oNXIZj8o5ZxqSe9KBreh H4ZimWtGHH1NX1XS/36Y9i8V1brki2cIYB6MU321mzCOHS/x6jU4P/dwReRwSpR68cRW BixpUSJOSiww9YD2LZb5rgQCtmOngP+UqE4VejxludO1dptVygX83DODdGBcKTvytxx7 9mA65azMXSBnQ9GG1gadNO1NkeeZmKcN1eP4hZSLUSENHZ/yMgmDgbNTmVaar8GWDJjI by2lPTWXNiv5r5xuLQng1Y0+JBvAMulORq0zyAGgriSNHlkOLkCelfz0KIWMTfGqW+SX o0MA== X-Forwarded-Encrypted: i=1; AJvYcCXIBnOQgVQfNjbzT8OUh5FFWTtiW9SAvUbjnY/af+Q0M7Uu9GfjADuS5GHaQZSTF8QFIFV+16IB9Gf5etPp@postgresql.org X-Gm-Message-State: AOJu0Ywkf4SybnX030BKirIZTFg900B41qwZ8JhOJtTfDHZvB780XD7h BlZTeFDLreJe1Oc6sehWv+WlU2KAMAA1YtVvKYdKDAKy2f3WkRjULMJH X-Gm-Gg: ATEYQzxBmEUgpTcOg5TtQuMph1atx4OlBVmZHljvzNwGxZ2n0OajgW5zqf70FJjjPRw u1IUqwW9RdYBRzcF/pN14I0Uns/gCvsBHCowEhkMxdc0g2fBLahv9yuRUFuQcB00X54995spWnn orRDuSzxQNFyme3q2z43Rrb9sFEWiNiEmDbI6/TVmAZy732eTB8BRN9srbohYiEBZ6qJxEE+zU+ m8NeQGvAXnzpnijFJYmQTfvcB1mve3CcsOeC3slQYi4ChJtVret4xuRnKNiCK2j0fDRc7rBUUch uAk0tlRZB5im62C+tb5E4AQIHZmSJQxAZQ5uJMUVTN5wijLtfyBAjjpgK7TAgtFbdlkoHqXYA2f L9JhND/HMa2pUa3sBLg5oANr0eLr24DAV3J9vGSn7AkO1AjmDW01LM0aTd4T8IBedRZCGQzIetX JIdsgPX+L5uiRgBOd3fZn8KANhWedJWKCABggd7qJiIA== X-Received: by 2002:a17:903:2342:b0:29f:2b8a:d3d with SMTP id d9443c01a7336-2ae8237531fmr4556055ad.4.1772758517194; Thu, 05 Mar 2026 16:55:17 -0800 (PST) Received: from smtpclient.apple ([45.32.121.103]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2adfab58c4asm250330315ad.0.2026.03.05.16.55.14 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Mar 2026 16:55:16 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.400.21\)) Subject: Re: [BUG + PATCH] DSA pagemap out-of-bounds in make_new_segment odd-sized path From: Chao Li In-Reply-To: Date: Fri, 6 Mar 2026 08:54:35 +0800 Cc: Sami Imseih , paul.bunn@icloud.com, pgsql-hackers@postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <044401dcabac$fe432490$fac96db0$@icloud.com> To: Michael Paquier X-Mailer: Apple Mail (2.3864.400.21) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Mar 6, 2026, at 06:49, Michael Paquier wrote: >=20 > On Thu, Mar 05, 2026 at 04:25:57PM -0600, Sami Imseih wrote: >> With the above assert in place, the usable_pages of 879 ars you have >> in test_dsa.c crashes >> due to the assertion failure. >=20 > Yep, the assertion looks useful to have in place. >=20 While debugging the code, I used the same Assert, which helped quickly = trigger the bug. Without the Assert, even if an OOB happens, it might = not immediately crash. But now that the bug has been identified and fixed, and the function is = self-contained, I=E2=80=99m not sure how much the Assert would still = help. Unless we are not sure whether the fix really works, otherwise I = don=E2=80=99t think the Assert is necessary. However, this is not a strong objection. If we do want to add the = Assert, I notice the expression MAXALIGN(sizeof(dsa_segment_header)) + = MAXALIGN(sizeof(FreePageManager)) appears multiple times, and the Assert = actually uses it as well. We could add a local variable like: ``` size_t metadata_fixed_bytes =3D MAXALIGN(sizeof(dsa_segment_header)) + =20 MAXALIGN(sizeof(FreePageManager)); ``` That would help reduce code redundancy. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/