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.94.2) (envelope-from ) id 1sGHDa-00BDYg-33 for pgsql-bugs@arkaria.postgresql.org; Sun, 09 Jun 2024 12:00:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sGHDW-003yBy-PF for pgsql-bugs@arkaria.postgresql.org; Sun, 09 Jun 2024 12:00:11 +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.94.2) (envelope-from ) id 1sGHDW-003yBq-Eq for pgsql-bugs@lists.postgresql.org; Sun, 09 Jun 2024 12:00:11 +0000 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sGHDQ-000Sqz-QS for pgsql-bugs@lists.postgresql.org; Sun, 09 Jun 2024 12:00:10 +0000 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-52b7ffd9f6eso4026405e87.3 for ; Sun, 09 Jun 2024 05:00:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717934402; x=1718539202; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=B5memI/NMV01Ctz+lkUW1fJCT44QEDHk+2e+WBaGioQ=; b=KISUG38ulUXz4EMitRBETpu3PhEPmO630O+CMNyJBY4Ej3kSdAuc1vSfmcjOq944KU q00FppDd/1r9jo3hj8m5x+aFvCiKllUQQakiij9XPl07y86e6x+4WuyafiF/ZeJFFuGp 1T/hqWtcrOVcOp+gF2DVJCSee2UFITF/Dz0mitM9PO/msnozd5gtvHDKgj7EzTAGEg5P 4b9eeUkKnGIZ9f7oEWYFPkq89advYWKFZYkSz9/jUDE5xhXeuzzph5thl1nTJvfWkR6i Dw+OjNLFrf4vDX2xOrGyixe2UsEG6u+N6gYAHnP8aDx4+eX1Ne/KlW9h9++TtQG0q4tS zOlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717934402; x=1718539202; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=B5memI/NMV01Ctz+lkUW1fJCT44QEDHk+2e+WBaGioQ=; b=mIk4SJ2y0eDV82c3HHCKdHDnJYvwfS0H171WvR7/hgEOEhIEzTbxM3q+Wx1X7/4AcJ AtYZg8lN1ULOoIxNOzuvKJURHCEZ07Z1BkdBMka4rc9CKRdcaTwG1QynPwIW4eVQhfdM gcQoJZ6D5muq/vXXxLh+J1r7kXtyv21S/k4YGimEA2p8l8UIbCTRspZuyLh5svbMvsHa 3dqfwrzrbAcCwgUPFEkE9g8N8Qoh9REcmbE24dBSonwmco/YNzMOoCyKIVUXzNQYgIb6 gVgnmpSF6Br0YXSJGiujC0ilgGmo7EwiUWVZSbw26sG7gghzFfIcXjgBaLgjNQbOsSy4 V6nw== X-Forwarded-Encrypted: i=1; AJvYcCUVztrencxvghM7E55MCP6AB5/RYJtbsGnufEb8oNqGZaEuES5e+z4PXmC8NYg1XkbpR9vZR7Sn6Ke7Dm7xPciNFojHGUdNWgEgI6qtQUWS X-Gm-Message-State: AOJu0Yyq/86fVVSIcc+78SoFuk2rWNSd7f38vH2Jv9nJqoi0/Wria9bq Ek1kPS6D5Jqtt1Os7Wy7jT7SXYUpQczBQR4WpM7IqC11ofeTyuZGZAmwP39L X-Google-Smtp-Source: AGHT+IHzqdJyiq01mV9T2HHl+UKl0HajKir3cLaAKgCCcbpO63CCs80fuV8v8zbqVAxlAXjUxQYJAQ== X-Received: by 2002:a05:6512:1285:b0:519:1a91:30cc with SMTP id 2adb3069b0e04-52bb9f5f568mr6326109e87.4.1717934401828; Sun, 09 Jun 2024 05:00:01 -0700 (PDT) Received: from [1.0.0.7] ([178.155.25.76]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52bb41e1e78sm1119818e87.51.2024.06.09.05.00.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 09 Jun 2024 05:00:01 -0700 (PDT) Message-ID: <250a21e5-d677-6b2a-2692-cd4233785e37@gmail.com> Date: Sun, 9 Jun 2024 15:00:00 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: BUG #18483: Segmentation fault in tests modules Content-Language: en-US To: Tom Lane Cc: Michael Paquier , a.kozhemyakin@postgrespro.ru, pgsql-bugs@lists.postgresql.org References: <18483-30bfff42de238000@postgresql.org> <219049.1717792376@sss.pgh.pa.us> <439c9310-1d71-f2c6-b213-a9a2ea732ba9@gmail.com> <336833.1717859243@sss.pgh.pa.us> From: Alexander Lakhin In-Reply-To: <336833.1717859243@sss.pgh.pa.us> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello Tom, 08.06.2024 18:07, Tom Lane wrote: > Alexander Lakhin writes: >> May I ask you about the project policy regarding such test modules >> failures? >> Do you think all of these should be fixed or it's ok to have some >> server-crashing modules in the tree? > I don't think there's a one-size-fits-all policy for them. Since > we don't intend these modules to be installed, they don't really > need to work in any cases beyond the ones exercised in the tests. > Still, if it's easy to stop a misbehavior then we probably should. > The test_predtest problem was just a missing check-for-null so > I definitely regard that as worth fixing. These other ones would > have to be investigated enough to figure out the size of the fix > before I'd venture an opinion. Thank you for the explanation! Then maybe you would like to take a look at the rest of my collection and determine which sizes fit these issues: 2) echo " select test_enc_conversion('\x8bc68bcf8b', 'gb18030', 'gb18030', false); " >> src/test/regress/sql/conversion.sql TESTS="conversion" make -s check-tests produces (under Valgrind): ==00:00:00:05.947 3320530== Invalid read of size 1 ==00:00:00:05.947 3320530==    at 0x6F21E5: pg_gb18030_mblen (wchar.c:1000) ==00:00:00:05.947 3320530==    by 0x6F2BA0: pg_encoding_mblen (wchar.c:2072) ==00:00:00:05.947 3320530==    by 0x6B4EAF: report_invalid_encoding (mbutils.c:1700) ==00:00:00:05.947 3320530==    by 0x4867D3F: test_enc_conversion (regress.c:1154) ==00:00:00:05.947 3320530==    by 0x3B9796: ExecInterpExpr (execExprInterp.c:764) If I understand correctly, the defect is inside test_enc_conversion(), not in the core code. 3) echo " CREATE EXTENSION test_tidstore; SELECT test_is_full(); " >src/test/modules/test_tidstore/sql/test_tidstore.sql make -s check -C src/test/modules/test_tidstore leads to: Program terminated with signal SIGSEGV, Segmentation fault. #0  TidStoreMemoryUsage (ts=0x0) at tidstore.c:553 553             if (TidStoreIsShared(ts)) (gdb) bt #0  TidStoreMemoryUsage (ts=0x0) at tidstore.c:553 #1  0x00007f2d9c715cb7 in test_is_full (fcinfo=) at test_tidstore.c:308 #2  0x000055707450a302 in ExecInterpExpr (state=0x557074faecc8, econtext=0x557074faea98, isnull=0x7ffdd50b2747)     at execExprInterp.c:740 #3  0x0000557074506c49 in ExecInterpExprStillValid (state=0x557074faecc8, econtext=0x557074faea98,     isNull=0x7ffdd50b2747) at execExprInterp.c:1915 I guess, test_is_full() is missing a check-for-null too. 4) echo " CREATE TABLE tov(id int not null, ov oidvector); INSERT INTO tov (id, ov) VALUES (1, '1 2 3'); SELECT id, make_tuple_indirect(tov)::text FROM tov; " >> src/test/regress/sql/indirect_toast.sql TESTS="indirect_toast" make -s check-tests produces: ERROR:  invalid memory alloc request size 18446744073608493557 I guess, make_tuple_indirect() could be improved with:                 /* only work on existing, not-null varlenas */                 if (TupleDescAttr(tupdesc, i)->attisdropped ||                         nulls[i] || -                       TupleDescAttr(tupdesc, i)->attlen != -1) +                       TupleDescAttr(tupdesc, i)->attlen != -1 || +                       TupleDescAttr(tupdesc, i)->attstorage == TYPSTORAGE_PLAIN) Best regards, Alexander