mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-28 12:34:26 +01:00
runtc: rename to run-toochain
Names up to two full words are saner and not too long
This commit is contained in:
28
README.adoc
28
README.adoc
@@ -877,7 +877,7 @@ so it is close to the failing `0xbf0000cc`.
|
|||||||
`readelf`:
|
`readelf`:
|
||||||
|
|
||||||
....
|
....
|
||||||
./runtc readelf -- -s "$(./getvar build_dir)/kernel_modules-1.0/hello.ko"
|
./run-toolchain readelf -- -s "$(./getvar build_dir)/kernel_modules-1.0/hello.ko"
|
||||||
....
|
....
|
||||||
|
|
||||||
does not give any interesting hits at `cc`, no symbol was placed that far.
|
does not give any interesting hits at `cc`, no symbol was placed that far.
|
||||||
@@ -950,7 +950,7 @@ The base address shows on terminal:
|
|||||||
Now let's find the offset of `myinit`:
|
Now let's find the offset of `myinit`:
|
||||||
|
|
||||||
....
|
....
|
||||||
./runtc readelf -- \
|
./run-toolchain readelf -- \
|
||||||
-s "$(./getvar build_dir)/kernel_modules-1.0/fops.ko" | \
|
-s "$(./getvar build_dir)/kernel_modules-1.0/fops.ko" | \
|
||||||
grep myinit
|
grep myinit
|
||||||
....
|
....
|
||||||
@@ -1273,7 +1273,7 @@ Cannot access memory at address 0x10604
|
|||||||
We have also double checked the address with:
|
We have also double checked the address with:
|
||||||
|
|
||||||
....
|
....
|
||||||
./runtc --arch arm readelf -- \
|
./run-toolchain --arch arm readelf -- \
|
||||||
-s "$(./getvar --arch arm build_dir)/kernel_modules-1.0/fops.ko" | \
|
-s "$(./getvar --arch arm build_dir)/kernel_modules-1.0/fops.ko" | \
|
||||||
grep main
|
grep main
|
||||||
....
|
....
|
||||||
@@ -1878,7 +1878,7 @@ TODO Can you run arm executables in the aarch64 guest? https://stackoverflow.com
|
|||||||
I've tried:
|
I've tried:
|
||||||
|
|
||||||
....
|
....
|
||||||
./runtc --arch aarch64 gcc -- -static ~/test/hello_world.c -o data/9p/a.out
|
./run-toolchain --arch aarch64 gcc -- -static ~/test/hello_world.c -o data/9p/a.out
|
||||||
./run --arch aarch64 --eval-busybox '/mnt/9p/a.out'
|
./run --arch aarch64 --eval-busybox '/mnt/9p/a.out'
|
||||||
....
|
....
|
||||||
|
|
||||||
@@ -3679,7 +3679,7 @@ vermagic: 4.17.0 SMP mod_unload modversions
|
|||||||
Module information is stored in a special `.modinfo` section of the ELF file:
|
Module information is stored in a special `.modinfo` section of the ELF file:
|
||||||
|
|
||||||
....
|
....
|
||||||
./runtc readelf -- -SW "$(./getvar target_dir)/module_info.ko"
|
./run-toolchain readelf -- -SW "$(./getvar target_dir)/module_info.ko"
|
||||||
....
|
....
|
||||||
|
|
||||||
contains:
|
contains:
|
||||||
@@ -3691,7 +3691,7 @@ contains:
|
|||||||
and:
|
and:
|
||||||
|
|
||||||
....
|
....
|
||||||
./runtc readelf -- -x .modinfo "$(./getvar build_dir)/module_info.ko"
|
./run-toolchain readelf -- -x .modinfo "$(./getvar build_dir)/module_info.ko"
|
||||||
....
|
....
|
||||||
|
|
||||||
gives:
|
gives:
|
||||||
@@ -3908,7 +3908,7 @@ as explained at: https://stackoverflow.com/questions/8545931/using-gdb-to-conver
|
|||||||
The exact same thing can be done post mortem with:
|
The exact same thing can be done post mortem with:
|
||||||
|
|
||||||
....
|
....
|
||||||
./runtc gdb -- \
|
./run-toolchain gdb -- \
|
||||||
-batch \
|
-batch \
|
||||||
-ex 'info line *(myinit+0x1d)' \
|
-ex 'info line *(myinit+0x1d)' \
|
||||||
"$(./getvar build_dir)/kernel_modules-1.0/panic.ko" \
|
"$(./getvar build_dir)/kernel_modules-1.0/panic.ko" \
|
||||||
@@ -5238,7 +5238,7 @@ Meaning of the flags:
|
|||||||
* `vaddr`: first virtual address of a page the belongs to the process. Notably:
|
* `vaddr`: first virtual address of a page the belongs to the process. Notably:
|
||||||
+
|
+
|
||||||
....
|
....
|
||||||
./runtc readelf -- -l "$(./getvar build_dir)/kernel_modules-1.0/user/virt_to_phys_test.out"
|
./run-toolchain readelf -- -l "$(./getvar build_dir)/kernel_modules-1.0/user/virt_to_phys_test.out"
|
||||||
....
|
....
|
||||||
+
|
+
|
||||||
contains:
|
contains:
|
||||||
@@ -5610,7 +5610,7 @@ Notes:
|
|||||||
It can be found from:
|
It can be found from:
|
||||||
+
|
+
|
||||||
....
|
....
|
||||||
./runtc readelf -- -e "$(./getvar vmlinux)" | grep Entry
|
./run-toolchain readelf -- -e "$(./getvar vmlinux)" | grep Entry
|
||||||
....
|
....
|
||||||
+
|
+
|
||||||
TODO confirm further. If I try to break there with:
|
TODO confirm further. If I try to break there with:
|
||||||
@@ -7169,7 +7169,7 @@ The reason this is cool, is that `ls` is not statically compiled, but since we h
|
|||||||
In other words, much cooler than:
|
In other words, much cooler than:
|
||||||
|
|
||||||
....
|
....
|
||||||
./runtc --arch arm gcc -- -static ./packages/kernel_modules/user/hello.c
|
./run-toolchain --arch arm gcc -- -static ./packages/kernel_modules/user/hello.c
|
||||||
qemu-arm a.out
|
qemu-arm a.out
|
||||||
....
|
....
|
||||||
|
|
||||||
@@ -7220,9 +7220,9 @@ First we try some `-static` sanity checks.
|
|||||||
Works and prints `hello`:
|
Works and prints `hello`:
|
||||||
|
|
||||||
....
|
....
|
||||||
./runtc --arch x86_64 gcc -- -static -o x86_64.out ./packages/kernel_modules/user/hello.c
|
./run-toolchain --arch x86_64 gcc -- -static -o x86_64.out ./packages/kernel_modules/user/hello.c
|
||||||
./runtc --arch arm gcc -- -static -o arm.out ./packages/kernel_modules/user/hello.c
|
./run-toolchain --arch arm gcc -- -static -o arm.out ./packages/kernel_modules/user/hello.c
|
||||||
./runtc --arch aarch64 gcc -- -static -o aarch64.out ./packages/kernel_modules/user/hello.c
|
./run-toolchain --arch aarch64 gcc -- -static -o aarch64.out ./packages/kernel_modules/user/hello.c
|
||||||
"$(./getvar --arch x86_64 --gem5 exec)" "$(./getvar gem5_se_file)" -c ./x86_64.out
|
"$(./getvar --arch x86_64 --gem5 exec)" "$(./getvar gem5_se_file)" -c ./x86_64.out
|
||||||
"$(./getvar --arch arm --gem5 exec)" "$(./getvar gem5_se_file)" -c ./arm.out
|
"$(./getvar --arch arm --gem5 exec)" "$(./getvar gem5_se_file)" -c ./arm.out
|
||||||
"$(./getvar --arch aarch64 --gem5 exec)" "$(./getvar gem5_se_file)" -c ./aarch64.out
|
"$(./getvar --arch aarch64 --gem5 exec)" "$(./getvar gem5_se_file)" -c ./aarch64.out
|
||||||
@@ -7262,7 +7262,7 @@ gem5 user mode:
|
|||||||
....
|
....
|
||||||
make \
|
make \
|
||||||
-C "$(./getvar --arch arm build_dir)/dhrystone-2" \
|
-C "$(./getvar --arch arm build_dir)/dhrystone-2" \
|
||||||
CC="$(./runtc --arch arm --dry gcc)" \
|
CC="$(./run-toolchain --arch arm --dry gcc)" \
|
||||||
CFLAGS=-static \
|
CFLAGS=-static \
|
||||||
;
|
;
|
||||||
time \
|
time \
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ if args.dry:
|
|||||||
else:
|
else:
|
||||||
sys.exit(common.run_cmd(
|
sys.exit(common.run_cmd(
|
||||||
[common.get_toolchain_tool(args.tool)] + args.extra_args,
|
[common.get_toolchain_tool(args.tool)] + args.extra_args,
|
||||||
cmd_file=os.path.join(common.run_dir, 'runtc.sh'),
|
cmd_file=os.path.join(common.run_dir, 'run-toolchain.sh'),
|
||||||
cwd=common.linux_variant_dir,
|
cwd=common.linux_variant_dir,
|
||||||
show_cmd=False,
|
show_cmd=False,
|
||||||
))
|
))
|
||||||
Reference in New Issue
Block a user