diff options
-rw-r--r-- | .gitmodules | 3 | ||||
-rw-r--r-- | bruiser/defaults.lua | 6 | ||||
m--------- | bruiser/faultreiber | 0 | ||||
-rwxr-xr-x | bruiser/faultreibergen.sh | 5 | ||||
-rw-r--r-- | bruiser/wasmread/wasm.xml | 168 | ||||
-rw-r--r-- | macros.mk | 2 |
6 files changed, 180 insertions, 4 deletions
diff --git a/.gitmodules b/.gitmodules index b4dd2d7..a58e1d1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "bruiser/LuaJIT"] path = bruiser/LuaJIT url = https://github.com/LuaJIT/LuaJIT +[submodule "bruiser/faultreiber"] + path = bruiser/faultreiber + url = https://github.com/bloodstalker/faultreiber diff --git a/bruiser/defaults.lua b/bruiser/defaults.lua index 8f1692b..70ecefb 100644 --- a/bruiser/defaults.lua +++ b/bruiser/defaults.lua @@ -1,7 +1,7 @@ -- bruiser default script. -- This is run everytime bruiser is called. --- By default bruiser will look for a file named defaults.lua in the same --- directory as its executable. you can change the file using the --luadefault +-- By default bruiser will look for a file named defaults.lua in the same +-- directory as its executable. you can change the file using the --luadefault -- option. -- adds luarocks' path and cpath to bruiser @@ -12,7 +12,7 @@ function default_luarocks_modules() for line in luarocks_handle:lines() do local path = string.match(line, "LUA_PATH%s*=%s*('.+')") local cpath = string.match(line, "LUA_CPATH%s*=%s*('.+')") - if path ~= nil then + if path ~= nil then package.path = package.path..";"..string.sub(path, 2, -2) end if cpath ~= nil then diff --git a/bruiser/faultreiber b/bruiser/faultreiber new file mode 160000 +Subproject dfe00e935a95e48590e0e2f7525f4a23e70f3ed diff --git a/bruiser/faultreibergen.sh b/bruiser/faultreibergen.sh new file mode 100755 index 0000000..d95979d --- /dev/null +++ b/bruiser/faultreibergen.sh @@ -0,0 +1,5 @@ +#!/bin/sh +cd $(dirname $0) +"./faultreiber.py" --targetname autowasm --outdir ./test/ --structs ./test/struct.json --datetime --structsinclude ./resources/structsinclude.h --xml ./resources/wasm.xml +"clang-format" -i ./test/read.c ./test/structs.h ./test/aggregate.c ./test/aggregate.h ./test/read.h +#"less" ./test/structs.h diff --git a/bruiser/wasmread/wasm.xml b/bruiser/wasmread/wasm.xml new file mode 100644 index 0000000..6a9dfe9 --- /dev/null +++ b/bruiser/wasmread/wasm.xml @@ -0,0 +1,168 @@ +<?xml version="1.0" encoding="UTF-8"?> +<FT> + <Read> + <Magic_Number name="magic_number" type="uint32" count="1"></Magic_Number> + <Version name="version" type="uint32" count="1"></Version> + <Type_Section name="W_Type_Section" count="1" type="" isaggregate="true"> + <ID name="id" type="uint8" encoding="leb128u"/> + <PayloadLength name="payloadlength" type="uint32" encoding="leb128u"/> + <NameLength name="namelength" type="uint32" encoding="leb128u"/> + <Name name="name" type="string" size="self::NameLength"/> + <Count name="count" encoding="leb128u" type="uint32" count="1"/> + <Type_Section_Entry count="self::Count" type="self::Type_Section_Entry" name="entries"/> + </Type_Section> + <Import_Section name="W_Import_Section" count="1" type="" isaggregate="true"> + <ID name="id" type="uint8" encoding="leb128u"/> + <PayloadLength name="payloadlength" type="uint32" encoding="leb128u"/> + <NameLength name="namelength" type="uint32" encoding="leb128u"/> + <Name name="name" type="string" size="self::NameLength"/> + <Count name="count" encoding="leb128u" type="uint32" count="1"/> + <Entries name="entries" type="self::Import_Section_Entry" count="self::Count"/> + </Import_Section> + <Function_Section name="W_Function_Section" count="1" type="" isaggregate="true"> + <ID name="id" type="uint8" encoding="leb128u"/> + <PayloadLength name="payloadlength" type="uint32" encoding="leb128u"/> + <NameLength name="namelength" type="uint32" encoding="leb128u"/> + <Name name="name" type="string" size="self::NameLength"/> + <Count name="count" encoding="leb128u" type="uint32" count="1"/> + <Types name="types" encoding="leb128u" type="uint32" count="self::Count"/> + </Function_Section> + <Table_Section name="W_Table_Section" count="1" type="" isaggregate="true"> + <ID name="id" type="uint8" encoding="leb128u"/> + <PayloadLength name="payloadlength" type="uint32" encoding="leb128u"/> + <NameLength name="namelength" type="uint32" encoding="leb128u"/> + <Name name="name" type="string" size="self::NameLength"/> + <Count name="count" encoding="leb128u" type="uint32" count="1"/> + <Entries name="entries" type="self::Table_Type" count="self::Count"/> + </Table_Section> + <Memory_Section name="W_Memory_Section" count="1" type="" isaggregate="true"> + <ID name="id" type="uint8" encoding="leb128u"/> + <PayloadLength name="payloadlength" type="uint32" encoding="leb128u"/> + <NameLength name="namelength" type="uint32" encoding="leb128u"/> + <Name name="name" type="string" size="self::NameLength"/> + <Count name="count" encoding="leb128u" type="uint32" count="1"/> + <Entries name="entries" type="self::Memory_Type" count="self::Count"/> + </Memory_Section> + <Global_Section name="W_Global_Section" count="1" type="" isaggregate="true"> + <ID name="id" type="uint8" encoding="leb128u"/> + <PayloadLength name="payloadlength" type="uint32" encoding="leb128u"/> + <NameLength name="namelength" type="uint32" encoding="leb128u"/> + <Name name="name" type="string" size="self::NameLength"/> + <Count name="count" encoding="leb128u" type="uint32" count="1"/> + <Globals name="globals" type="self::Global_Entry" count="self::Count"/> + </Global_Section> + <Export_Section name="W_Export_Section" count="1" type="" isaggregate="true"> + <ID name="id" type="uint8" encoding="leb128u"/> + <PayloadLength name="payloadlength" type="uint32" encoding="leb128u"/> + <NameLength name="namelength" type="uint32" encoding="leb128u"/> + <Name name="name" type="string" size="self::NameLength"/> + <Count name="count" encoding="leb128u" type="uint32" count="1"/> + <Entries name="entries" type="self::Export_Entry" count="self::Count"/> + </Export_Section> + <Start_Section name="W_Start_Section" count="1" isaggregate="true"> + <ID name="id" type="uint8" encoding="leb128u"/> + <PayloadLength name="payloadlength" type="uint32" encoding="leb128u"/> + <NameLength name="namelength" type="uint32" encoding="leb128u"/> + <Name name="name" type="string" size="self::NameLength"/> + <Index name="index" encoding="leb128u" type="uint32" count="1"/> + </Start_Section> + <Element_Section name="W_Element_Section" count="1" isaggregate="true"> + <ID name="id" type="uint8" encoding="leb128u"/> + <PayloadLength name="payloadlength" type="uint32" encoding="leb128u"/> + <NameLength name="namelength" type="uint32" encoding="leb128u"/> + <Name name="name" type="string" size="self::NameLength"/> + <Count name="count" encoding="leb128u" type="uint32" count="1"/> + <Entries name="entries" type="self::Element_Segment" count="self::Count"/> + </Element_Section> + <Code_Section name="W_Code_Section" count="1" isaggregate="true"> + <ID name="id" type="uint8" encoding="leb128u"/> + <PayloadLength name="payloadlength" type="uint32" encoding="leb128u"/> + <NameLength name="namelength" type="uint32" encoding="leb128u"/> + <Name name="name" type="string" size="self::NameLength"/> + <Count name="count" encoding="leb128u" type="uint32" count="1"/> + <Bodies name="bodies" type="self::Function_Body" count="self::Count"/> + </Code_Section> + <Data_Section name="W_Data_Section" count="1" isaggregate="true"> + <ID name="id" type="uint8" encoding="leb128u"/> + <PayloadLength name="payloadlength" type="uint32" encoding="leb128u"/> + <NameLength name="namelength" type="uint32" encoding="leb128u"/> + <Name name="name" type="string" size="self::NameLength"/> + <Count name="count" encoding="leb128u" type="uint32" count="1"/> + <Entries name="entries" type="self::Data_Segment" count="self::Count"/> + </Data_Section> + </Read> + <Definition> + <Init_Expr name="init_expr_t" isaggregate="true"> + <Size name="size" encoding="leb128u" type="varuint32" count="1"></Size> + <Code name="code" type="string" count="1" size="self::Size"></Code> + </Init_Expr> + <Resizable_Limit name="resizable_limit_t" isaggregate="true"> + <Flags name="flags" encoding="leb128u" type="uint8" count="1"></Flags> + <Initial name="initial" encoding="leb128u" type="uint32" count="1"></Initial> + <Maximum name="maximum" encoding="leb128u" type="uint32" count="1"></Maximum> + </Resizable_Limit> + <Global_Type name="global_type_t" isaggregate="true"> + <Value_Type name="value_type" type="uint32" count="1"></Value_Type> + <Mutability name="mutability" encoding="leb128u" type="uint8" count="1"></Mutability> + </Global_Type> + <Table_Type name="table_type_t" isaggregate="true"> + <Element_Type name="element_type" encoding="leb128s" type="int8" count="1"></Element_Type> + <Resizable_Limit name="resizable_limit" count="1" type="self::Resizable_Limit"></Resizable_Limit> + </Table_Type> + <Memory_Type name="memory_type_t" isaggregate="true"> + <Resizable_Limit count="1" type="self::Resizable_Limit" name="resizable_limit"></Resizable_Limit> + </Memory_Type> + <Type_Section_Entry name="W_Type_Section_Entry" isaggregate="true"> + <Form name="form" encoding="leb128u" type="uint8" count="1"/> + <Param_Count name="param_count" encoding="leb128u" type="uint32" count="1"/> + <Param_Types name="param_types" encoding="leb128u" type="uint8" count="self::Param_Count"/> + <Return_Count name="return_count" encoding="leb128u" type="uint8"/> + <Return_Types name="return_types" encoding="leb128u" type="uint8" count="self::Return_Count"/> + </Type_Section_Entry> + <Import_Section_Entry name="W_Import_Section_Entry" isaggregate="true"> + <Module_Length name="module_length" encoding="leb128u" type="uint32" count="1"/> + <Module_Str name="module_str" type="string" count="1" size="self::Module_Length"/> + <Field_Len name="field_len" encoding="leb128u" type="uint32" couny="1"/> + <Field_Str name="field_str" type="string" count="1" size="self::Field_Len"/> + <Kind name="kind" encoding="leb128u" type="uint8" count="1"/> + <Type name="type" conditional="true" condition="self::Kind" type="FT::conditional"> + <condition0 name="type" encoding="leb128u" type="uint32">0</condition0> + <condition1 name="type" type="self::Table_Type">1</condition1> + <condition2 name="type" type="self::Memory_Type">2</condition2> + <condition3 name="type" type="self::Global_Type">3</condition3> + </Type> + </Import_Section_Entry> + <Global_Entry name="W_Global_Entry" isaggregate="true"> + <Global_Type name="type" type="self::Global_Type" count="1"/> + <Init name="init" type="self::Init_Expr" count="1"/> + </Global_Entry> + <Export_Entry name="W_Export_Entry" isaggregate="true"> + <Field_Len name="field_len" encoding="leb128u" type="uint32" count="1"/> + <Field_Str name="field_str" type="string" count="1" size="self::Field_Len"/> + <Kind name="kind" encoding="leb128u" type="uint8" count="1"/> + <Index name="index" encoding="leb128u" type="uint32" count="1"/> + </Export_Entry> + <Element_Segment name="W_Element_Segment" isaggregate="true"> + <Index name="index" encoding="leb128u" type="uint32" count="1"/> + <Init name="init" type="self::Init_Expr" count="1"/> + <Num_Length name="num_length" encoding="leb128u" type="uint32" count="1"/> + <Elems name="elems" encoding="leb128u" type="uint32" count="self::Num_Length"/> + </Element_Segment> + <Local_Entry name="W_Local_Entry" isaggregate="true"> + <Count name="count" encoding="leb128u" type="uint32" count="1"/> + <Type name="type" encoding="leb128u" type="int16" count="self::Count"/> + </Local_Entry> + <Function_Body name="W_Function_Body" isaggregate="true"> + <Body_size name="body_size" encoding="leb128u" type="uint32" count="1"/> + <Local_Count name="local_count" encoding="leb128u" type="uint32" count="1"/> + <Local_Entries name="locals" type="self::Local_Entry" count="self::Local_Count"/> + <Code name="code" type="uchar" count="self::Body_size"/> + </Function_Body> + <Data_Segment name="W_Data_Segment" isaggregate="true"> + <Index name="index" encoding="leb128u" type="uint32" count="1"/> + <Offset name="offset" type="self::Init_Expr" count="1"/> + <Size name="size" encoding="leb128u" type="uint32" count="1"/> + <Data name="data" type="uchar" count="self::Size"/> + </Data_Segment> + </Definition> +</FT> @@ -138,4 +138,4 @@ CC_FLAGS+=$(EXTRA_CC_FLAGS) SRCS=./mutator_aux.cpp ./mutator-lvl1.cpp ./mutator-lvl0.cpp ./mutator-lvl2.cpp ./mutator-lvl0.h ./mutator_aux.h ./daemon/mutatord.h ./daemon/mutatorclient.c ./daemon/mutatorclient.h ./daemon/daemon_aux.h ./daemon/daemon_aux.c ./daemon/mutatord.c ./daemon/mutatorserver.c ./daemon/mutatorserver.h ./bruiser/bruiser.cpp ./bruiser/bruiser.h -CTAGS=ctags --c++-kinds=+p --fields=+iaS --extra=+q +CTAGS=ctags --c++-kinds=+p --fields=+iaS --extra=+q |