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 1qldR2-003hum-0s for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Sep 2023 22:55:12 +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 1qldQ0-006HkN-1f for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Sep 2023 22:54:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qldPy-006Hk7-HS for pgsql-hackers@lists.postgresql.org; Wed, 27 Sep 2023 22:54:08 +0000 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qldPn-007yWC-Qw for pgsql-hackers@postgresql.org; Wed, 27 Sep 2023 22:54:06 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 3FFC0320095F; Wed, 27 Sep 2023 18:53:52 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 27 Sep 2023 18:53:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1695855231; x=1695941631; bh=Y+ m4WrGxOg/xafo5+qFcsizudtMniZIH3gm2S7k1r9A=; b=K1lhD+YGe9TyzDsnFA Bp8ciZAD0v05LuM/6/F9V0Aou9bc0swKwwbORfXwcXE1SXZsHuvj5U7ZuAGBvGRX bBbBsPP5r2ZoWtgaA/YQv7e8dfOs245Gi/2PQ0DffsdXciCA+rr+l6Zvf9Heu/jD bdu/8EHL80g8o5kYJc/0Y2CSsD1o83eJ0oXPcJPzw9VOxqPZA7yiF3mXapEp/6lm 5GRNAGnuecJdKO6TrtmCvk1nzHyp1n5RAmEvYv7Mp4PbWHJlWTaW4G6FbfcE4NE5 eSnvdb1wek03O0zh3R6N3rPrgpVFo+ZdMrEX1qPWtR4DPKuco//M1KQ+DN61RiQr ISuA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1695855231; x=1695941631; bh=Y+m4WrGxOg/xa fo5+qFcsizudtMniZIH3gm2S7k1r9A=; b=CnXP/K6I/BKXa+QPF2BMcifWi9hFL nvIStFDezjIudovN0ROZ+jorY4iWGxq1qCVhPIWvZhjSO9QYTj6BEaW7IYF8yshd sdCuMg6YtAIw2vfaleQwCdQ+kdq5pzJQnjnatG+HBD7e4fghkGbXXYUEjbU9qzg3 /xuDueCQSHY4nHyQxuzxkQjNB2rgLc9sX4VS9qM2JkXyVuFFW1JWSIPycsS5O0t0 JESGcrUXP+SvFDzbk3TIsc79E6QBiOW1ekDlB4mndz9fFDCBwjXUP5Kik7ehAsHE ihdVFPHQmktkexGTpPZXtfoCs9Pp6qOr0yraAkTYHw6av5sha2h2E5V+w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvjedrtdehgdduhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfg hrlhcuvffnffculdejtddmnecujfgurhepfffhvfevuffkfhggtggujgesghdtreertddt vdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprg hquhhivghrrdighiiiqeenucggtffrrghtthgvrhhnpeetleeifedufffhhfdtteelgeeg geffhfekueevteeigfduudevudetgfegiedvjeenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprghquhhivghrrdighiii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 27 Sep 2023 18:53:49 -0400 (EDT) Date: Thu, 28 Sep 2023 07:53:45 +0900 From: Michael Paquier To: Andres Freund Cc: Peter Eisentraut , Jakub Wartak , PostgreSQL Hackers , Robert Haas Subject: Re: pg_stat_get_activity(): integer overflow due to (int) * (int) for MemoryContextAllocHuge() Message-ID: References: <45ba068b-66ea-b74c-5a92-6c2127d63e28@eisentraut.org> <20230927172925.xmyoardgxoifdpgu@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="WNUdom0xhFYe0o5M" Content-Disposition: inline In-Reply-To: <20230927172925.xmyoardgxoifdpgu@alap3.anarazel.de> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --WNUdom0xhFYe0o5M Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Sep 27, 2023 at 10:29:25AM -0700, Andres Freund wrote: > I don't think going for size_t is a viable path for fixing this. I'm pretty > sure the initial patch would trigger a type mismatch from guc_tables.c - we > don't have infrastructure for size_t GUCs. Nothing marked as PGDLLIMPORT uses size_t in the tree currently, FWIW. > Perhaps we ought to error out (in BackendStatusShmemSize() or such) if > pgstat_track_activity_query_size * MaxBackends >= 4GB? Yeah, agreed that putting a check like that could catch errors more quickly. > Frankly, it seems like a quite bad idea to have such a high limit for > pgstat_track_activity_query_size. The overhead such a high value has will > surprise people... Still it could have some value for some users with large analytical queries where the syslogger is not going to be a bottleneck? It seems too late to me to change that, but perhaps the docs could be improved to tell that using a too high value can have performance consequences, while mentioning the maximum value. -- Michael --WNUdom0xhFYe0o5M Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmUUsnkACgkQnvQgOdby QH1KsRAAmvKP0oUPVtKuhnWO9N3whHn+3DX7SYXV1wCtAGWFi1s+M45FYZ1HfgFS roANu0YcZN+kKRFw92cU+CkhKlvI0k7ZCqeDNeQylr/mISfi52dlbiYPjfo4rNEn OjoWPAefVf6rnzFb3/j680+b7CwYk5OMI4U/VTrHlbVuFNEAf4tJg6TtNeSD99ck CGIrMtkBzUcdVXa5QSde5Gc7/PmPfUVDukDn2NbAAAVP5tRyGv53XfCNJY0QDkRS gVPYeLh9M/7eldD8LcOvTLqceZlbMyiU+40d8KnQUHXrPGkZgH4T+0J0QxgDBf4w 10S492L95RikmDHORgkaeoTsUVLDgGZvEJOr5WNmDPUEoNcBhhOBuII4Zu+DIv5j Azp5BS8ucFmf3UG70vNTDvFqtPHI7tOO3AS6rFTuvzmItFxM14O4etNEBm1VYE9R Wjo2EkKhQ0j6qcoU8LzhrquHfS1xW7E+dEmArhSi9SnfMw3dwlpZrVSZY8QU0KKL ceVX6hgfFeyM5CxQsKJ2KNm+dizfKVflFW7H9BGViZxnvJ/ejWp+ShebhqxOn4fP +fNmzr6n9u+JwFiPHy1XhBctnsp8WimsDDz849rMyS0683duVOPtSxEDE3uQjMCU 5herMYiYuAMrLed+S6OfzqPV6Tl9Fcw5ZX3yT40oZVsGQmxm4L8= =nFWw -----END PGP SIGNATURE----- --WNUdom0xhFYe0o5M--