Skip to content

Commit

Permalink
inject: Add support for alloc_page family of functions (iovisor#2114)
Browse files Browse the repository at this point in the history
* inject: Add support for alloc_page family of functions

* Add vim backup files to gitignore
  • Loading branch information
gobenji authored and yonghong-song committed Jan 7, 2019
1 parent aed9b1e commit 6d92549
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*.swo
*.pyc
.idea
*~

# Build artifacts
/build/
Expand Down
4 changes: 3 additions & 1 deletion tools/inject.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class Probe:
errno_mapping = {
"kmalloc": "-ENOMEM",
"bio": "-EIO",
"alloc_page" : "true",
}

@classmethod
Expand Down Expand Up @@ -327,14 +328,15 @@ class Tool:
error_injection_mapping = {
"kmalloc": "should_failslab(struct kmem_cache *s, gfp_t gfpflags)",
"bio": "should_fail_bio(struct bio *bio)",
"alloc_page": "should_fail_alloc_page(gfp_t gfp_mask, unsigned int order)",
}

def __init__(self):
parser = argparse.ArgumentParser(description="Fail specified kernel" +
" functionality when call chain and predicates are met",
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog=Tool.examples)
parser.add_argument(dest="mode", choices=['kmalloc','bio'],
parser.add_argument(dest="mode", choices=["kmalloc", "bio", "alloc_page"],
help="indicate which base kernel function to fail")
parser.add_argument(metavar="spec", dest="spec",
help="specify call chain")
Expand Down

0 comments on commit 6d92549

Please sign in to comment.