Skip to content

Improvements for preloading libraries#1530

Merged
robgjansen merged 5 commits intoshadow:mainfrom
robgjansen:rnglib-rpath
Jul 21, 2021
Merged

Improvements for preloading libraries#1530
robgjansen merged 5 commits intoshadow:mainfrom
robgjansen:rnglib-rpath

Conversation

@robgjansen
Copy link
Copy Markdown
Member

Changes:

  • Adds a new use_openssl_rng_preload config option that defaults to true and allows control over our preloading of the openssl rng preload lib.
  • The path to the openssl rng preload lib is found automatically by searching the rpath, as we do for the preload shim lib.
  • For every entry given in the LD_PRELOAD key in the environment option for processes, we now expand the ~ if one appears as the first character in an entry. This allows users to avoid adding an absolute path to the config file.

I tested this locally in an ad-hoc manner and all features work as intended. It's a bit tricky to add tests to our framework because of the home dir absolute paths. (Unit tests would be ideal here, but the changes are mostly in C code.)

Closes #1523

@robgjansen robgjansen self-assigned this Jul 21, 2021
@github-actions github-actions bot added Component: Build Build/install tools and dependencies Component: Documentation In-repository documentation, under docs/ Component: Main Composing the core Shadow executable labels Jul 21, 2021
@robgjansen robgjansen added the Type: Enhancement New functionality or improved design label Jul 21, 2021
@codecov
Copy link
Copy Markdown

codecov bot commented Jul 21, 2021

Codecov Report

Merging #1530 (2e8d80a) into main (fb195ed) will decrease coverage by 0.00%.
The diff coverage is 62.22%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1530      +/-   ##
==========================================
- Coverage   52.61%   52.61%   -0.01%     
==========================================
  Files         141      141              
  Lines       21171    21201      +30     
  Branches     5348     5357       +9     
==========================================
+ Hits        11139    11154      +15     
- Misses       7087     7094       +7     
- Partials     2945     2953       +8     
Flag Coverage Δ
tests 52.61% <62.22%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/main/core/manager.c 70.67% <62.22%> (-0.68%) ⬇️
src/test/futex/test_futex.c 63.97% <0.00%> (-1.62%) ⬇️
src/main/host/network_interface.c 72.46% <0.00%> (-0.29%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fb195ed...2e8d80a. Read the comment docs.

@robgjansen robgjansen requested a review from stevenengler July 21, 2021 20:47
Copy link
Copy Markdown
Contributor

@sporksmith sporksmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe something to consider for a future PR - Now that you've generalized _manager_scanRPathForLib, it looks like it'd be easy to add a more general global and/or per-process list of preload-libraries to dynamically search for and add to LD_PRELOAD.

I guess there's not that much benefit when we only have 1 such optional preload lib, but it'd also be useful for "third party" preload libs meant for use with shadow, analogous to plugins in 1.x.

@robgjansen robgjansen enabled auto-merge July 21, 2021 21:30
@robgjansen robgjansen merged commit 52473a2 into shadow:main Jul 21, 2021
@robgjansen robgjansen deleted the rnglib-rpath branch July 21, 2021 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: Build Build/install tools and dependencies Component: Documentation In-repository documentation, under docs/ Component: Main Composing the core Shadow executable Type: Enhancement New functionality or improved design

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide a more ergonomic way of enabling extra preload libraries

3 participants