From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from albireo.enyo.de (albireo.enyo.de [37.24.231.21]) by sourceware.org (Postfix) with ESMTPS id BD527388A40F for ; Fri, 20 Nov 2020 12:48:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org BD527388A40F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=deneb.enyo.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=fw@deneb.enyo.de Received: from [172.17.203.2] (helo=deneb.enyo.de) by albireo.enyo.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) id 1kg5qN-00037q-66; Fri, 20 Nov 2020 12:48:51 +0000 Received: from fw by deneb.enyo.de with local (Exim 4.92) (envelope-from ) id 1kg5qN-0005YD-3E; Fri, 20 Nov 2020 13:48:51 +0100 From: Florian Weimer To: "Wendeborn\, Jonathan" Cc: "Wendeborn\, Jonathan via Libc-help" , Konstantin Kharlamov Subject: Re: AW: dlopen: Segfault due to overwriting .so file after it was loaded and loading it again References: <11e3703d900d48149d0f81ae7682480f@bruexc101.brumgt.local> <87lfewl0ue.fsf@mid.deneb.enyo.de> Date: Fri, 20 Nov 2020 13:48:51 +0100 In-Reply-To: (Jonathan Wendeborn's message of "Fri, 20 Nov 2020 12:45:19 +0000") Message-ID: <874klkkxcc.fsf@mid.deneb.enyo.de> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-help@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-help mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Nov 2020 12:48:54 -0000 * Jonathan Wendeborn: > Thank you, that sounds reasonable. Indeed the library is marked > NODELETE due to unique symbols. Is it forbidden in general to write > executables which are loaded? You need to follow a specific sequence: write the new version to a temporary file, and after it has been written completely, rename that version over the previous version. This way, the old file is not truncated, and mapped versions of it continue to work. It won't address the dependency on a unique symbol, though, that's unrelated. It's not possible for now to unload such objects.