Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ntGlM-0002F6-Ae for pgsql-hackers@arkaria.postgresql.org; Mon, 23 May 2022 22:42:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ntGlK-0004pv-2r for pgsql-hackers@arkaria.postgresql.org; Mon, 23 May 2022 22:42:54 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ntGlJ-0004pl-PS for pgsql-hackers@lists.postgresql.org; Mon, 23 May 2022 22:42:53 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ntGlG-0001aA-JU for pgsql-hackers@postgresql.org; Mon, 23 May 2022 22:42:52 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 24NMgmUf1354562; Mon, 23 May 2022 18:42:48 -0400 From: Tom Lane To: Robert Haas cc: Nathan Bossart , "pgsql-hackers@postgresql.org" Subject: Re: allow building trusted languages without the untrusted versions In-reply-to: References: <20220520225619.GA876272@nathanxps13> <571753.1653092411@sss.pgh.pa.us> <20220523165403.GC938919@nathanxps13> <1290329.1653326228@sss.pgh.pa.us> <1333860.1653338790@sss.pgh.pa.us> Comments: In-reply-to Robert Haas message dated "Mon, 23 May 2022 17:51:53 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1354560.1653345768.1@sss.pgh.pa.us> Date: Mon, 23 May 2022 18:42:48 -0400 Message-ID: <1354561.1653345768@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Robert Haas writes: > It's not just a question of whether it was meant to be SQL-callable -- > it's also a question of what arguments it was expecting to be called > with. At the very least, you can cause the server to core dump if you > pass something that isn't a valid pointer to a function that is > expecting a pointer, which is something a CSP very likely does not > want a customer to be able to do. I think, however, that there's every > possibility that you can create more havoc than that. You can > basically call a function that's expecting a pointer with a pointer to > anything you can find or guess the memory address of. Maybe that's not > enough control to cause anything worse than a server crash, but I sure > wouldn't bet on it. There's a lot of functions floating around, and if > none of them can be tricked into doing filesystem access today, well > someone might add a new one tomorrow. [ shrug... ] So is your point that we shouldn't bother to do anything? I don't personally have a problem with leaving things where they stand in this area. However, if we're going to do something, I think at minimum it should involve blocking off everything we can identify as straightforward reproducible methods to get disk access. regards, tom lane