[Rose-public] Binary Analysis: Mips little endian support?

David Alm almd at student.chalmers.se
Fri Mar 6 07:49:20 PST 2015


Hi,

I am trying to do some binary analysis on mips binaries, its part of 
building a binary
rewriting framework. I have a test code that I have compiled for both 
big and
little endian. I have so far build an AST with the frontend and a block 
CFG from
which I created graphs that show the basic blocks and instructions for my
main function. It seems though that the frontend is not able to parse my 
little
endian binaries correctly judging from my graphs since they are very 
different.

The compiler I have used is ELDK version 4.1 with the flags -static and -O0.
I have attached the test code and the graphs produced for both big and 
little
endian binaries.

So I'm wondering if rose actually can analyze little endian mips binaries?
If so how can I do it since I'm surely doing it wrong at the moment.

Another question I have is if it is possible to use the backend to produce
binaries that have been modified, e,g added or removed several instructions.
 From my reading in the user manual and the tutorial I understand it 
works but how well?


Best regards,
David

-------------- next part --------------
A non-text attachment was scrubbed...
Name: big_endian_cfg.png
Type: image/png
Size: 283210 bytes
Desc: not available
URL: <http://mailman.nersc.gov/pipermail/rose-public/attachments/20150306/5f060bfe/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: little_endian_cfg.png
Type: image/png
Size: 48299 bytes
Desc: not available
URL: <http://mailman.nersc.gov/pipermail/rose-public/attachments/20150306/5f060bfe/attachment-0001.png>
-------------- next part --------------

//test code takes ascii numbers, convert them and add them together.
//the sum of the numbers plus argc is returned.
int main(int argc, char **argv)
{
    //Declarations
    int acc = 0;
    int i = 0;

    //go through argv and convert and check the numbers to be valid.
    for (i = 1; i < argc; i++) {
        //Get the number and adjust it.
        int charNum = argv[i][0];
        charNum -= '0';
        //check if it is a number, if it is add it otherwise ignore.
        if (charNum >= 0 && charNum <= 9) {
            acc += charNum;
        }
    }
    //return the sum.
    return (acc + argc);
}



More information about the rose-public mailing list