From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 7NErB1CZXGF/IwAAWB0awg (envelope-from ) for ; Tue, 05 Oct 2021 14:28:32 -0400 Received: by simark.ca (Postfix, from userid 112) id 0CF161EE1B; Tue, 5 Oct 2021 14:28:32 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.lttng.org (lists.lttng.org [167.114.26.123]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id B22961EDDB for ; Tue, 5 Oct 2021 14:28:30 -0400 (EDT) Received: from lists-lttng01.efficios.com (localhost [IPv6:::1]) by lists.lttng.org (Postfix) with ESMTP id 4HP5gf03Xlz1K7l; Tue, 5 Oct 2021 14:28:29 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lists.lttng.org; s=default; t=1633458510; bh=vHjAR8n91p9I1Udiac8lleNtzkq8yCmyl5Ajm5/UXOQ=; h=Date:To:Cc:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=u5Rgcar31n7j3pkDQJz7RzQJuTNoJti+LtEfcZh55/fRER74+67vuR5eeLLUQraSz 2Bax0qTTKFIuJQ70g/yrsf0Kni30VhTDNUTVPdxw5Hn8ykSsMTgZl9xuLfs1KaE56K 7JQgr47R65Y3MjrzrAfdM3yvfNdA5lQyZ/6Hf/IF3rw8EyF1R9lkrHEz2yHz3ulY13 HdBVbxQUDazOUbBjwoKYMJOg3ZgfiC7FbFXebed7KtHo3DKTYDKskg+EP2I4g6TsH7 1oYqyqs60grxb9AMnyQe2ZX9FoYi34a8qs6uxuJWyjVFpw4Mx+LThJQ4EhP3Dm0RX1 DCH2sonGWxQFg== Received: from mail.efficios.com (mail.efficios.com [167.114.26.124]) by lists.lttng.org (Postfix) with ESMTPS id 4HP5gd0Vy4z1K7k for ; Tue, 5 Oct 2021 14:28:28 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 5A44138F165 for ; Tue, 5 Oct 2021 14:28:22 -0400 (EDT) Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id jDmqDM00jj3K; Tue, 5 Oct 2021 14:28:21 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 36FB638F1C6; Tue, 5 Oct 2021 14:28:21 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 36FB638F1C6 X-Virus-Scanned: amavisd-new at efficios.com Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Hk8z81SEo_3A; Tue, 5 Oct 2021 14:28:21 -0400 (EDT) Received: from mail03.efficios.com (mail03.efficios.com [167.114.26.124]) by mail.efficios.com (Postfix) with ESMTP id 2B02C38F1C5; Tue, 5 Oct 2021 14:28:21 -0400 (EDT) Date: Tue, 5 Oct 2021 14:28:21 -0400 (EDT) To: Norbert Lange Cc: lttng-dev Message-ID: <294104910.2889.1633458501063.JavaMail.zimbra@efficios.com> In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [167.114.26.124] X-Mailer: Zimbra 8.8.15_GA_4156 (ZimbraWebClient - FF92 (Linux)/8.8.15_GA_4156) Thread-Topic: Feature request: dynamically load from prefix Thread-Index: 8Gs5m12Gm2mDfecIz6X95xKf9GRHaA== Subject: Re: [lttng-dev] Feature request: dynamically load from prefix X-BeenThere: lttng-dev@lists.lttng.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: LTTng development list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Mathieu Desnoyers via lttng-dev Reply-To: Mathieu Desnoyers Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: lttng-dev-bounces@lists.lttng.org Sender: "lttng-dev" ----- On Jul 15, 2021, at 7:21 AM, lttng-dev lttng-dev@lists.lttng.org wrote: > Hello, > > The production rootfs should be untouched, ideally read-only, > for development/tests a subdirectory can be mounted (eg. /usr/local). > Idea is that the contents of that directory alone (and at most some > env variables) > should allow enabling development features. > > For lttng I would have wanted to add a library > '/usr/local/lib/libmyservice-tracepoints.so' with runpath > '/usr/local/lib' that would activate lttng tracing, > pulling in lttng libraries (ust, ust-tracepoint) from /usr/local/lib. > > There is a caveat though, unless 'libmyservice-tracepoints.so'' is > preloaded, the code in lttng/tracepoint.h will run constructor functions > to register the tracepoint probes, trying to dlopen the lttng-ust-tracepoint > library and fail at that because this is not in the library search paths. > > At a later time, 'libmyservice-tracepoints.so'' will be loaded, and > lttng-ust-tracepoint (along with lttng-ust) can be resolved. but the > tracepoints are not registered. > > So I guess what I would need is to either retrigger the registration > of tracepoints > (likely complicated with static and weak symbols potentially causing a mess), or > redirect the dlopen function. > Useful would be either try to find the library in /usr/local/lib or > use '/usr/local/lib/libmyservice-tracepoints.so'' > instead of lttng-ust-tracepoint (both have (dis)advantages). > > At any rate, I would welcome some customization macro. I'm currently working on improvements to the reporting of such scenario. See: https://review.lttng.org/c/lttng-ust/+/6480 tracepoints: print debug message when lttng-ust-tracepoint.so is not found https://review.lttng.org/c/lttng-ust/+/6484 tracepoints: increase dlopen failure message level from debug to critical With this in place, it should be easier for a lttng end-user to figure out that liblttng-ust-tracepoint.so cannot be found by dlopen() because it is not in the system's library search path. >From that point, what is wrong with requesting the user to add the path towards liblttng-ust-tracepoint.so to the environment variable LD_LIBRARY_PATH when running the application ? Thanks, Mathieu > > For illustration the current hack-around is following > > Norbert Lange > > #define TRACEPOINT_DEFINE > #define TRACEPOINT_PROBE_DYNAMIC_LINKAGE > > #include > > static inline void *s_remap_dlopen(const char *localfilename, int > flags, unsigned prelen) { > void *md = (dlopen)(localfilename + prelen, flags); > return md ? md : (dlopen)(localfilename, flags); > } > > # ideally this would be LTTNG_TRACEPOINT_PROBE_DLOPEN instead of the dlopen mess > #define dlopen(x, y) s_remap_dlopen("/usr/local/lib/" x, y, > (unsigned)sizeof("/usr/local/lib/") - 1U) > > #include "trace_mytracepoints.h" > _______________________________________________ > lttng-dev mailing list > lttng-dev@lists.lttng.org > https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev