Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jZ0s2-0004qI-KV for pgsql-hackers@arkaria.postgresql.org; Wed, 13 May 2020 23:33:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jZ0s1-0006DG-Iy for pgsql-hackers@arkaria.postgresql.org; Wed, 13 May 2020 23:33:01 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jZ0s1-0006CO-7R for pgsql-hackers@lists.postgresql.org; Wed, 13 May 2020 23:33:01 +0000 Received: from mail-qt1-x843.google.com ([2607:f8b0:4864:20::843]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jZ0ry-00010W-UT for pgsql-hackers@postgresql.org; Wed, 13 May 2020 23:33:00 +0000 Received: by mail-qt1-x843.google.com with SMTP id h26so1393513qtu.8 for ; Wed, 13 May 2020 16:32:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=g7v5MqntLnKJv7z/ilra3OW9X+H6gFhjAI615V7HRwo=; b=FCJZIMDDapdX9Gbv5jns9cA6W+mH2W9CmqFD01/MwwVUW8WlqE2KRlI9vB6TWS/gz+ MkCoFL1aMxZbkFb8MFE7Arq+M+m+XfmJHmROP028+gqmyF/01bq4lsfq+mCXOjlPaeep 6MC5w5SBrq8P9yENFjZphUyIMvSGwwXW6sHlcoDzwN7ffvSwDdFkd4SDEYBlA42VIGwm YS6Da/5fTnC7StQBy8EmuMoZIOTdMnnm9r221y4KEqCx1MLFtZatyCxTysTqzocpzYCO Qu+ZYM9xJtRvR0iSlxDY5of/ZPfA8PUGUgEArLIIYH5wApT4UweHHXk81xypSctFeHjX VO4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=g7v5MqntLnKJv7z/ilra3OW9X+H6gFhjAI615V7HRwo=; b=I+39GqQkxXPZhmjG4LqJv7V17Hvc9u8OGuiLTjFTp26CPPqGqVHBUfRH1hFZqlJOm9 XWYQI7g5MRntAEZj58Jz7d8lJRDQgm64IYb57+U25Kv3cUuSa0ebSk0XXpToAUfLLTBU hSe5oj3uSsP+Y1mSEfNu7kI+8xba8ZpSZQMUcg5Erq8HGejdvm+33yhVbeC8R/kfbbOI xokV1+8ocz8x6zlChvGzbbUEWOEWQ4bbcybJM+JOGoEA2AK/3U3Zb18lkZ3dXt1jpzfH lNm80MkiFzw/795LH1AtU32Ilfaj7a65NrFBOmLmrSgQROFr3hqYGVZALomq9eAFoRLF BaeQ== X-Gm-Message-State: AOAM532IZ2yya9pTgSDec1KqlV2bWMGeWNXW1zVKw7uFdYnHldEYlyS4 abr/ET+CbSdZPrnKC4WMHZ6NzA== X-Google-Smtp-Source: ABdhPJxVndUSssao+QZ43IPdJqcHebIDG4PTXfewBHfAvuR+AfLdHJBZXRb0w5oG4RKNDmujaX+oew== X-Received: by 2002:ac8:bc8:: with SMTP id p8mr1628015qti.135.1589412777001; Wed, 13 May 2020 16:32:57 -0700 (PDT) Received: from nimloth.alvh.no-ip.org ([190.95.18.252]) by smtp.gmail.com with ESMTPSA id d7sm1123035qkk.26.2020.05.13.16.32.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2020 16:32:56 -0700 (PDT) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id 33D92300689; Wed, 13 May 2020 19:32:54 -0400 (-04) Date: Wed, 13 May 2020 19:32:54 -0400 From: Alvaro Herrera To: Peter Geoghegan Cc: Mark Dilger , Robert Haas , Andres Freund , PostgreSQL-development Subject: Re: new heapcheck contrib module Message-ID: <20200513233254.GA32158@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-May-13, Peter Geoghegan wrote: > On Wed, May 13, 2020 at 3:10 PM Alvaro Herrera wrote: > > Hmm. I think we should (try to?) write code that avoids all crashes > > with production builds, but not extend that to assertion failures. > > Assertions are only a problem at all because Mark would like to write > tests that involve a selection of truly corrupt data. That's a new > requirement, and one that I have my doubts about. I agree that this (a test tool that exercises our code against arbitrarily corrupted data pages) is not going to work as a test that all buildfarm members run -- it seems something for specialized buildfarm members to run, or even something that's run outside of the buildfarm, like sqlsmith. Obviously such a tool would not be able to run against an assertion-enabled build, and we shouldn't even try. > I would be willing to make a larger effort to avoid crashing a > backend, since that affects production. I might go to some effort to > not crash with downright adversarial inputs, for example. But it seems > inappropriate to take extreme measures just to avoid a crash with > extremely contrived inputs that will probably never occur. My sense is > that this is subject to sharply diminishing returns. Completely > nailing down hard crashes from corrupt data seems like the wrong > priority, at the very least. Pursuing that objective over other > objectives sounds like zero-risk bias. I think my initial approach for this would be to use a fuzzing tool that generates data blocks semi-randomly, then uses them as Postgres data pages somehow, and see what happens -- examine any resulting crashes and make individual judgement calls about the fix(es) necessary to prevent each of them. I expect that many such pages would be rejected as corrupt by page header checks. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services