Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: open k json file fail: ~/SyzDescribe/config/knowledge-v6.1.json #5

Closed
Clingto opened this issue Dec 8, 2023 · 4 comments
Closed

Comments

@Clingto
Copy link

Clingto commented Dec 8, 2023

Hi, an interesting job!
When I try to run SyzDescribe, I get some error.
My command is tools/SyzDescribe/SyzDescribe --config_json=config.json
The info in config.json is:

{
  "bitcode": "built-in.bc",
  "knowledge": "~/SyzDescribe/config/knowledge-v6.1.json",
  "version": "v6.1"
}

My linux kernel version download with the command git clone --branch v6.1 xxx
My LLVM version "Ubuntu LLVM version 14.0.0", and clang version is Ubuntu clang version 14.0.0-1ubuntu1.1

The info in debug.log is:

info: Fri Dec  8 01:59:00 2023    
info: Fri Dec  8 01:59:00 2023 : bitcode: built-in.bc   
info: Fri Dec  8 01:59:00 2023 : *************************************************   
info: Fri Dec  8 01:59:00 2023 : ****************ReadIR***************************    
info: Fri Dec  8 01:59:06 2023 : ****************check all function start*********    
info: Fri Dec  8 01:59:07 2023 : ****************check all function end***********    
info: Fri Dec  8 01:59:07 2023 : ****************indirect functions start*********    
info: Fri Dec  8 01:59:07 2023 : ****************indirect functions end***********   
info: Fri Dec  8 01:59:07 2023 : ********find_init_and_exit_function start********   
info: Fri Dec  8 01:59:07 2023 : ********find_init_and_exit_function end**********    
info: Fri Dec  8 01:59:07 2023 : knowledge json file: ~/SyzDescribe/config/knowledge-v6.1.json
error: Fri Dec  8 01:59:07 2023 : open k json file fail: ~/SyzDescribe/config/knowledge-v6.1.json
#0 0x00007f830e911d01 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xe3fd01)
#1 0x000055e716dfdffc yhao_log(long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (.constprop.0) knowledge.cpp:0:0
#2 0x000055e716e05e72 sd::knowledge::read(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (build/tools/SyzDescribe/SyzDescribe+0x6de72)
#3 0x000055e716db4f55 sd::Manager::analysis() (build/tools/SyzDescribe/SyzDescribe+0x1cf55)
#4 0x000055e716da28d5 main (build/tools/SyzDescribe/SyzDescribe+0xa8d5)
#5 0x00007f830d6a7d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#6 0x00007f830d6a7e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#7 0x000055e716da5dd5 _start (build/tools/SyzDescribe/SyzDescribe+0xddd5)

I built the linux kernel v6.1 followed the command https://github.com/ZHYfeng/Generate_Linux_Kernel_Bitcode/blob/master/v6.1/README.md , and the build-in.bc files generated from the kernel source are present in each driver folder. I am not quite clear about the structural relationship between .bc, config.json, and the paths specified in config.json, and is there any difference in running Syzdescribe between linux kernel v6.1 and v6.2. I hope it can provide the absolute path relationships for script execution, or a demo example running with Syzdescribe.
Thanks.

In addition, when I run the command build/tools/DifuzeFix/DifuzeFix --bitcode=built-in.bc followed the https://github.com/ZHYfeng/PortedDIFUZE, I got the empty result.json file with the only "null" in it. Colud you give me some advice?

@ZHYfeng
Copy link
Collaborator

ZHYfeng commented Dec 8, 2023

As mentioned,

  "knowledge": "~/SyzDescribe/config/knowledge.json",
    // the path of the knowledge file

This is the path of the knowledge file.
And all the path are the absolute path.

@Clingto
Copy link
Author

Clingto commented Dec 11, 2023

As mentioned,

  "knowledge": "~/SyzDescribe/config/knowledge.json",
    // the path of the knowledge file

This is the path of the knowledge file. And all the path are the absolute path.

I am sorry, I still can not find where the problem is, my knowledge json file is obtained from the repo and used in the way as mentioned above :

     "knowledge": "~/SyzDescribe/config/knowledge-v6.1.json",

I would like to know, assuming there is a workdir, I have a built-in.bc file in the path ~/SyzDescribe/built-in.bc, and my SyzDescribe tool is in the path ~/SyzDescribe/build/tools/SyzDescribe/SyzDescribe, and my linux kernel version is v6.1, and
my "knowledge" is in the path ~/SyzDescribe/config/knowledge-v6.1.json. How to write the config.json? How to run the SyzDescribe tool?
Thanks .

@ZHYfeng
Copy link
Collaborator

ZHYfeng commented Dec 12, 2023

I find that you use config_json in cmd, which is wrong (and is used in old version).
Please check the README since I also update the README when supporting v6.1.

The cmd should be ~/SyzDescribe/build/tools/SyzDescribe/SyzDescribe --config=config.json.
And the json should be:

{
  "bitcode": "~/SyzDescribe/built-in.bc",
  "knowledge": "~/SyzDescribe/config/knowledge-v6.1.json",
  "version": "v6.1"
}

@Clingto
Copy link
Author

Clingto commented Dec 14, 2023

I find that you use config_json in cmd, which is wrong (and is used in old version). Please check the README since I also update the README when supporting v6.1.

The cmd should be ~/SyzDescribe/build/tools/SyzDescribe/SyzDescribe --config=config.json. And the json should be:

{
  "bitcode": "~/SyzDescribe/built-in.bc",
  "knowledge": "~/SyzDescribe/config/knowledge-v6.1.json",
  "version": "v6.1"
}

Thank you for the reply. In my environment, replacing the ~ with the absolute path works.

{
  "bitcode": "/home/xxx/SyzDescribe/built-in.bc",
  "knowledge": "home/xxx/SyzDescribe/config/knowledge-v6.1.json",
  "version": "v6.1"
}

@Clingto Clingto closed this as completed Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants