Update zloop.sh to use coredumpctl #9613
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation and Context
We'd like to be able to run
zloop.sh
and debug any generated corefiles without requiring escalated privileges. The only thing preventing
this is the test scripts need to set the system wide
core_pattern
.This change resolves that issue by instead using the
coredumpctl
command to extract the dump and write it to the specific name
core
.Once the core has been written, and same
gdb
script is used todump the most useful information.
One upshot of this is it makes it possible to start running
zloop.sh
on the non-x86 CI builders which are not virtual and intentionally
do not allow passwordless sudo.
Description
On modern Linux systems there is no need to set a specific
/proc/sys/kernel/core_pattern
, thecoredumpctl dump
commandcan be used to extract the core using the specific name.
By removing the need to set the core_pattern zloop.sh can now
be run with normal user priviledges. Previous work has already
been done to allow ztest to run without any of the kmods being
loaded.
Additionally, cleanup a few remaining shellcheck warnings in
the zloop.sh script. Allow options to be passed as environment
variables. Print a message when running for a fixed duration.
Note:
coredumpctl
is not portable outside of Linux, but neitheris the rest of the script so at some point it will need to be updated
to do the right thing for each supported platform.
How Has This Been Tested?
Locally using Fedora 31 as a normal user with no additional
privileges. I verified
coredumpctl
is available in distributionsas old as CentOS 7 so it should work there as well, but that
has not yet been manually test yet.
To test start
./scripts/zloop.sh
in a terminal and let it get going.In a different terminal
kill
theztest
process and verify thatcoredumpctl
extracts the dump and thegdb
script extractsthe required information from the code.
Types of changes
Checklist:
Signed-off-by
.