diff options
author | Josh Gao <jmgao@google.com> | 2018-06-01 15:30:54 -0700 |
---|---|---|
committer | Josh Gao <jmgao@google.com> | 2018-07-19 14:28:54 -0700 |
commit | f6e5b582604715729b09db3e36a7aeb8c24b36a4 (patch) | |
tree | 1d68c449355f88a0652d3c1e2d6679b54fce1b20 /linker/linker_main.cpp | |
parent | ad596bf4fc406c0940d0f76f6b7c4ff22ecee7ac (diff) |
Introduce api to track fd ownership in libc.
Add two functions to allow objects that own a file descriptor to
enforce that only they can close their file descriptor.
Use them in FILE* and DIR*.
Bug: http://b/110100358
Test: bionic_unit_tests
Test: aosp/master boots without errors
Test: treehugger
Change-Id: Iecd6e8b26c62217271e0822dc3d2d7888b091a45
Diffstat (limited to 'linker/linker_main.cpp')
-rw-r--r-- | linker/linker_main.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/linker/linker_main.cpp b/linker/linker_main.cpp index a8741527e..43f12d378 100644 --- a/linker/linker_main.cpp +++ b/linker/linker_main.cpp @@ -585,6 +585,12 @@ __linker_init_post_relocation(KernelArgumentBlock& args, // couldn't make system calls on x86 at that point, but we can now... if (!linker_so.protect_relro()) __linker_cannot_link(args.argv[0]); + // Initialize the linker/libc.so shared global inside the linker. + static libc_shared_globals shared_globals; + __libc_shared_globals = &shared_globals; + __libc_init_shared_globals(&shared_globals); + args.shared_globals = __libc_shared_globals; + // Initialize the linker's static libc's globals __libc_init_globals(args); |