Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
shankarapailoor committed Jul 31, 2018
1 parent 8b7c361 commit 30e18e9
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion logging/logger.go
Expand Up @@ -3,5 +3,5 @@ package logging
import "fmt"

func Failf(format string, a ...interface{}) {
panic(fmt.Sprintf(format, a))
panic(fmt.Sprintf(format, a...))
}
5 changes: 1 addition & 4 deletions parser/strace2syz.go
Expand Up @@ -266,15 +266,12 @@ func Parse_ArrayType(syzType *prog.ArrayType, straceType strace_types.Type, ctx
case *strace_types.PointerType, *strace_types.Expression, *strace_types.BufferType:
return GenDefaultArg(syzType, ctx), nil
default:
Failf("Error parsing Array with Wrong Type: %s", straceType.Name())
Failf("Error parsing Array: %s with Wrong Type: %s\n", syzType.FldName, straceType.Name())
}
return strace_types.GroupArg(syzType, args), nil
}

func Parse_StructType(syzType *prog.StructType, straceType strace_types.Type, ctx *Context) (prog.Arg, error) {
if syzType.Dir() == prog.DirOut {
return GenDefaultArg(syzType, ctx), nil
}
straceType = PreprocessStruct(syzType, straceType, ctx)
args := make([]prog.Arg, 0)
switch a := straceType.(type) {
Expand Down
10 changes: 6 additions & 4 deletions scanner/lex.rl
Expand Up @@ -39,11 +39,12 @@ func (lex *lexer) Lex(out *StraceSymType) int {
%%{
dateSep = '-' | '\/';
datetimeSep = 'T' | '-';
microTimeSep = '+' | '-';
date = digit{4}.dateSep.digit{2}.dateSep.digit{2};
nullptr = "NULL";
time = digit{2}.':'.digit{2}.':'.digit{2} |
digit{2}.':'.digit{2}.':'.digit{2}.'+'.digit{4} |
digit{2}.':'.digit{2}.':'.digit{2}.'+'.digit{4}.'.'.digit+ |
digit{2}.':'.digit{2}.':'.digit{2}.microTimeSep.digit{4} |
digit{2}.':'.digit{2}.':'.digit{2}.microTimeSep.digit{4}.'.'.digit+ |
digit{2}.':'.digit{2}.':'.digit{2}.'.'.digit+;
datetime = date.datetimeSep.time;
unfinished = '<unfinished ...>' | ', <unfinished ...>';
Expand All @@ -53,8 +54,9 @@ func (lex *lexer) Lex(out *StraceSymType) int {
resumed = '<... '.identifier+.' resumed>'
| '<... '.identifier+.' resumed> ,'
| '<... resuming'.' '.identifier.' '.identifier.' '.'...>';
ipv4 = '\"'.digit{1,4}.'\.'.digit{1,4}.'\.'digit{1,4}.'\.'.digit{1,4}'\"';
ipv6 = '\"'.':'.':'.'\"' | '\"'.':'.':'.digit.'\"';
ipv4Base = digit{1,4}.'\.'.digit{1,4}.'\.'.digit{1,4}.'\.'.digit{1,4};
ipv4 = '\"'.ipv4Base.'\"';
ipv6 = '\"'.':'.':'.'\"' | '\"'.':'.':'.digit.'\"' | '\"'.':'.':'xdigit+.':'.ipv4Base.'\"';
flag = (['_']+?upper+ . ['_'A-Z0-9]+)-nullptr;
string = '\"'.['_'('')'' ''#'':'0-9a-zA-Z\/\\\*]*.'\"'- (ipv4 | ipv6);
mac = xdigit{2}.':'.xdigit{2}.':'.xdigit{2}.':'.xdigit{2}.':'.xdigit{2}.':'.xdigit{2};
Expand Down
2 changes: 2 additions & 0 deletions scanner/strace.y
Expand Up @@ -113,6 +113,8 @@ syscall:
Stracelex.(*lexer).result = $$ }
| RESUMED types RPAREN EQUALS UINT FLAG LPAREN parentheticals RPAREN { $$ = types.NewSyscall(-1, "tmp", $2, int64($5), false, true);
Stracelex.(*lexer).result = $$ }
| RESUMED types RPAREN EQUALS INT FLAG LPAREN parentheticals RPAREN { $$ = types.NewSyscall(-1, "tmp", $2, int64($5), false, true);
Stracelex.(*lexer).result = $$ }
| IDENTIFIER LPAREN RPAREN EQUALS INT %prec NOFLAG { $$ = types.NewSyscall(-1, $1, nil, $5, false, false);
Stracelex.(*lexer).result = $$;}
| IDENTIFIER LPAREN types RPAREN EQUALS INT %prec NOFLAG{
Expand Down
2 changes: 2 additions & 0 deletions strace_types/util.go
Expand Up @@ -207,6 +207,7 @@ var (
Pair{"IPPROTO_IPV6", "IPV6_MTU"}: "$inet6_int",
Pair{"SOL_IPV6", "IPV6_MTU_DISCOVER"}: "$inet6_mtu",
Pair{"SOL_ICMPV6", "1"}: "$inet6_buf",
Pair{"SOL_IPV6", "IPV6_V6ONLY"}: "$inet6_int",
Pair{"SOL_IPV6", "IPV6_MTU_DISCOVER"}: "$inet6_mtu",
Pair{"SOL_PACKET", "PACKET_RX_RING"}: "$packet_rx_ring",
Pair{"SOL_PACKET", "PACKET_RECV_OUTPUT"}: "$packet_int",
Expand Down Expand Up @@ -677,6 +678,7 @@ var (
"SIGUSR1": 10,
"SIGALRM": 14,
"SIGFPE": 8,
"SIGINT": 2,
"SIG_0": 0,
"S_ISUID": 0x0004000,
"S_ISGID": 0x0002000,
Expand Down

0 comments on commit 30e18e9

Please sign in to comment.