Skip to content

Conversation

@brenns10
Copy link
Member

The pstack module could get drgn stuck in an infinite loop (see osandov/drgn#574). Add a fix for this, as well as one low-priority fix related to unwinding running tasks.

We generate a single address range for each DSO in the userspace
program. However, the method is a bit convoluted: we select the largest
"vm_end" value, and we use a start address computed from the start of
the executable VMA and its vm_pgoff. The result of this is that, if a
DSO file is mapped multiple times in different locations, we may produce
an address range that spans other DSO address ranges. This is exactly
what happened in osandov/drgn#574.

Simplify this by just using the start address of the lowest VMA (the one
which has vm_pgoff==0), and computing the end address by taking the file
size, or the start of the next DSO address range, whichever is lower.
This ensures there are no address range overlaps. It does not provide
drgn with any additional information about the file address mappings,
but as far as I can tell, that's just fine: drgn can't use multiple
address ranges, because it doesn't know which file offsets they
correspond to.

To ensure this behavior is used by both the "dump" and "pstack" modes,
implement factor out the DSO range generation code into a helper and use
it in both places.

Signed-off-by: Stephen Brennan <stephen.s.brennan@oracle.com>
Signed-off-by: Stephen Brennan <stephen.s.brennan@oracle.com>
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Nov 26, 2025
@brenns10 brenns10 merged commit f67aa34 into oracle-samples:main Nov 26, 2025
7 checks passed
@brenns10 brenns10 deleted the pstack_fixes branch November 26, 2025 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants