[S] Change in dart/sdk[main]: [vm/ffi]: Pass RTLD_DEEPBIND on Linux when loading code assets

0 views
Skip to first unread message

Simon Binder (Gerrit)

unread,
Oct 25, 2025, 3:03:32 PM (10 days ago) Oct 25
to Daco Harkes, rev...@dartlang.org, vm-...@dartlang.org
Attention needed from Daco Harkes

New activity on the change

Open in Gerrit

Related details

Attention is currently required from:
  • Daco Harkes
Submit Requirements:
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedCommit-Message-Has-TEST
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: Iacc47e43071084bc22a532f3a9118e609f63cf3b
Gerrit-Change-Number: 457620
Gerrit-PatchSet: 1
Gerrit-Owner: Simon Binder <o...@simonbinder.eu>
Gerrit-Reviewer: Daco Harkes <dacoh...@google.com>
Gerrit-Attention: Daco Harkes <dacoh...@google.com>
Gerrit-Comment-Date: Sat, 25 Oct 2025 19:03:26 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
unsatisfied_requirement
open
diffy

Daco Harkes (Gerrit)

unread,
Oct 26, 2025, 7:20:04 AM (9 days ago) Oct 26
to Simon Binder, rev...@dartlang.org, vm-...@dartlang.org
Attention needed from Simon Binder

Daco Harkes added 4 comments

Patchset-level comments
File-level comment, Patchset 1 (Latest):
Daco Harkes . resolved

Hm, our sanitizer tests start failing immediately.

Commit Message
Line 23, Patchset 1 (Latest):
Daco Harkes . unresolved

TEST=test/ffi/*

File runtime/bin/native_assets_api_impl.cc
Line 56, Patchset 1 (Latest): char** error = nullptr,
Daco Harkes . unresolved

nit: I believe output parameters should come last, even if there are optional parameters. (You can consider doing overloading and add a `LoadDynamicLibrary` which doesn't take any optional params.)

File runtime/lib/ffi_dynamic_library.cc
Line 321, Patchset 1 (Latest): first = false;
Daco Harkes . unresolved

nit: unrelated change?

Open in Gerrit

Related details

Attention is currently required from:
  • Simon Binder
Submit Requirements:
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedCommit-Message-Has-TEST
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: Iacc47e43071084bc22a532f3a9118e609f63cf3b
Gerrit-Change-Number: 457620
Gerrit-PatchSet: 1
Gerrit-Owner: Simon Binder <o...@simonbinder.eu>
Gerrit-Reviewer: Daco Harkes <dacoh...@google.com>
Gerrit-Attention: Simon Binder <o...@simonbinder.eu>
Gerrit-Comment-Date: Sun, 26 Oct 2025 11:20:00 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
unsatisfied_requirement
open
diffy

Simon Binder (Gerrit)

unread,
Oct 26, 2025, 7:33:56 AM (9 days ago) Oct 26
to Daco Harkes, rev...@dartlang.org, vm-...@dartlang.org
Attention needed from Daco Harkes

Simon Binder added 4 comments

Patchset-level comments
File-level comment, Patchset 1:
Daco Harkes . unresolved

Hm, our sanitizer tests start failing immediately.

Simon Binder

From the logs:


> stderr : ==20892==You are trying to dlopen a
/b/s/w/ir/out/ReleaseMSANX64/libffi_test_functions.so shared library
with RTLD_DEEPBIND flag which is incompatible with sanitizer runtime
(see https://github.com/google/sanitizers/issues/611
for details). If you want to run
/b/s/w/ir/out/ReleaseMSANX64/libffi_test_functions.so library under
sanitizers please remove RTLD_DEEPBIND from dlopen flags.


So do we need to make this optional after all? :D


Or do you know if there's say a preprocessor define we could use in the VM to not use this flag when compiling with sanitizers?

Commit Message
Line 23, Patchset 1:
Daco Harkes . resolved

TEST=test/ffi/*

Simon Binder

Done

File runtime/bin/native_assets_api_impl.cc
Line 56, Patchset 1: char** error = nullptr,
Daco Harkes . resolved

nit: I believe output parameters should come last, even if there are optional parameters. (You can consider doing overloading and add a `LoadDynamicLibrary` which doesn't take any optional params.)

Simon Binder

Done

File runtime/lib/ffi_dynamic_library.cc
Line 321, Patchset 1: first = false;
Daco Harkes . resolved

nit: unrelated change?

Simon Binder

Reverted

Open in Gerrit

Related details

Attention is currently required from:
  • Daco Harkes
Submit Requirements:
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement satisfiedCommit-Message-Has-TEST
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: sdk
    Gerrit-Branch: main
    Gerrit-Change-Id: Iacc47e43071084bc22a532f3a9118e609f63cf3b
    Gerrit-Change-Number: 457620
    Gerrit-PatchSet: 3
    Gerrit-Owner: Simon Binder <o...@simonbinder.eu>
    Gerrit-Reviewer: Daco Harkes <dacoh...@google.com>
    Gerrit-Attention: Daco Harkes <dacoh...@google.com>
    Gerrit-Comment-Date: Sun, 26 Oct 2025 11:33:51 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Daco Harkes <dacoh...@google.com>
    unsatisfied_requirement
    satisfied_requirement
    open
    diffy

    Daco Harkes (Gerrit)

    unread,
    Oct 26, 2025, 7:43:41 AM (9 days ago) Oct 26
    to Simon Binder, rev...@dartlang.org, vm-...@dartlang.org
    Attention needed from Simon Binder

    Daco Harkes added 1 comment

    Patchset-level comments
    Daco Harkes . unresolved

    Hm, our sanitizer tests start failing immediately.

    Simon Binder

    From the logs:


    > stderr : ==20892==You are trying to dlopen a
    /b/s/w/ir/out/ReleaseMSANX64/libffi_test_functions.so shared library
    with RTLD_DEEPBIND flag which is incompatible with sanitizer runtime
    (see https://github.com/google/sanitizers/issues/611
    for details). If you want to run
    /b/s/w/ir/out/ReleaseMSANX64/libffi_test_functions.so library under
    sanitizers please remove RTLD_DEEPBIND from dlopen flags.


    So do we need to make this optional after all? :D


    Or do you know if there's say a preprocessor define we could use in the VM to not use this flag when compiling with sanitizers?

    Daco Harkes

    Yes, we have defines `USING_ADDRESS_SANITIZER` and friends.

    But, it feels off to change the resolution logic based on sanitizers.

    If we would make it configurable in the build hook protocol, then we'd be able to error in the build hook if we build asan/tsan/msan mode. It then puts the responsibility on the hook author to chose whether a package does not support ASAN.

    Though, I still find it weird, because as a hook author, you don't know how many Linux embedders there are going to be (let's say someone comes up with something based on Dart that is not Flutter), and those embedders might change the libraries they import. So how would you program in a way that avoids conflicting with potential libraries.

    As the hook author, you'd only want to use the deepbind for Flutter, and not for Dart standalone. So, you'd need to know which embedder you are running on. Which is kind of the opposite of the design goal of the hooks.

    Let me loop in some other folks and discuss with them to see what their opinions are.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Simon Binder
    Submit Requirements:
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement satisfiedCommit-Message-Has-TEST
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: sdk
    Gerrit-Branch: main
    Gerrit-Change-Id: Iacc47e43071084bc22a532f3a9118e609f63cf3b
    Gerrit-Change-Number: 457620
    Gerrit-PatchSet: 3
    Gerrit-Owner: Simon Binder <o...@simonbinder.eu>
    Gerrit-Reviewer: Daco Harkes <dacoh...@google.com>
    Gerrit-Attention: Simon Binder <o...@simonbinder.eu>
    Gerrit-Comment-Date: Sun, 26 Oct 2025 11:43:38 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Simon Binder <o...@simonbinder.eu>
    Comment-In-Reply-To: Daco Harkes <dacoh...@google.com>
    unsatisfied_requirement
    satisfied_requirement
    open
    diffy

    Daco Harkes (Gerrit)

    unread,
    Oct 31, 2025, 10:01:08 AM (4 days ago) Oct 31
    to Simon Binder, rev...@dartlang.org, vm-...@dartlang.org

    Daco Harkes abandoned this change

    Related details

    Attention set is empty
    Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement satisfiedCommit-Message-Has-TEST
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: abandon
    unsatisfied_requirement
    satisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages