Skip to content

Problems encountered when debloating date-8.21. #4

Description

@Isabel0715

Hi authors,

I'm really interested in your tool, but unfortunately I've encountered the following three problems that I hope you can help me with.

Problem 1: After recompiling the binary by myself, instead of using the binary you provided in the benchmarks, the tool doesn't seem to function properly.

# Commands I used:
$ gcc -w -g date-8.21.c.orig.c -o date.orig 
$ python run_razor.py train
$ python run_razor.py debloat

# Error message:
start mergin bbs
starts dumping out
running  mv logs/date-trace.log ./
running  python ../../../stitcher/src/instr_dumper.py ./date-trace.log ./date.orig ./instr.s
expect_module_base:        0x0
entry point:        0x3490
real_module_base:        0x7fa126c24000
Traceback (most recent call last):
  File "../../../stitcher/src/instr_dumper.py", line 29, in <module>
    main()
  File "../../../stitcher/src/instr_dumper.py", line 25, in main
    stitcher.read_trace(trace_log_file_name, orig_bin_file_name)
  File "/root/workspace/razor/stitcher/src/stitcher.py", line 169, in read_trace
    assert (bb_start > 0 and bb_end > 0 and bb_end >= bb_start)
AssertionError
running  python ../../../stitcher/src/find_symbols.py ./date.orig ./instr.s > ./callbacks.txt
Traceback (most recent call last):
  File "../../../stitcher/src/find_symbols.py", line 204, in <module>
    main()
  File "../../../stitcher/src/find_symbols.py", line 199, in main
    find_symbols_for_plt(orig_bin_path, orig_asm_path)
  File "../../../stitcher/src/find_symbols.py", line 91, in find_symbols_for_plt
    with open(asmname, "r") as asm_file:
IOError: [Errno 2] No such file or directory: './instr.s'
running  python ../../../stitcher/src/stitcher.py ./date-trace.log ./date.orig ./date.s ./callbacks.txt
expect_module_base:        0x0
entry point:        0x3490
real_module_base:        0x7fa126c24000
Traceback (most recent call last):
  File "../../../stitcher/src/stitcher.py", line 601, in <module>
    main()
  File "../../../stitcher/src/stitcher.py", line 597, in main
    read_trace(trace_log_file_name, orig_bin_file_name)
  File "../../../stitcher/src/stitcher.py", line 169, in read_trace
    assert (bb_start > 0 and bb_end > 0 and bb_end >= bb_start)
AssertionError
running  python ../../../stitcher/src/merge_bin.py date.orig date.s
the orignal binary is date.orig
the executed asm is date.s
cp: cannot stat 'date.s': No such file or directory
gcc: error: date.s: No such file or directory
gcc: fatal error: no input files
compilation terminated.
compilation fails

Problem 2: When using the provided binary and script to debloat without enabling heuristics or with heuristic 1 & 2, all the deloated binaries are generated successfully, but running all the train inputs results in a "Floating Point Exception" (which is supposed to be the same as the original binary?). Heuristic 3 & 4 seem to work out fine.

Problem 3: I made some modifications to the source files (added some code around the main function) and modified the script accordingly (both shown in the attachment). However, after doing so, we met the following to problems:

  • When using gcc-8.3.0 to compile and then running razor, it fails and says “does not support library yet”.
  • When using clang-7.0.1-8 to compile and then running razor, the debloated binary generated successfully. However, we found the debloated binary (even without heuristics) behaves exactly the same as the original program on plenty of inputs we tried. I tried to use gdb to debug, it seems the debloated program jumps to the original code section in the middle of execution.

It seems that these problems persist across both the latest(razor:0.04) and oldest versions(razor:0.01) of the Docker image.

All the logs and details have been attached. It would be really helpful if you could provide any suggestions on how to resolve these.

attachment.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions