-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tools/syz-declextract: parse Linux Headers to extract metadata about …
…syscalls Clang tool that uses AST matchers to extract relevant metadata about Linux system calls. The tool is to be extended later to support more interfaces, collect more relevant metadata and to automatically generate syzkaller descriptions
- Loading branch information
1 parent
a4e01e1
commit 3d5fb49
Showing
4 changed files
with
111 additions
and
259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
BasedOnStyle: LLVM | ||
ColumnLimit: 120 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# syz-declextract | ||
## Linux Kernel (For testing purposes) | ||
``` | ||
export KERNEL=$PWD/linux-stable | ||
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git $KERNEL | ||
cd $KERNEL | ||
make CC=clang defconfig # Having clang as the compiler is optional but removes erros later on | ||
./scripts/config -e FTRACE_SYSCALLS | ||
make CC=clang olddefconfig | ||
make CC=clang -j`nproc` # kernel has to be built at least once for the script to work | ||
./scripts/clang/gen_compile_commands.py | ||
``` | ||
## LLVM Project | ||
``` | ||
LLVM=$PWD/llvm-project | ||
git clone https://github.com/llvm/llvm-project.git $LLVM | ||
cd $LLVM | ||
git checkout 0f231567719c99caa99164d8f91bad50883dab03 # In case of any breaking changes, this commit works | ||
echo 'add_clang_executable(syz-declextract syz-declextract/syz-declextract.cpp) | ||
target_link_libraries(syz-declextract PRIVATE clangTooling)' >> $LLVM/clang/CMakeLists.txt | ||
``` | ||
## syz-declextract | ||
``` | ||
mkdir $LLVM/clang/syz-declextract | ||
``` | ||
Download `syz-declextract.cpp` file and add it to `$LLVM/clang/syz-declextract` directory | ||
``` | ||
SYZ=$PWD/syz | ||
mkdir $SYZ && cd $SYZ | ||
cmake -DLLVM_ENABLE_PROJECTS="clang" -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ | ||
-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ $LLVM/llvm | ||
make -j`nproc` syz-declextract | ||
``` | ||
## Example | ||
``` | ||
./bin/syz-declextract $KERNEL/fs/read_write.c | less # or any other .c file | ||
``` |
Oops, something went wrong.