Skip to content

Latest commit

 

History

17 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mubsan

Minimal implementation of UBSAN, which can be utilized inside freestanding environments.

Note

Not all of the handlers are implemented, only the major ones.

To test the project on Linux or macOS, clone the repository and run.

$ make
$ ./mubsantest
mubsan @ test.c:21:8: array out of bounds, for type 'int [4]', by index type 'int' 4

Usage

Statically link the mubsan.c file with your existing project.
Then, define a function with the following signature:

int mubsan_log(const char* format, ...) {
    // code
}

This function should work like printf.

Dependencies

mubsan.c depends on stdint.h.

Credit

So, finding documentation for this was pretty abysmal, so I had to utilize other implementations and using them as reference.
However, the only main reference I even used was GCC itself, however, I'll credit the others that I viewed anyways.

OSDev Wiki Page on UBSAN
GCC Mirror
Sortix
optee_os
tinyubsan
barebones
dgos

About

Minimal implementation of UBSAN

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages