Go to the source code of this file.
|
int | df_ewrite (int fd, const void *buf, size_t count) |
|
int | df_fuzz_init (GDBusProxy *dproxy, const int statfd, const int pid, const long mem_limit) |
|
int | df_fuzz_add_method (const char *name) |
|
int | df_fuzz_add_method_arg (const char *signature) |
|
int | df_list_args_count (void) |
|
int | df_fuzz_test_method (const int statfd, long buf_size, const char *name, const char *obj, const char *intf, const int pid, const int void_method, const char *execute_cmd) |
|
void | df_fuzz_clean_method (void) |
|
§ MAX_EXCEPTIONS
#define MAX_EXCEPTIONS 10 |
Maximum amount of unimportant exceptions for one method; if reached testing continues with a next method
§ MAXFMT
MAXSIG * 2 because of '@' character for every signature
§ MAXLINE
Maximum length read from file
§ MAXSIG
Maximum length of D-Bus signature string
§ df_ewrite()
int df_ewrite |
( |
int |
fd, |
|
|
const void * |
buf, |
|
|
size_t |
count |
|
) |
| |
|
inline |
Error checked write function with short write correction (when write is interrupted by a signal).
- Parameters
-
fd | File descriptor where to write |
buf | Buffer from which to write to file descriptor fd |
count | Number of bytes to be written |
- Returns
- 0 on success, -1 on error
§ df_fuzz_add_method()
int df_fuzz_add_method |
( |
const char * |
name | ) |
|
Initializes the global variable df_list (struct df_sig_list) including allocationg memory for method name inside df_list.
- Parameters
-
name | Name of method which will be tested |
- Returns
- 0 on success, -1 on error
§ df_fuzz_add_method_arg()
int df_fuzz_add_method_arg |
( |
const char * |
signature | ) |
|
Adds item (struct df_signature) at the end of the linked list in the global variable df_list (struct df_sig_list). This includes allocating memory for item and for signature string.
- Parameters
-
signature | D-Bus signature of the argument |
- Returns
- 0 on success, -1 on error
§ df_fuzz_clean_method()
void df_fuzz_clean_method |
( |
void |
| ) |
|
§ df_fuzz_init()
int df_fuzz_init |
( |
GDBusProxy * |
dproxy, |
|
|
const int |
statfd, |
|
|
const int |
pid, |
|
|
const long |
mem_limit |
|
) |
| |
Saves pointer on D-Bus interface proxy for this module to be able to call methods through this proxy during fuzz testing. Also saves process initial memory size to global var. df_initial_mem from file described by statfd.
- Parameters
-
dproxy | Pointer on D-Bus interface proxy |
statfd | FD of process status file |
pid | PID of tested process |
mem_limit | Memory limit in kB - if tested process exceeds this limit it will be noted into log file |
- Returns
- 0 on success, -1 on error
§ df_fuzz_test_method()
int df_fuzz_test_method |
( |
const int |
statfd, |
|
|
long |
buf_size, |
|
|
const char * |
name, |
|
|
const char * |
obj, |
|
|
const char * |
intf, |
|
|
const int |
pid, |
|
|
const int |
void_method, |
|
|
const char * |
execute_cmd |
|
) |
| |
Function is testing a method in a cycle, each cycle generates data for function arguments, calls method and waits for result.
- Parameters
-
statfd | FD of process status file |
buf_size | Maximum buffer size for generated strings by rand module (in Bytes) |
name | D-Bus name |
obj | D-Bus object path |
intf | D-Bus interface |
pid | PID of tested process |
void_method | If method has out args 1, 0 otherwise |
execute_cmd | Command/Script to execute after each method call. |
- Returns
- 0 on success, -1 on error, 1 on tested process crash, 2 on void function returning non-void value, 3 on warnings and 4 when executed command finished unsuccessfuly
§ df_list_args_count()
int df_list_args_count |
( |
void |
| ) |
|
- Returns
- Number of arguments of tested method