Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iPxta-00069r-Ur for pgsql-bugs@arkaria.postgresql.org; Thu, 31 Oct 2019 00:00:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iPxtZ-00047m-Jn for pgsql-bugs@arkaria.postgresql.org; Thu, 31 Oct 2019 00:00:57 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iPxtZ-00047f-4g for pgsql-bugs@lists.postgresql.org; Thu, 31 Oct 2019 00:00:57 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iPxtV-0005jQ-Kr for pgsql-bugs@lists.postgresql.org; Thu, 31 Oct 2019 00:00:55 +0000 Received: by mail-wr1-x443.google.com with SMTP id e6so2452913wrw.1 for ; Wed, 30 Oct 2019 17:00:53 -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:references:mime-version :content-disposition:in-reply-to:user-agent; bh=iKxJS/Z9zaqq81PPOmo5N4qEj6mVcYdBWl+NoXQeeSw=; b=kxQuYdCcR3unv1MmOgs70DUS9r46Q4Jq2xCULixO6/bfeksiNsXxbLWt9DW6tYsiqt HH59pj3xzU6XXnE+7LPybQj255/r4L8NcYBZQL9wl/2CJk5gxu8ySKB1TJCxKzo5cyxq ItNIpB2nF+48Kd37nDBRmymX7Dy9/L/V+3UDyiuqhuba8rRCnPBTnw6tDt9ADlvR6U9z WVT2y3FdVKsV0MiCqqxAqurTTng6Cx3ja1tBo0Kuy7UTdpai3DNevkS9Cpprs3rylaLe m4KCWWTubxfTL4/h2vWgF0SJ66bkeC+LcJpVyTIQ0XGSSjRJxIJkoVYny6VN/056DBGN eAhg== 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:references :mime-version:content-disposition:in-reply-to:user-agent; bh=iKxJS/Z9zaqq81PPOmo5N4qEj6mVcYdBWl+NoXQeeSw=; b=Ia37YdNWbT6NpTYIWtWYeQFn0oL8zVV7ZXrG8liv9DbjroDa0XG/lT0tbd8pJQn+cI nYCJfekylTqEGsUXXC/Mxsg3jzQcLEfZ9eOjFvfKv/56aam+qAeKtvwAPmzwui4+NMtm eYA3X2KVWYncaOXs5VFV8iy2Jaus1idoIiMKiCsRBRgDFOHedU4qJT0lbP+W43dQwecY ssl9/6f36F0ITl4wD/HF8UkeixlVVkZ9qci8K3xie2c2Sj2JFPjIVXYBtyZIIkWtEQBR z/YxXwp09n5Cq5sfRmnY9CzpcEabzSjdnxHRCcylm2pD6G5hXDC/3IU40RHJMRJyjlVn MIDg== X-Gm-Message-State: APjAAAURYij9/7ADyZ47pwKHqSf3AzpYZ0uELusmNctQ/XO5Rb6sAqrG 6my7IB2BkBMQ1YKL2rTPJqq54w== X-Google-Smtp-Source: APXvYqwpTyex0LgaHEhNc5T5ddPHcH5jlGNFOv04kL6ncKKYnA+yfE3SBef5lwNWC1vvqunv2kToZA== X-Received: by 2002:adf:e286:: with SMTP id v6mr2440242wri.241.1572480052115; Wed, 30 Oct 2019 17:00:52 -0700 (PDT) Received: from localhost (ip-86-49-253-183.net.upcbroadband.cz. [86.49.253.183]) by smtp.gmail.com with ESMTPSA id b66sm1806409wmh.39.2019.10.30.17.00.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Oct 2019 17:00:49 -0700 (PDT) Date: Thu, 31 Oct 2019 01:00:48 +0100 From: Tomas Vondra To: Alvaro Herrera Cc: cilizili@protonmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16082: TOAST's pglz_decompress access to uninitialized data, if the database is corrupted. Message-ID: <20191031000048.sz4ykfqyxjjitbvu@development> References: <20191026215646.5e2brazqzboxclf4@development> <20191030203014.GA5452@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20191030203014.GA5452@alvherre.pgsql> User-Agent: NeoMutt/20180716 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Wed, Oct 30, 2019 at 05:30:14PM -0300, Alvaro Herrera wrote: >On 2019-Oct-26, Tomas Vondra wrote: > >> On Sat, Oct 26, 2019 at 07:46:25AM +0000, PG Bug reporting form wrote: > >> > There is two case that they are valid for invalid data. In the case 1, it >> > reads an uninitialized data in the dest. In the case 2, it reads >> > uninitialized or out-of-bound data in the dest. They are invalid. > >> Well, failure like this after reading corrupted data from disk is not >> really surprising and it's hardly a bug. It's kinda intended to work >> that way, really. > >There's some weight to the argument that the server should just crash >but instead report an ERRCODE_DATA_CORRUPTED message, such as what >happens with (say) invalid page headers. It would probably require a >lot more branches in the detoasting code that might decrease >performance, though. A patch would help to see how bad that would be, >though offhand I would expect it to be very bad. > That's true. I have to admit it wan't really clear to me the current behavior is a crash. If there's a reasonably simple and low-overhead way to detect these issues and report a data corruption, then sure - let's do that. OTOH this is interenal data, and I'm sure there are countless places where a bit of data corruption can cause issues. Checksums seem like a fairly reasonable solution, IMHO. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services