From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from forward100p.mail.yandex.net (forward100p.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:100]) by sourceware.org (Postfix) with ESMTPS id F112A3851C22 for ; Fri, 20 Nov 2020 08:15:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org F112A3851C22 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=yandex.ru Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=hi-angel@yandex.ru Received: from mxback25g.mail.yandex.net (mxback25g.mail.yandex.net [IPv6:2a02:6b8:c03:7b3:0:640:8f7a:2657]) by forward100p.mail.yandex.net (Yandex) with ESMTP id 212855981C5A; Fri, 20 Nov 2020 11:15:54 +0300 (MSK) Received: from myt5-95c1fb78270f.qloud-c.yandex.net (myt5-95c1fb78270f.qloud-c.yandex.net [2a02:6b8:c12:1725:0:640:95c1:fb78]) by mxback25g.mail.yandex.net (mxback/Yandex) with ESMTP id tBl0KWOUtV-FrgusMnc; Fri, 20 Nov 2020 11:15:54 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1605860154; bh=OAjEtVmEguk3Ydw945qJVdNOyQe6sp1Hd6BSzZVnyww=; h=In-Reply-To:To:From:Subject:References:Date:Message-ID; b=vqsItZ9O/g7Kb6crT10zGL0MhYjDN/xOmScw8c3FlQ6HNV+6OgRjkZpaSyshhH4u8 kznsd4YfmNBfw2CVIz3EjkDSwDlYg92EesrfJ33YlgoXR7JMVRvlvV2NIX1qWYMOum QYuu8fUVeTPyr4MpiwjVpUifIqhdLg7Aq3UnE1Tw= Authentication-Results: mxback25g.mail.yandex.net; dkim=pass header.i=@yandex.ru Received: by myt5-95c1fb78270f.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id 8qFoinkWvW-FrI4E45O; Fri, 20 Nov 2020 11:15:53 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) Message-ID: Subject: Re: AW: dlopen: Segfault due to overwriting .so file after it was loaded and loading it again From: Konstantin Kharlamov To: "Wendeborn, Jonathan" , "libc-help@sourceware.org" Date: Fri, 20 Nov 2020 11:15:53 +0300 In-Reply-To: <4db8dab4da4143c082b8f1c7f67e1124@bruexc101.brumgt.local> References: <11e3703d900d48149d0f81ae7682480f@bruexc101.brumgt.local> <4db8dab4da4143c082b8f1c7f67e1124@bruexc101.brumgt.local> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_LOW, 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 08:15:58 -0000 On Fri, 2020-11-20 at 08:01 +0000, Wendeborn, Jonathan wrote: > Hi, > > Thank you for your quick answer! > I don't have Boost installed globally, so I had to adjust the command: > g++9 -g3 -O0 -Wall -Wextra -Wsign-conversion -std=c++17 -fsanitize=address  -o > test2 test.cpp  -I/home/Jonathan.Wendeborn/.boost/1.70/include/  - > L/home/Jonathan.Wendeborn/.boost/1.70/bin/boost/linux-x86_64-gcc9-debug  -Wl,- > Bstatic -lboost_filesystem -lboost_system  -Wl,-Bdynamic -ldl > > This is the output: > ./test2 > pre load > loaded > pre load > loaded > AddressSanitizer:DEADLYSIGNAL > ================================================================= > ==2872455==ERROR: AddressSanitizer: SEGV on unknown address 0x000000657726 (pc > 0x000000657726 bp 0x000000000000 sp 0x7ffc91e7d0a8 T0) > ==2872455==The signal is caused by a READ memory access. > AddressSanitizer:DEADLYSIGNAL > AddressSanitizer: nested bug in the same thread, aborting. > > I didn't test my program with a different .so before, so I copied > libboost_regex.so to libSomething.so and get a Segfault, too: > AddressSanitizer:DEADLYSIGNAL > ================================================================= > ==2872492==ERROR: AddressSanitizer: SEGV on unknown address 0x000000019bd0 (pc > 0x000000019bd0 bp 0x7ffe22f7b9f0 sp 0x7ffe22f7b938 T0) > ==2872492==The signal is caused by a READ memory access. Hmm, doesn't crash with libboost_regex.so for me either… Okay, could you please provide an `strace` of the testcase when it crashes? Hopefully it could shine some light into what's going on.