summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md112
1 files changed, 112 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..fda8cba
--- /dev/null
+++ b/README.md
@@ -0,0 +1,112 @@
1# What is it?
2
3This is a [standalone implementation](https://git.2f30.org/fortify-headers/) of
4[fortify source]( http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html )
5level 3, providing compile time security checks. It is libc-agnostic and simply
6overlays the system headers by using the
7[`#include_next`](https://gcc.gnu.org/onlinedocs/cpp/Wrapper-Headers.html)
8extension found in GCC, and [black
9magic](https://github.com/jvoisin/fortify-headers/commit/fe149628eaae9748be08815d726cc56e8e492c73)
10on Clang. It was initially intended to be used on
11[musl](http://www.musl-libc.org/) based Linux
12distributions like [Alpine Linux](https://alpinelinux.org),
13[Chimera Linux](https://chimera-linux.org/).
14
15
16# Features
17
18- It is portable, works on *BSD, Linux, Solaris and possibly others.
19- It will only trap non-conformant programs. This means that fortify
20 level 2 is treated in the same way as level 1.
21- Avoids making function calls when undefined behaviour has already been
22 invoked. This is handled by using `__builtin_trap()`.
23- Support for out-of-bounds read interfaces, such as send(), write(), fwrite() etc.
24- No ABI is enforced. All of the fortify check functions are inlined
25 into the resulting binary.
26- It has a comprehensive suite of
27 tests, running on multiple versions of Clang and GCC,
28 as well as on C89, C99, C11 and C17.
29
30
31# Sample usage
32
33If you want to quickly test it, you can try something like the following:
34
35```
36cat > fgets.c <<EOF
37#include <stdio.h>
38int
39main(void)
40{
41 char buf[BUFSIZ];
42 fgets(buf, sizeof(buf) + 1, stdin);
43 return 0;
44}
45EOF
46cc -I<path-to-fortify-include-dir> -D_FORTIFY_SOURCE=3 -O1 fgets.c
47./a.out
48```
49
50At this point, the program will safely crash.
51
52
53Supported interfaces
54====================
55
56FD_CLR
57FD_SET
58bcopy
59bzero
60confstr
61fgets
62fgetws
63fread
64fwrite
65getcwd
66getdomainname
67getgroups
68gethostname
69getlogin_r
70mbsnrtowcs
71mbsrtowcs
72mbstowcs
73memcpy
74memmove
75mempcpy
76memset
77poll
78ppoll
79pread
80read
81readlink
82readlinkat
83realpath
84recv
85recvfrom
86send
87sendto
88snprintf
89sprintf
90stpcpy
91stpncpy
92strcat
93strcpy
94strlcat
95strlcpy
96strncat
97strncpy
98ttyname_r
99vsnprintf
100vsprintf
101wcrtomb
102wcscat
103wcscpy
104wcsncat
105wcsncpy
106wcsnrtombs
107wcsrtombs
108wcstombs
109wmemcpy
110wmemmove
111wmemset
112write