Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bcc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
bcc
Commits
45bcfb7c
Commit
45bcfb7c
authored
Apr 13, 2018
by
Howard McLauchlan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More helpful help message
parent
fb3c0a72
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
5 deletions
+34
-5
tools/inject.py
tools/inject.py
+19
-3
tools/inject_example.txt
tools/inject_example.txt
+15
-2
No files found.
tools/inject.py
View file @
45bcfb7c
...
...
@@ -295,6 +295,21 @@ class Probe:
class
Tool
:
examples
=
"""
EXAMPLES:
# ./inject.py kmalloc -v 'SyS_mount()'
Fails all calls to syscall mount
# ./inject.py kmalloc -v '(true) => SyS_mount()(true)'
Explicit rewriting of above
# ./inject.py kmalloc -v 'mount_subtree() => btrfs_mount()'
Fails btrfs mounts only
# ./inject.py kmalloc -v 'd_alloc_parallel(struct dentry *parent, const struct
\
\
qstr *name)(STRCMP(name->name, 'bananas'))'
Fails dentry allocations of files named 'bananas'
# ./inject.py kmalloc -v -P 0.01 'SyS_mount()'
Fails calls to syscall mount with 1% probability
"""
# add cases as necessary
error_injection_mapping
=
{
"kmalloc"
:
"should_failslab(struct kmem_cache *s, gfp_t gfpflags)"
,
...
...
@@ -304,8 +319,9 @@ class Tool:
def
__init__
(
self
):
parser
=
argparse
.
ArgumentParser
(
description
=
"Fail specified kernel"
+
" functionality when call chain and predicates are met"
,
formatter_class
=
argparse
.
RawDescriptionHelpFormatter
)
parser
.
add_argument
(
metavar
=
"mode"
,
dest
=
"mode"
,
formatter_class
=
argparse
.
RawDescriptionHelpFormatter
,
epilog
=
Tool
.
examples
)
parser
.
add_argument
(
dest
=
"mode"
,
choices
=
[
'kmalloc'
,
'bio'
],
help
=
"indicate which base kernel function to fail"
)
parser
.
add_argument
(
metavar
=
"spec"
,
dest
=
"spec"
,
help
=
"specify call chain"
)
...
...
tools/inject_example.txt
View file @
45bcfb7c
...
...
@@ -115,12 +115,12 @@ fail our mounts half the time:
# ./inject.py kmalloc -v -P 0.01 'SyS_mount()'
USAGE message:
usage: inject.py [-h] [-I header] [-P probability] [-v]
mode
spec
usage: inject.py [-h] [-I header] [-P probability] [-v]
{kmalloc,bio}
spec
Fail specified kernel functionality when call chain and predicates are met
positional arguments:
mode
indicate which base kernel function to fail
{kmalloc,bio}
indicate which base kernel function to fail
spec specify call chain
optional arguments:
...
...
@@ -130,3 +130,16 @@ optional arguments:
-P probability, --probability probability
probability that this call chain will fail
-v, --verbose print BPF program
EXAMPLES:
# ./inject.py kmalloc -v 'SyS_mount()'
Fails all calls to syscall mount
# ./inject.py kmalloc -v '(true) => SyS_mount()(true)'
Explicit rewriting of above
# ./inject.py kmalloc -v 'mount_subtree() => btrfs_mount()'
Fails btrfs mounts only
# ./inject.py kmalloc -v 'd_alloc_parallel(struct dentry *parent, const struct \
qstr *name)(STRCMP(name->name, 'bananas'))'
Fails dentry allocations of files named 'bananas'
# ./inject.py kmalloc -v -P 0.01 'SyS_mount()'
Fails calls to syscall mount with 1% probability
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment