GSoC status report - #7 of 10

Srikavin Ramkumar srikavinramkumar at gmail.com
Tue Jul 27 06:53:59 UTC 2021


Hi,

Accomplishments:

Last week, I continued to work on the code generation. I added support for
auxiliary strings for syscalls with a flag return type. 

I also added the ability to specify how certain types are decoded within the
definition files. The expression '$$' can be used to refer to the value of the
syscall/return value being decoded.

As an example, the following syscall description:

    :ptr[in, bind_sockaddr]	 %{ decode_sockaddr(tcp, $$, (int) tcp->u_arg[1]); %}
    
    bind(sockfd fd, addr ptr[in, bind_sockaddr], addrlen int)

results in the following output:

    SYS_FUNC(bind)
    {
        /* arg: sockfd (fd) */
        /* using decoder from defs/common.syzlang:1:1 */
         printfd(tcp, tcp->u_arg[0]); 	
        tprint_arg_next();
        
        /* arg: addr (bind_sockaddr *) */
        /* using decoder from defs/example2.syzlang:5:1 */
         decode_sockaddr(tcp, tcp->u_arg[1], (int) tcp->u_arg[1]); 	
        tprint_arg_next();
        
        /* arg: addrlen (int) */
        PRINT_VAL_D((int) tcp->u_arg[2]);
        
        return RVAL_DECODED;
    }

I also moved the hardcoded decoders into a common file:

    :fd %{ printfd(tcp, $$); %}
    :uid %{ printuid($$); %}
    :gid %{ printuid($$); %}
    
    :path %{
        if (syserror(tcp)) {
            printaddr($$);
        } else {
            printpath(tcp, $$);
        }
    %}
    :string %{
        if (syserror(tcp)) {
            printaddr($$);
        } else {
            printstr(tcp, $$);
        }
    %}


Currently, there isn't a way to define a generic decoder (e.g. for types with
options like stringnoz[len] where 'len' is the length of the referred string).

Priorities:
 - Continue working on the code generation
   - Improve on decoder definitions
   - Automatically generate struct decoding for simple structs
 - Incorporate code generation with the build process
 - Finalize CLI arguments, and add usage documentation

-- Srikavin


More information about the Strace-devel mailing list