Skip to content

Commit

Permalink
Move example to khook_demo directory and update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
milabs committed Oct 5, 2023
1 parent bf33307 commit 72e74f4
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ Use `khook_lookup_name(sym)` to resolve `sym` address.

# Examples

See the `khook_demo` folder for examples. Use `make` to build it.

## Hooking of generic kernel functions

An example of hooking a kernel function with known prototype (function is defined in `linux/fs.h`):
Expand Down Expand Up @@ -99,6 +101,7 @@ static long khook___x64_sys_kill(const struct pt_regs *regs) {
- x86 only
- 2.6.33+ kernels
- use of in-kernel length disassembler
- ready-to-use submodule with no external deps

# How it works?

Expand Down
2 changes: 1 addition & 1 deletion Kbuild → khook_demo/Kbuild
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MODNAME ?= khook-demo

include $(src)/Makefile.khook
include $(src)/../Makefile.khook

obj-m += $(MODNAME).o
$(MODNAME)-y += main.o $(KHOOK_GOALS)
Expand Down
2 changes: 1 addition & 1 deletion Makefile → khook_demo/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
KDIR ?= /lib/modules/$(shell uname -r)/build

all:
$(MAKE) -C $(KDIR) M=$$PWD
$(MAKE) -C $(KDIR) M=$$PWD modules
clean:
$(MAKE) -C $(KDIR) M=$$PWD clean
File renamed without changes.

0 comments on commit 72e74f4

Please sign in to comment.