From nobody Thu Dec 07 00:28:00 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Slw8w2cvlz53FgV; Thu, 7 Dec 2023 00:28:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Slw8w24RBz4MDd; Thu, 7 Dec 2023 00:28:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701908880; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1AMPLY95OHHkFZtOw7njGFJXxgV0Rl511tQt9vcaQn4=; b=RqprenHftpZTkY66D4yzt7/NZ9tUYATJtUAELJirmraZj/25vaUAdA2FLFljUo56QZjtzV y1L83cpSTzK3Oa0E5GJqsEIiSMHt3irX6iDBkWiYOwz8tglWIrIgnwPoad4DW+W7BG4yA9 pK32ZTPYZWY0SJVc60fs7mH2WYdv4XGm97CHhvflyLkeJgkFJ2BaKkAQrGBLim0rJnN1QU C16LpX0zkoNKGf5rZVKY8Gxxl2h6YjvbH9LF6CI0vynO9IkdhqU+3LuEa0uOlIaAOS1ca6 tQ3IvpLc0wlwvW6rtPl5oO1yLGLAaz8obrtiW8aYoDr3stays1+h+qVxFWpuhw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1701908880; a=rsa-sha256; cv=none; b=cYCBP+qAUyIiLqkuK7O5LmEOpiaQLmGuZOVm6t4/+ZvC/LGK0GAstlx0QuX8PQ1Mnh5/KV S3EMY20V/w5JYeUT8itRxUpqgT6cwOl6gwQtCLlf3WwzHqBw+mmuihuhaxsniBQNrQxv4J O4KJVEVWM0mNmy4PgcHXHqpo9taHEEerGEjcDGdYe3uHn3rAIDKd1zDsKn1hkBbh06Z+2v VAhhJJOTKf/QdsfIADrU9ixdAT7rM8MDLdr517vUfxiOIqwA0/dToPfzm7Lmh5laBrTIgD aos+Y3yS7BQ/6F6jXSTSWqASju4lnA7CjEDR9u1baVTgSTQkA5MAiGOC9fIXRA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701908880; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1AMPLY95OHHkFZtOw7njGFJXxgV0Rl511tQt9vcaQn4=; b=p9eOlLOPOsj+V3HJqz6Z4AOyq/Kt/2cGhuWnxAwvUKsYsCmAMyopeGZrimQScXLiWGlugA xYEMM88TtD+Sl05D/4gXx0fOGJIYsFv/V53ktpnqDY/dhBaLEP3hqEz8roVKiabUwuFK6X ToXcX2wMdFmNDVFpnyxXr9knakI62g9LiscaCZJoFMSwJeK/Sd2SgBAkvUWbh5ve12KpRo B8ZOIeY/ke+qnrnwz7Ju36KoXX691c2awnPPzODYQ9VM1nufIqzstvFEGvlXO6m5axySnF 6bBgIsegclGDodJXzPI0Yvn60Y9OzofuAzbn32/rLGfb+oTTI8hT7t6dEXbf2Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Slw8w17LszlL; Thu, 7 Dec 2023 00:28:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3B70S0B7023515; Thu, 7 Dec 2023 00:28:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3B70S0Ut023512; Thu, 7 Dec 2023 00:28:00 GMT (envelope-from git) Date: Thu, 7 Dec 2023 00:28:00 GMT Message-Id: <202312070028.3B70S0Ut023512@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 07fa8d431c0e - stable/13 - RTLD_DEEPBIND: make lookup not just symbolic, but walk all refobj' DAGs List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 07fa8d431c0ea291a0e4b79a0bb81707d0b119e6 Auto-Submitted: auto-generated The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=07fa8d431c0ea291a0e4b79a0bb81707d0b119e6 commit 07fa8d431c0ea291a0e4b79a0bb81707d0b119e6 Author: Konstantin Belousov AuthorDate: 2023-11-29 18:30:59 +0000 Commit: Konstantin Belousov CommitDate: 2023-12-07 00:27:34 +0000 RTLD_DEEPBIND: make lookup not just symbolic, but walk all refobj' DAGs PR: 275393 (cherry picked from commit 9daf6cd0f46416d9c6eb0411ea6042cd42b8a9bc) --- libexec/rtld-elf/rtld.c | 8 ++++++-- libexec/rtld-elf/rtld.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index ac492b1071f0..218e984bdd88 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -3789,7 +3789,7 @@ dlopen_object(const char *name, int fd, Obj_Entry *refobj, int lo_flags, if (!obj->init_done) { /* We loaded something new and have to init something. */ if ((lo_flags & RTLD_LO_DEEPBIND) != 0) - obj->symbolic = true; + obj->deepbind = true; result = 0; if ((lo_flags & (RTLD_LO_EARLY | RTLD_LO_IGNSTLS)) == 0 && obj->static_tls && !allocate_tls_offset(obj)) { @@ -4615,7 +4615,8 @@ symlook_default(SymLook *req, const Obj_Entry *refobj) if (refobj->symbolic || req->defobj_out != NULL) donelist_check(&donelist, refobj); - symlook_global(req, &donelist); + if (!refobj->deepbind) + symlook_global(req, &donelist); /* Search all dlopened DAGs containing the referencing object. */ STAILQ_FOREACH(elm, &refobj->dldags, link) { @@ -4631,6 +4632,9 @@ symlook_default(SymLook *req, const Obj_Entry *refobj) } } + if (refobj->deepbind) + symlook_global(req, &donelist); + /* * Search the dynamic linker itself, and possibly resolve the * symbol from there. This is how the application links to diff --git a/libexec/rtld-elf/rtld.h b/libexec/rtld-elf/rtld.h index e2fb3de470c3..3111e54a2e08 100644 --- a/libexec/rtld-elf/rtld.h +++ b/libexec/rtld-elf/rtld.h @@ -245,6 +245,7 @@ typedef struct Struct_Obj_Entry { bool ver_checked : 1; /* True if processed by rtld_verify_object_versions */ bool textrel : 1; /* True if there are relocations to text seg */ bool symbolic : 1; /* True if generated with "-Bsymbolic" */ + bool deepbind : 1; /* True if loaded with RTLD_DEEPBIND" */ bool bind_now : 1; /* True if all relocations should be made first */ bool traced : 1; /* Already printed in ldd trace output */ bool jmpslots_done : 1; /* Already have relocated the jump slots */