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 1mbDEl-0002Vy-PL for pgsql-hackers@arkaria.postgresql.org; Fri, 15 Oct 2021 02:46:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mbDEi-0005EG-Oi for pgsql-hackers@arkaria.postgresql.org; Fri, 15 Oct 2021 02:46:20 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mbDEi-0005E7-GI for pgsql-hackers@lists.postgresql.org; Fri, 15 Oct 2021 02:46:20 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mbDEc-0001Pm-2o for pgsql-hackers@postgresql.org; Fri, 15 Oct 2021 02:46:19 +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 19F2k72U920452; Thu, 14 Oct 2021 22:46:07 -0400 From: Tom Lane To: Thomas Munro cc: Andres Freund , John Naylor , pgsql-hackers Subject: Re: [RFC] building postgres with meson In-reply-to: References: <20211012083721.hvixq4pnh2pixr3j@alap3.anarazel.de> <20211012205945.tkr6nam4ej2swram@alap3.anarazel.de> <20211013163721.oqwvztktwsym3iu4@alap3.anarazel.de> <20211013174246.zgp2sxdqsulhepea@alap3.anarazel.de> <906095.1634248849@sss.pgh.pa.us> <908066.1634251206@sss.pgh.pa.us> <909289.1634252667@sss.pgh.pa.us> Comments: In-reply-to Thomas Munro message dated "Fri, 15 Oct 2021 13:36:28 +1300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <920450.1634265967.1@sss.pgh.pa.us> Date: Thu, 14 Oct 2021 22:46:07 -0400 Message-ID: <920451.1634265967@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Thomas Munro writes: > On Fri, Oct 15, 2021 at 12:04 PM Tom Lane wrote: >> This may indicate that they've applied this policy on a blanket >> basis to everything in /bin and /usr/bin (and other system >> directories, maybe), rather than singling out the shell. > Looks like it. If I've found the right code here, it looks like where > any common-or-garden Unix runtime linker would ignore LD_LIBRARY_PATH > for a setuid binary, they've trained theirs to whack DYLD_*, and also > for code-signed and __RESTRICT-marked executables. > https://github.com/opensource-apple/dyld/blob/master/src/dyld.cpp#L1681 Ugh. That explains it, all right. > I suppose you could point SHELL at an unsigned copy of sh (codesign > --remove-signature, or something from brew/ports/x) so that GNU make > should respect, but I don't know how many other exec("/bin/sh") calls > might be hiding around the place (I guess perl calls system()?) and > might require some kind of LD_PRELOAD hackery... not much fun. Yeah. I thought about invoking everything via a small wrapper that restores the correct setting of DYLD_LIBRARY_PATH. We could perhaps make that work for the invocations of test postmasters and psqls from "make" and TAP scripts, but hacking up our code's sundry uses of system(3) like that seems like it'd be very messy, if feasible at all. BTW, the POSIX spec explicitly discourages letting SHELL affect the behavior of system(3), so I bet that wouldn't help. regards, tom lane