Skip to content

Silently concretizing and symbolic input via s2ecmd #391

Description

@cedrickrause

Hi everyone,

I am currently trying to retrieve information about the system calls a particular binary (and its associated libraries) are invoking. I am currently currently starting the program with the S2E_SYM_ARGS variable in bootstrap.sh and this works fine in some cases. If I for example start ls with the following line:
S2E_SYM_ARGS="1" LD_PRELOAD="${S2E_SO}" ./${TARGET} -a > /dev/null 2> /dev/null it does what I expect and the TestCaseGenerator shows me all options for ls that consist of 1 dash and 1 letter. However when I increase the size of the input that shall be symbolized from 2 bytes to something longer then it will create all kinds of combinations for option flags which are all unique, but will contain i.e. (for 4 bytes) -sf<each other 1 letter flag> and also -sd<each other 1 letter flag> and that for each combination of flags so it really explodes very fast (quite unthinkable to doe it with 11 bytes to get something like the --full-time flag). I noticed that there is a lot of silently concretizing during that execution (much more than on 2 bytes) and I figured that might be the reason, that it concretizes the symbolic bytes too early so it does not collect info about the path constraints and will then traverse the same code many times (with also earlier concretized input). The reasons for that are always either memory access to concrete code or access to " + regName + " register from libcpu helper.
That connects to the other topic of this questions: symbolic values with symbwrite. It would be great for my project to be able to take symbolic input via stdin and from the documentation this should work with symbwrite. However in the same scenario (ls $(./s2ecmd symbwrite 2)) so 2 symbolic bytes this does not generate all the options flags which I would expect, but rather only creates the pairs (0x0, 0x0) and (0x0, 0x1) and then terminates. Checking the log again I see that right after inserting the symbolic input there are messages of concretization:

5 [Node 0/0 - State 0] BaseInstructions: Inserted symbolic data @0x1390c20 of size 0x2: buffer='\x00\x00' pc=0x401fdb
KLEE: WARNING: silently concretizing (reason: memory access from concrete code)  to value 0x0
5 [Node 0/0 - State 0] Forking state 0 at pc = 0x4573ab at pagedir = 0xdded000
     state 0
     state 1
KLEE: WARNING: silently concretizing (instruction: tcg-llvm-77-7ff51a9f5909:   call void @helper_s2e_tcg_execution_handler(i64 140396890988224, i64 140690690365710)) (reason: access to cc_op register from libcpu helper)  to value 0x0

I don't quite understand why that happens. I would understand concretization right before writing the output of ls so it can display 'real' values, but during that execution I don't quite understand why that happens so often.
This to me also looks like the simplest examples (like in the documentation described at: http://s2e.systems/docs/Tutorials/BasicLinuxSymbex/s2e.so.html#what-about-other-symbolic-input) does not work as expected, or am I missing something here?
I have been battling with those problems for some time now and would greatly appreciate if you can provide me some help.
If you need some further information, just let me know.

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions