pocmatos
2020-9-14 07:32:42

You mean for Racket?


pocmatos
2020-9-14 07:32:55

I don’t know of any efforts to fuzz Racket tbh.


pocmatos
2020-9-14 07:34:45

The biggest blocker to fuzzing racket atm is executions / sec. Racket is just too slow. I need to somehow speed it up or fuzz a few components at a time. I am working on this for JSC too, which shares the same issue so any solutions/ideas I come up with there will be applicable to Racket which is great.


pocmatos
2020-9-14 07:35:03

AFL is doing 7 exec/sec of racket CS


pocmatos
2020-9-14 07:35:37

Which is very poor. It would be great to do a lot more. In the hundreds if possible, however startup time is quite slow.


pocmatos
2020-9-14 07:35:54

pocmatos
2020-9-14 07:36:01

This is with AFL++.


pocmatos
2020-9-14 07:36:20

I think with a targetted libfuzzer it should be much quicker but I didn’t get there yet.


pocmatos
2020-9-14 07:36:50

This is one of the paths of course - finding crashes and security bugs.


pocmatos
2020-9-14 07:37:25

The other path to fuzzing is through fuzzing to find semantic differences between the current version and an oracle and we could use XSmith for that.


pocmatos
2020-9-14 07:38:50

I note now that the executions / sec went further down. :disappointed: ~5 which is embarassingly low. Last path found was 5 hrs ago… We won’t go very far like this I think.


pocmatos
2020-9-14 07:39:18

Anyway, this is just preliminary experiments, I will be working on this for a while.


samth
2020-9-14 12:56:27

Here are the fuzzing experiments I know about: 1. I did what @pocmatos is trying once, with a similar lack of success 2. @willghatch is using XSmith to fuzz Racket CS vs BC 3. https://github.com/racket/racket/blob/master/pkgs/racket-test/tests/racket/stress/fuzz.rkt (also by me) which found a lot of bytecode parsing bugs back in the day. I should make it work for Racket CS.


samth
2020-9-14 12:57:24

@pocmatos I don’t know what command you’re using, but if you run something like `racket -I racket/kernel/init -f “file” then it will start a lot faster.


samth
2020-9-14 12:57:50

the other thing is to add the appropriate fork so that AFL can avoid the startup time.


samth
2020-9-14 12:59:07

@sorawee what happened in that run is make failed (http://drdr.racket-lang.org/55400/pkg-src/build/make) so nothing got built so the raco test command didn’t exist


pocmatos
2020-9-14 13:12:07

As mentioned this was very preliminary. Didn’t know about racket -I racket/kernel/init -f "file". I was using racket -t .... What’s the difference between these? I assume that if your command line doesn’t load the whole racket/base then I cannot run programs require it, right?


pocmatos
2020-9-14 13:12:20

I know about @willghatch work and hope to integrate that into CI as well.


pocmatos
2020-9-14 13:12:34

Didn’t know about your fuzz.rkt Will take a look into it as well.


pocmatos
2020-9-14 13:12:46

What do you mean about adding the appropriate fork?


samth
2020-9-14 13:15:04

racket -t will work fine, but if you start with racket/base then it will be slow to start


samth
2020-9-14 13:15:17

i recommend using only the kernel if possible


samth
2020-9-14 13:15:32

that’s also not loading modules; it’s calling load



pocmatos
2020-9-14 13:42:46

Thanks @samth I will take a look.


pocmatos
2020-9-14 18:15:13

@samth what’s available in racket/kernel/init? do we have documentation on that?



pocmatos
2020-9-14 18:17:17

interesting.


pocmatos
2020-9-14 18:17:55

so i guess if i fully expand a program, i can then run it in racket/kernel/init? the idea being finding programs that I can use as initial seeds for fuzzing.


samth
2020-9-14 18:18:14

basically nothing is available, but yeah full expansion and then use that


samth
2020-9-14 18:18:27

if you want to write modules, then #lang racket/kernel will work


samth
2020-9-14 18:18:41

the /init is only there to enable the repl/top-level


pocmatos
2020-9-14 18:19:48

but then i need to figure out which forms are available in racket/kernel.


pocmatos
2020-9-14 18:20:37

as an idea, do you know if i can use xsmith @willghatch to generate random programs that are valid under racket/kernel and I can then use as seeds for fuzzing?



pocmatos
2020-9-14 18:22:51

yeah maybe it works…


pocmatos
2020-9-14 18:23:25

keen to see how many executions I can get per second with this.


pocmatos
2020-9-14 18:23:39

but i am late on RN so not today…