FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

src: find .text section using dl_iterate_phdr by gabrielschulhof · Pull Request #32244 · nodejs/node · GitHub

/ node Public

src: find .text section using dl_iterate_phdr - #32244

Closed
gabrielschulhof wants to merge 6 commits into
nodejs:masterfrom
gabrielschulhof:large-pages-use-dl_iterate_phdr
Closed

src: find .text section using dl_iterate_phdr#32244
gabrielschulhof wants to merge 6 commits into
nodejs:masterfrom
gabrielschulhof:large-pages-use-dl_iterate_phdr

Conversation

Copy link
Copy Markdown
Contributor

Use dl_iterate_phdr(3) to find the mapping containing
__node_text_start instead of parsing /proc/self/maps.

Signed-off-by: @gabrielschulhof

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

nodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label Mar 13, 2020

Copy link
Copy Markdown
Collaborator

gabrielschulhof force-pushed the large-pages-use-dl_iterate_phdr branch from efd3932 to b53d3cd Compare March 13, 2020 07:01

Copy link
Copy Markdown
Collaborator

bnoordhuis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM % some minor (mostly style) issues.

Comment thread src/large_pages/node_large_page.cc Outdated
Comment thread src/large_pages/node_large_page.cc Outdated
Comment thread src/large_pages/node_large_page.cc Outdated
Comment thread src/large_pages/node_large_page.cc Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Just checking, is end inclusive or exclusive?

Aside: it looks like there's no real need for the dl_params->reference_sym field. This also works, wouldn't it?

auto reference_sym = reinterpret_cast<uintptr_t>(&__node_text_start);
if (reference_sym >= start && reference_sym <= end) {
  // ...
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@bnoordhuis the reference_sym field is being used both inside the dl_iterate_phdr callback and outside of it. I thought it best not to assign reinterpret_cast<uintptr_t>(&__node_text_start); to two different variables because, if the symbol changes in the future, they might get out of sync.

Comment thread src/large_pages/node_large_page.cc Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

For legibility, it'd be better to hoist the lambda out of the function call:

auto callback = [](dl_phdr_info* info, size_t, void* data) -> int {
  // ...
};

if (1 == dl_iterate_phdr(callback, &dl_params)) {
  // ...
}

Comment thread src/large_pages/node_large_page.cc Outdated
Comment thread src/large_pages/node_large_page.cc Outdated
Comment on lines 157 to 171

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@bnoordhuis I added some more sanity checks to ensure that we create a region that has proper offsets and > 0 page count.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

... or rather, that we consider the region to have been found only if it has proper offsets and >0 page count.

Copy link
Copy Markdown
Contributor Author

@bnoordhuis I addressed your review comments and added some sanity checks wrt. your comment regarding inclusive/exclusive comparison.

Copy link
Copy Markdown
Collaborator

Copy link
Copy Markdown
Collaborator

Copy link
Copy Markdown
Collaborator

Gabriel Schulhof and others added 6 commits March 13, 2020 14:46
Use `dl_iterate_phdr(3)` to find the mapping containing
`__node_text_start` instead of parsing `/proc/self/maps`.

Signed-off-by: Gabriel Schulhof <gabriel.schulhof@intel.com>
Co-Authored-By: Ben Noordhuis <info@bnoordhuis.nl>
Co-Authored-By: Ben Noordhuis <info@bnoordhuis.nl>
gabrielschulhof force-pushed the large-pages-use-dl_iterate_phdr branch from af31134 to 2d6be5e Compare March 13, 2020 21:46

Copy link
Copy Markdown
Contributor Author

Rebased in the hope that if fixes the "node ASAN" test.

Copy link
Copy Markdown
Collaborator

Copy link
Copy Markdown
Collaborator

Copy link
Copy Markdown
Contributor Author

@nodejs/collaborators sorry about the spam! Can this land without the "node ASAN" test? AFAICT it's failing for a lot of PRs.

Copy link
Copy Markdown
Contributor Author

Copy link
Copy Markdown
Member

sorry about the spam! Can this land without the "node ASAN" test? AFAICT it's failing for a lot of PRs.

Yes. 👍

addaleax added the author ready PRs that have at least one approval, no outstanding review comments, and a CI started. label Mar 15, 2020

Copy link
Copy Markdown
Member

@nodejs/collaborators sorry about the spam! Can this land without the "node ASAN" test? AFAICT it's failing for a lot of PRs.

We dealt with Node ASAN fail in #32116. Not sure we should cherrypick the commit to master, since the PR is pretty ready to launch.

Also +1 for this PR to launch.

gabrielschulhof pushed a commit that referenced this pull request Mar 16, 2020
Use `dl_iterate_phdr(3)` to find the mapping containing
`__node_text_start` instead of parsing `/proc/self/maps`.

Signed-off-by: Gabriel Schulhof <gabriel.schulhof@intel.com>
Co-Authored-By: Ben Noordhuis <info@bnoordhuis.nl>
PR-URL: #32244
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: David Carlier <devnexen@gmail.com>

Copy link
Copy Markdown
Contributor Author

Landed in 25cb855.

gabrielschulhof deleted the large-pages-use-dl_iterate_phdr branch March 16, 2020 05:43
BridgeAR pushed a commit that referenced this pull request Mar 17, 2020
Use `dl_iterate_phdr(3)` to find the mapping containing
`__node_text_start` instead of parsing `/proc/self/maps`.

Signed-off-by: Gabriel Schulhof <gabriel.schulhof@intel.com>
Co-Authored-By: Ben Noordhuis <info@bnoordhuis.nl>
PR-URL: #32244
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: David Carlier <devnexen@gmail.com>
MylesBorins mentioned this pull request Mar 19, 2020
MylesBorins pushed a commit that referenced this pull request Mar 24, 2020
Use `dl_iterate_phdr(3)` to find the mapping containing
`__node_text_start` instead of parsing `/proc/self/maps`.

Signed-off-by: Gabriel Schulhof <gabriel.schulhof@intel.com>
Co-Authored-By: Ben Noordhuis <info@bnoordhuis.nl>
PR-URL: #32244
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: David Carlier <devnexen@gmail.com>

targos commented Apr 22, 2020

Copy link
Copy Markdown
Member

Depends on the large pages change to land on v12.x

targos removed author ready PRs that have at least one approval, no outstanding review comments, and a CI started. backport-blocked-v12.x labels Apr 25, 2020
targos pushed a commit to targos/node that referenced this pull request Apr 25, 2020
Use `dl_iterate_phdr(3)` to find the mapping containing
`__node_text_start` instead of parsing `/proc/self/maps`.

Signed-off-by: Gabriel Schulhof <gabriel.schulhof@intel.com>
Co-Authored-By: Ben Noordhuis <info@bnoordhuis.nl>
PR-URL: nodejs#32244
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: David Carlier <devnexen@gmail.com>
targos pushed a commit that referenced this pull request Apr 28, 2020
Use `dl_iterate_phdr(3)` to find the mapping containing
`__node_text_start` instead of parsing `/proc/self/maps`.

Signed-off-by: Gabriel Schulhof <gabriel.schulhof@intel.com>
Co-Authored-By: Ben Noordhuis <info@bnoordhuis.nl>
PR-URL: #32244
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: David Carlier <devnexen@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants


Back | FazBrowse Home | New Git URL