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 1iXXcj-0002k8-RP for pgsql-hackers@arkaria.postgresql.org; Wed, 20 Nov 2019 21:34:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iXXci-0001ML-3k for pgsql-hackers@arkaria.postgresql.org; Wed, 20 Nov 2019 21:34:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iXXch-0001ME-Qk for pgsql-hackers@lists.postgresql.org; Wed, 20 Nov 2019 21:34:51 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iXXcf-0007pw-CO for pgsql-hackers@lists.postgresql.org; Wed, 20 Nov 2019 21:34:51 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id xAKLYeC1028144; Wed, 20 Nov 2019 16:34:40 -0500 From: Tom Lane To: Amit Langote cc: Alvaro Herrera , Dilip Kumar , Amit Langote , Peter Eisentraut , PostgreSQL Hackers Subject: Re: CVE-2017-7484-induced bugs, or, btree cmp functions are not leakproof? In-reply-to: References: <20190925201550.GA23406@alvherre.pgsql> Comments: In-reply-to Amit Langote message dated "Thu, 26 Sep 2019 10:18:29 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <28142.1574285680.1@sss.pgh.pa.us> Date: Wed, 20 Nov 2019 16:34:40 -0500 Message-ID: <28143.1574285680@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Amit Langote writes: > [ v6-0001-Use-root-parent-s-permissions-when-reading-child-.patch ] I started to review this, and discovered that the new regression test passes just fine without applying any of the rest of the patch. Usually we try to design regression test additions so that they demonstrate that the new code does something different, so this seems a bit odd. Can't we set up the test to fail with unpatched code? Also, the test case contains no expression index, so I can't see how it'd provide any code coverage for the code added in examine_variable. The comment for inh_root_relid seems rather inadequate, since it fails to mention the special case for UNION ALL subqueries. But do we even need that special case? It looks to me like the walk-up-to-parent code is defending against such cases by checking relkind, so maybe we don't need to throw away info for UNION ALL. In general, if we're going to add inh_root_relid, I'd like its definition to be as simple and consistent as possible, because I'm sure there will be other uses for it. If it could be something like "baserel that this otherrel is a child of", full stop, I think that'd be good. I don't especially like the logic in examine_simple_variable, because it walks back up the AppendRelInfo chain but then proceeds to use rte = planner_rt_fetch(rel->inh_root_relid, root); without any sort of cross-check that it's stopped at that relation and not some other one. It'd be better to keep track of the top parent_relid while walking up, and use that. Or else make the loop stop condition be reaching the matching relid. regards, tom lane