Coder Social home page Coder Social logo

paulperegud / randmockery Goto Github PK

View Code? Open in Web Editor NEW

This project forked from marmistrz/randmockery

0.0 3.0 0.0 116 KB

A proof-of-concept that we can mock randomness.

License: GNU Affero General Public License v3.0

Makefile 1.67% Rust 79.85% Shell 0.40% C 18.07%

randmockery's Introduction

Build status: CircleCI

A proof of concept that we can mock randomness.

How does it work?

We use ptrace to get notified about any syscall the inferior makes. When the inferior enters or exits a syscall, a user-defined handler is executed.

This gives us the opportunity to replace the syscall return value/buffer with our own data.

Notes

Mocking vDSO syscalls is not supported out of the box. You need to preload a library using the -l switch. An example mocking library is located in the tests subdirectory.

Benchmarks

  • cmp file1 file2 on 1.5G files yielded 8x slowdown (this is the pessimistic scenario of an application, which does mostly syscalls)
  • running a compute-only job (calculating 1/(1+x) using a series for a 1000 values of x with double precision) showed virtually no slowndown

git dependencies

Unfortunately, we depend on git versions of some crates:

  • nix-rust/nix: we need struct Pid

upstreaming

ptrace_mod.rs will be upstreamed and is currently under review nix-rust/nix#666

randmockery's People

Contributors

marmistrz avatar

Watchers

Paul Peregud avatar James Cloos avatar  avatar

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.