Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ewwby-00088B-1J for pgsql-admin@arkaria.postgresql.org; Fri, 16 Mar 2018 21:10:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ewwbw-0000Hw-IR for pgsql-admin@arkaria.postgresql.org; Fri, 16 Mar 2018 21:10:00 +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 1ewwbw-0000Hm-At for pgsql-admin@lists.postgresql.org; Fri, 16 Mar 2018 21:10:00 +0000 Received: from util-st-02.imsweb.com ([204.132.58.65]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ewwbr-00043I-Kg for pgsql-admin@lists.postgresql.org; Fri, 16 Mar 2018 21:09:59 +0000 Received: from NAIAD.omni.imsweb.com (haproxy-st-02 [204.132.58.76]) by util-st-02.imsweb.com (Postfix) with ESMTP id C029EE1712; Fri, 16 Mar 2018 17:09:52 -0400 (EDT) Received: from THALASSA.omni.imsweb.com (172.22.64.102) by NAIAD.omni.imsweb.com (172.22.64.103) with Microsoft SMTP Server (TLS) id 15.0.1365.1; Fri, 16 Mar 2018 17:09:51 -0400 Received: from THALASSA.omni.imsweb.com ([172.22.64.102]) by THALASSA.omni.imsweb.com ([172.22.64.102]) with mapi id 15.00.1365.000; Fri, 16 Mar 2018 17:09:52 -0400 From: "Heinemann, Manfred (IMS)" To: Fabio Pardi , "pgsql-admin@lists.postgresql.org" Subject: RE: Function search_path Thread-Topic: Function search_path Thread-Index: AdO7x5WpnFdOXZ+3TX2aPXuhH1G0VQAmi7sAAEIC53A= Date: Fri, 16 Mar 2018 21:09:52 +0000 Message-ID: References: <5f698c34-d01d-3196-1db4-75ba8f6a37d3@portavita.eu> In-Reply-To: <5f698c34-d01d-3196-1db4-75ba8f6a37d3@portavita.eu> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [204.132.58.76] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I have played around with the postgres memory settings and setting search_p= ath on a function causes a lot more memory to be used than if no search_pat= h was set. Has anyone hit issues with system users not being able to autoanalyze or au= tovacuum tables that have functional indices because of the search_path cha= nge? Thanks, Manfred >-----Original Message----- >From: Fabio Pardi [mailto:f.pardi@portavita.eu] >Sent: Thursday, March 15, 2018 5:30 AM >To: Heinemann, Manfred (IMS) ; pgsql-admin@lists.po= stgresql.org >Subject: Re: Function search_path > >Hi Manfred, > > >While at the moment I m not aware of other options (I m right now studying= CVE-2018-1058 and the impact on the installations I maintain), I would foc= us on the 'out of memory' error. > >If Postgres is correctly configured, no action you perform on the database= should result in 'out of memory' errors. > >Is it maybe the case to review your memory settings to avoid such conditio= ns? > > >Regards, > >Fabio > > >On 03/14/2018 08:18 PM, Heinemann, Manfred (IMS) wrote: >> We recently started upgrading to Postgres 10.3 and have run into trouble= with the security change to search_path. >> >> >> >> The release notes say: >> >> In cases where user-provided functions are indirectly executed by these = programs - for example, user-provided functions in index expressions - the = tighter |search_path| may result in errors, which will need to be corrected= by adjusting those user-provided functions to not assume anything about wh= at search path they are invoked under. That has always been good practice, = but now it will be necessary for correct behavior. (CVE-2018-1058) >> >> >> >> We have this issue with a custom function that calls other custom functi= ons and that function is used in a functional index. Now autoanalyze and au= tovacuum fail on tables with those indices. >> >> >> >> The simplest fix seemed to be to set the functions search_path to '$user= ' but that has caused large updates to the indexed table to run out of memo= ry. >> >> >> >> Hardcoding the schema in the function would mean having to have separate= functions for each schema affected. It also seems to make the function les= s memory efficient. >> >> >> >> Are there other options? >> >> >> >> Thanks, >> >> Manfred >> >> >> ------------------------------------------------------------------------= ---------------------------------------------------------------------------= ---------------------------------------------------------------------------= ---------------------------------------------------------------------------= ---------------------------------------------------------------------------= ---------------------------------------------------------------------------= ---------------------------------------------------------------------------= ---------------------------------------------------------------------------= ---------------------------------------------------------------------------= ---------------------------------------------------------------------------= ---------------------------------------------------------------------------= ---------------------------------------------------------------------------= ---------------------------------------------------------------------------= ------------------ >> >> Information in this e-mail may be confidential. It is intended only for = the addressee(s) identified above. If you are not the addressee(s), or an e= mployee or agent of the addressee(s), please note that any dissemination, d= istribution, or copying of this communication is strictly prohibited. If yo= u have received this e-mail in error, please notify the sender of the error= . ________________________________ Information in this e-mail may be confidential. It is intended only for the= addressee(s) identified above. If you are not the addressee(s), or an empl= oyee or agent of the addressee(s), please note that any dissemination, dist= ribution, or copying of this communication is strictly prohibited. If you h= ave received this e-mail in error, please notify the sender of the error.