From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by sourceware.org (Postfix) with ESMTPS id 518483853800; Wed, 18 Aug 2021 00:12:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 518483853800 Received: by mail-pj1-x1029.google.com with SMTP id hv22-20020a17090ae416b0290178c579e424so1164618pjb.3; Tue, 17 Aug 2021 17:12:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=x5GwTvfp3m/iscg7Hd3csAlTjktXU5BjaZiHR/QTscs=; b=ao5zmlvbJE+m3PxaUmd5MJDTg5DLxsHDUEaA6ulzI8arrHX5By9+VFMQ6DkLVbRnxQ VqbUYnFcysIve8xX+OvfCe+A33Pylh15cUVnB9C4JVdnEsLSAUUaOvdtR++wdBQQOO2V NgoskOuwMREH/GH7NH7bOIjWKvgHZmWG/4UoB9WmBfae/LJmk+ECyVrL5nL/3Pkn64+l 3HqPHjO46vHHL2eTRvKlan6SOiR7h8GnREKKP7YDsbxucXBe/K2TWDbXpBe8mu3Fqeks M7rCVqjcofOXxBxviTXlwmp3AePFsnFuD2D1sCXiMdxXWgBRsniniXvJWwFYUozjFKBe swwA== X-Gm-Message-State: AOAM532h0UaQ71Z9rmTW5/Uo9Dj2O7ZbPpYL/x09wPsX9k3kOsCwc8wo /KeC4bssUrB+ZciS+Hl8eiztgRM56F4= X-Google-Smtp-Source: ABdhPJz4ZbDjzKnxV0hob39hHsuIXDFXqOnRyrGGgUZT+YQoFAsh/tBIIzpO3qvnvhoduVu54oCEkw== X-Received: by 2002:a17:902:7c15:b029:12c:78ec:bb61 with SMTP id x21-20020a1709027c15b029012c78ecbb61mr4933337pll.61.1629245570503; Tue, 17 Aug 2021 17:12:50 -0700 (PDT) Received: from gnu-cfl-2.localdomain ([172.58.38.240]) by smtp.gmail.com with ESMTPSA id pj14sm2788123pjb.35.2021.08.17.17.12.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Aug 2021 17:12:49 -0700 (PDT) Received: from gnu-cfl-2.. (localhost [IPv6:::1]) by gnu-cfl-2.localdomain (Postfix) with ESMTP id 7A451C0062; Tue, 17 Aug 2021 17:12:48 -0700 (PDT) From: "H.J. Lu" To: libc-alpha@sourceware.org Cc: gdb@sourceware.org, Daniel Walker Subject: [PATCH v3 0/2] Extend struct r_debug to support multiple namespaces Date: Tue, 17 Aug 2021 17:12:46 -0700 Message-Id: <20210818001248.638207-1-hjl.tools@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3027.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Aug 2021 00:13:01 -0000 Changes in the v3 patch: 1. Remove the empty namespace from the namespace linked list. 2. Properly add the new namespace to the linked list. Changes in the v2 patch: 1. Bump r_version to 2. 2. Don't add DT_DEBUGSZ. 3. Add struct r_debug_extended to extend struct r_debug. 4. Don't update the r_state field in the copy of _r_debug in executable since it is not consumed by the program. --- Glibc does not provide an interface for debugger to access libraries loaded in multiple namespaces via dlmopen. The current rtld-debugger interface is described in the file: elf/rtld-debugger-interface.txt under the "Standard debugger interface" heading. This interface only provides access to the first link-map (LM_ID_BASE). Based on the patch from Conan C Huang : https://sourceware.org/pipermail/libc-alpha/2020-June/115448.html 1. Bump r_version to 2. This triggers the GDB bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28236 2. Add struct r_debug_extended to extend struct r_debug into a linked-list, where each element correlates to an unique namespace. 3. Add a hidden symbol, _r_debug_extended, for struct r_debug_extended. 4. Provide the compatibility symbol, _r_debug, with size of struct r_debug, as an alise of _r_debug_extended, for programs which reference _r_debug. H.J. Lu (2): Add declare_object_symbol_alias for assembly codes [BZ #28128] Extend struct r_debug to support multiple namespaces NEWS | 9 ++++- csu/Makefile | 3 ++ csu/rtld-sizes.sym | 4 ++ elf/Makefile | 22 ++++++++++- elf/dl-close.c | 21 +++++++++- elf/dl-debug-symbols-gen.c | 24 ++++++++++++ elf/dl-debug-symbols.S | 31 +++++++++++++++ elf/dl-debug.c | 38 ++++++++++-------- elf/dl-load.c | 2 +- elf/dl-open.c | 2 +- elf/dl-reloc-static-pie.c | 4 +- elf/link.h | 69 +++++++++++++++++++++++++-------- elf/rtld-debugger-interface.txt | 14 +++++++ elf/rtld.c | 6 +-- elf/tst-dlmopen4.c | 68 ++++++++++++++++++++++++++++++++ include/libc-symbols.h | 12 +++--- include/link.h | 4 ++ sysdeps/generic/ldsodefs.h | 5 ++- 18 files changed, 285 insertions(+), 53 deletions(-) create mode 100644 csu/rtld-sizes.sym create mode 100644 elf/dl-debug-symbols-gen.c create mode 100644 elf/dl-debug-symbols.S create mode 100644 elf/tst-dlmopen4.c -- 2.31.1