Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1foQXQ-0007i9-2R for pgsql-hackers@arkaria.postgresql.org; Sat, 11 Aug 2018 09:50:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1foQXN-0005rm-Ia for pgsql-hackers@arkaria.postgresql.org; Sat, 11 Aug 2018 09:50:21 +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_SHA384:256) (Exim 4.89) (envelope-from ) id 1foQXL-0005rL-T3 for pgsql-hackers@lists.postgresql.org; Sat, 11 Aug 2018 09:50:21 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1foQXE-0001Iw-1w for pgsql-hackers@postgresql.org; Sat, 11 Aug 2018 09:50:19 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 73D8F20A8B; Sat, 11 Aug 2018 05:50:08 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Sat, 11 Aug 2018 05:50:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=zI2+CI1uszyOFcHvwHPlGA3kxrKn8NcGw2mHDIm0HhQ=; b=Y1xy2oiM 9FoAQypCPCbXan1Pbg41O7sH79hRos8B7513ZrDPwiQSiQf0GWw/vaJGVHMPQPUW GZf7YWwFpYfY7y3ANIffcv4ypvd5NFRmjqsB45FENn2I5p9wXYAW5K7HhGGXRo5O Wj5YEBQOMMAkUaHRwRtGuK4X9xRbwoJthX61YlYdysua4n+VUKzk31mHBik6ks9I 3QZmABnj0alCCvQfRCTlcF8fevN0Fs/Kb4345jf2afakVqkhPN3nRUKqGgio9Tnj AioM4AfqENA3fybBPbJwwAWQfQlfr0j9JX9Zt1tw9a2eOzRIP0C3wcBnygp1XJSH keLaW5KhWpCevA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; bh=zI2+CI1uszyOFcHvwHPlGA3kxrKn8 NcGw2mHDIm0HhQ=; b=FLNq1lk6a1aN1TOlq5RYoefv824i4jyKYR6JzhyahCh9a Od85MnI+QfNjZfhS4Lp/Re4vaxXgN/dXQoDH3duES3HlZSjMsZZioWhJX4W/UFr5 uIVGe9J5YEqOCnsyH7h4MLAuzjNqgQ/Jei/c3gzcp5zOas99xMY/5ViiNmw3xZjQ GB3ukYx5AGWfxhVtzCKND257qM8sEAPqZTcAlPNKKN7hLCRb4cLQ4cF+2AumiZmE 3dqDNNGdsxBQLWLtBXgoeRQyrWw9tRvKi/Ny5WgwOS1RI6vKJUUbp3wHFnfunfF5 pzRTted6Eefzy50DTKaJTy5NMQk8Q4Ij5PoJ1Nb4A== X-ME-Proxy: X-ME-Sender: Received: from paquier.xyz (lfbn-ann-1-147-30.w86-200.abo.wanadoo.fr [86.200.114.30]) by mail.messagingengine.com (Postfix) with ESMTPA id C011B1025C; Sat, 11 Aug 2018 05:50:05 -0400 (EDT) Date: Sat, 11 Aug 2018 11:50:03 +0200 From: Michael Paquier To: "Bossart, Nathan" Cc: Kyotaro HORIGUCHI , "andres@anarazel.de" , "pgsql-hackers@lists.postgresql.org" , "robertmhaas@gmail.com" , "Schneider, Jeremy" , "pgsql-hackers@postgresql.org" , "lalbin@scharp.org" Subject: Re: BUG #15182: Canceling authentication due to timeout aka Denial of Service Attack Message-ID: <20180811095003.GA2900@paquier.xyz> References: <20180726204127.GA1754@paquier.xyz> <3D4F2733-92AE-4B74-8912-3C611B027721@amazon.com> <20180727023123.GE1754@paquier.xyz> <20180727.123702.77822416.horiguchi.kyotaro@lab.ntt.co.jp> <20180727041542.GH1754@paquier.xyz> <62728D88-85A0-4A9A-A4F8-67D96C1179E0@amazon.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="7AUc2qLy4jB3hD7Z" Content-Disposition: inline In-Reply-To: <62728D88-85A0-4A9A-A4F8-67D96C1179E0@amazon.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --7AUc2qLy4jB3hD7Z Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi Nathan, On Fri, Jul 27, 2018 at 02:40:42PM +0000, Bossart, Nathan wrote: > I think I'm essentially suggesting what you have in 0002 but without > the new RangeVarGetRelidExtended() callback. I've attached a modified > version of 0002 that seems to fix the originally reported issue. (I > haven't looked into any extra handling needed for ANALYZE or > partitioned tables.) Running the same checks for all VACUUMs would > keep things simple and provide a more uniform user experience. I have been looking at this patch for VACUUM (perhaps we ought to spawn a new thread as the cases of REINDEX and TRUNCATE have been addressed), and I can see a problem with this approach. If multiple transactions are used with a list of relations vacuum'ed then simply moving around the ACL checks would cause a new problem: if the relation vacuum'ed disappears when processing it with vacuum_rel() after the list of relations is built then we would get an ERROR instead of a skip because of pg_class_ownercheck() which is not fail-safe. Wouldn't it be enough to check just the ACLs in expand_vacuum_rel() and get_all_vacuum_rels()? The first is rather similar to what happens for TRUNCATE, and the second is similar to what has been fixed for VACUUM. We should also remove the relkind checks out of vacuum_skip_rel() as those checks are not completely consistent for all those code paths... -- Michael --7AUc2qLy4jB3hD7Z Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAltusUsACgkQnvQgOdby QH2c+Q//WxnhzskpZCTB2W2NkXhT4aJqIhuIb5Rgod6wMtKajrcZrb0AkXqUpnuK NJboKq9QLHHS+2Y1uhJWfAZAgwNf0oqJ9fG1abd28wrbkhQYNd7eemATpQSTvdS4 jOi1CsuMCgkx8YwaYy1Pr+DZHZQN2ZasJ5IVL3+362/J7qXsQTsf8tAPgfc4TKck AR8cDERwBagF3IrFvS+rbNezdF5wJJE1pA6IH1EBC2ZkWzqcm/rHboNB70DP2eH2 fsez5+kD/C89AHZc/e8MmGA1OJEXv22wBcCqtHs4dkS6ZfRE1TTWx2YH6KRmV9sk klYUtD6zkfVhf5bgK9j2mKesDwgNhSxYD72RIq7HHixl43d2uo4VrSkYeGiZnzJ/ STWzxQKJdgQ+pe4YWbVzGBPPmV3blU5Tn7Km5vBvygNyGU5wtqbuvx8RrMsIxr6+ mPruujPKWJPL1Qkwz/3FuQkdGFlw59ZrtSRlRa1gCS1HWDvFkLPO3vmpGpUgYxaT 1BeCTugeQF010/6EiZ9p7/2GVIhLaMrI3aXykN/oeSSLSm7bV6Ulp161SiIbQqCp WllA3cp4nyiJ7l0Iui3J7dndppvBjh3FZFrf/3pUIPDaJwxDSQLpysM/7zeEkhxT lRrW+tU3OP8Xo7Y80rjuk6tTqWwIAd2C2LkDar60X5PGm/MW5rw= =NAKF -----END PGP SIGNATURE----- --7AUc2qLy4jB3hD7Z--