Skip to content

froz42/funcheck

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Logo

A tool for checking functions calls return protections. Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Contributing
  5. License

image

About The Project

Funcheck is a tool for checking functions calls return protections. It check if it is protected at runtime by making each call fail one by one and check if the program doesn't crash and handle the errors. This tool only works on Linux for now. *this tool can have undefined behavior on threaded programs (WIP)

You can see the list of handled functions and how to add new ones here: Hooked functions

Getting Started

Run requirements

  • A GNU/Linux distribution
  • addr2line or llvm-symbolizer for getting symbolized stack traces (we advise you to use llvm-symbolizer since it gives more information)

Quick install

bash -c 'bash <(curl -s https://raw.githubusercontent.com/froz42/funcheck/main/scripts/install.sh)'

You can choose to install temporarily, permanently or uninstall the tool. If you you want to update the tool, you can run the same command.

You can now use the funcheck command. (run funcheck --help for more information how to use it)

Build instructions

Requirements

  • A modern version of gcc
  • make

Build

You need to build both the funcheck binary and the libfuncheck.so library.

Clone the repository

git clone https://github.com/froz42/funcheck.git
cd funcheck

Build the libfuncheck.so library

cd library
make

Build the funcheck binary

cd ../host
make

You now have the funcheck binary in the host directory and the libfuncheck.so library in the library directory.

You can launch ./funcheck --help to see how to use it.

You can add the host directory to your PATH to be able to use the funcheck command from anywhere.

(back to top)

Usage

Basic usage

funcheck [OPTIONS] ./program [PROGRAM PARAMETERS]

Options

  • -h, --help : Display the help message
  • -v, --version : Display the version
  • -t, --test-functions : Specify the functions to test --test-functions='malloc, calloc, realloc'
  • -i, --ignore-functions : Specify the functions to ignore --ignore-functions='malloc, calloc, realloc'
  • -j, --json-output : Output the result in json format
  • -a, --track-allocations: Track memory allocations
  • -o, --all-output : Output stdout and stderr of every test
  • -c, --abort-as-crash : Treat abort() as a crash
  • -b, --complete-backtrace : Keep unknowns functions and utils functions in backtrace
  • -s --show-current-test : Show the current actually processed by funcheck

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b yourlogin/amazingfeature)
  3. Commit your Changes (git commit -m '<gitmoji> Add some AmazingFeature')
  4. Push to the Branch (git push origin yourlogin/amazingfeature)
  5. Open a Pull Request

(back to top)

License

Funcheck - A tool for checking functions calls return protections Copyright (C) 2023 Theo Matis

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.

(back to top)