Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

core.internal.backtrace.dwarf: Fix segfault regression in case executable cannot be opened #3382

Merged
merged 1 commit into from
Feb 23, 2021

Conversation

kinke
Copy link
Contributor

@kinke kinke commented Feb 23, 2021

Introduced by #3322. image.baseAddress() must not be called if !image.isValid(), otherwise a segfault occurs if the executable file/image could not be opened (e.g., because of the process changing the initial working dir and https://issues.dlang.org/show_bug.cgi?id=21656).

…able cannot be opened

Introduced by dlang#3322. `image.baseAddress()` must not be called if
`!image.isValid()`, otherwise a segfault occurs if the executable
file/image could not be opened (e.g., because of the process
changing the initial working dir and
https://issues.dlang.org/show_bug.cgi?id=21656).
@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @kinke! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + druntime#3382"

kinke added a commit to kinke/ldc that referenced this pull request Feb 23, 2021
…cannot be opened

This sadly crept in with the backtrace cherry-pick for v1.25 and
requires a hotfix. See dlang/druntime#3382.
Copy link
Member

@PetarKirov PetarKirov left a comment

Choose a reason for hiding this comment

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

Thanks for the fix, LGTM.


Some extra detail for other reviewers:

Given that the baseAddress parameter of processCallstack is only used when debugLineSectionData parameter is not null, it may seem like passing 0 for it here is of no consequence. However Image.baseAddress is actually a member function property which triggers the bug that this PR fixes. I must have overlooked this detail here: https://github.com/dlang/druntime/pull/3322/files#diff-7c0ebe7e385f5fadd65ebb53ce4ceaad90d419af813405a5efb828fb99deea79R181-R184

@PetarKirov PetarKirov added auto-merge Bug Fix Include reference to corresponding bugzilla issue labels Feb 23, 2021
@dlang-bot dlang-bot merged commit 84db3c6 into dlang:master Feb 23, 2021
@kinke kinke deleted the fix_bt_regression branch February 23, 2021 11:09
kinke added a commit to ldc-developers/ldc that referenced this pull request Feb 23, 2021
…cannot be opened (#3677)

This sadly crept in with the backtrace cherry-pick for v1.25 and
requires a hotfix. See dlang/druntime#3382.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Fix Include reference to corresponding bugzilla issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants