Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update zloop.sh to use coredumpctl #9613

Closed
wants to merge 1 commit into from

Conversation

behlendorf
Copy link
Contributor

Motivation and Context

We'd like to be able to run zloop.sh and debug any generated core
files 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 to
dump 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, the coredumpctl dump command
can 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 neither
is 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 distributions
as 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 the ztest process and verify that
coredumpctl extracts the dump and the gdb script extracts
the required information from the code.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (a change to man pages or other documentation)

Checklist:

@behlendorf behlendorf added the Status: Code Review Needed Ready for review and testing label Nov 22, 2019
@behlendorf behlendorf mentioned this pull request Nov 22, 2019
12 tasks
@behlendorf behlendorf added Status: Work in Progress Not yet ready for general review and removed Status: Code Review Needed Ready for review and testing labels Nov 27, 2019
On modern Linux systems there is no need to set a specific
`/proc/sys/kernel/core_pattern`, the `coredumpctl dump` command
can 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.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
TEST_ZTEST_TIMEOUT=3600
@codecov
Copy link

codecov bot commented Dec 10, 2019

Codecov Report

Merging #9613 into master will increase coverage by <1%.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff            @@
##           master    #9613    +/-   ##
========================================
+ Coverage      79%      79%   +<1%     
========================================
  Files         418      418            
  Lines      123577   123572     -5     
========================================
+ Hits        97951    98007    +56     
+ Misses      25626    25565    -61
Flag Coverage Δ
#kernel 80% <ø> (ø) ⬆️
#user 67% <ø> (ø) ⬇️

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 3c502d3...278fd0e. Read the comment docs.

@behlendorf
Copy link
Contributor Author

Closing for now.

@behlendorf behlendorf closed this Jan 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Work in Progress Not yet ready for general review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant