Git Product home page Git Product logo

Comments (4)

TheShiftedBit avatar TheShiftedBit commented on April 28, 2024

Interesting, we'll have to compare the performance versus the current added instrumentation.
Do you know if this technique would break the line numbers that are printed in exceptions and such?

from atheris.

risicle avatar risicle commented on April 28, 2024

Do you know if this technique would break the line numbers that are printed in exceptions and such?

It most certainly does https://github.com/risicle/cpytraceafl#doesnt-abusing-lnotab-break-pythons-debugging-mechanisms

from atheris.

TheShiftedBit avatar TheShiftedBit commented on April 28, 2024

I've done some performance benchmarking. For the lnotab strategy, I modified Atheris as follows:

  • I replaced Atheris' patch_code function with this solution's rewrite function
  • In native code, I called PyEval_SetTrace to install a tracer with no effect (except to enable line tracing).

For Atheris's strategy, I used the benchmarks as written, except that I disabled dataflow tracing. Since the lnotab strategy doesn't have dataflow tracing, this makes the comparison fair.

# lnotab rewrite:
low_cyclomatic	runs=40000	time=0.20s	execs/sec=200006.87
high_cyclomatic	runs=2000	time=0.62s	execs/sec=3234.16

# Atheris rewrite:
low_cyclomatic	runs=40000	time=0.13s	execs/sec=318779.70
high_cyclomatic	runs=2000	time=0.27s	execs/sec=7369.53

The existing strategy used by Atheris is 1.5-2x faster. Atheris was disadvantaged in this benchmark, since my minimal lnotab implementation didn't actually register or increment any counters, reducing the time spent in libfuzzer.

from atheris.

risicle avatar risicle commented on April 28, 2024

Quite surprised by this - I guess tracehook-calling is not considered a fast-path in cpython (if you're installing any sort of trace hook, I imagine the thought is you're not after top performance), while all the bytecode ops used in the full rewriting are.

from atheris.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.