Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Random weight and favored #6

Open
wants to merge 25 commits into
base: master
Choose a base branch
from

Conversation

jiradeto
Copy link
Collaborator

This PR is basically a combination of random favored idea #4 and weight random selection #5.

jiradeto added 3 commits July 19, 2021 08:15
Squashed commit of the following:

commit e5c1aae
Author: Jiradet Ounjai <[email protected]>
Date:   Tue Jun 29 18:24:04 2021 +0700

    fixed incorrect exec_per_sec formula

commit 6c87212
Author: Jiradet Ounjai <[email protected]>
Date:   Tue Jun 29 00:46:24 2021 +0700

    implemented boost_fast_seqs

commit 2bdcd30
Author: Jiradet Ounjai <[email protected]>
Date:   Tue Jun 22 17:40:13 2021 +0700

    address PR feedback

commit f043b57
Author: Jiradet Ounjai <[email protected]>
Date:   Tue Jun 22 13:56:29 2021 +0700

    record the actual number of fuzz

commit 50a865d
Author: Jiradet Ounjai <[email protected]>
Date:   Tue Jun 22 00:05:30 2021 +0700

    enable boost and throuttle inputs

commit 2ecdb45
Author: Jiradet Ounjai <[email protected]>
Date:   Thu Jun 17 18:06:22 2021 +0700

    assign weighed random to each seed

commit c757066
Author: Jiradet Ounjai <[email protected]>
Date:   Thu Jun 17 16:45:37 2021 +0700

    random double in interval 0.0-1.0

commit 0069e15
Author: Jiradet Ounjai <[email protected]>
Date:   Thu Jun 17 14:16:30 2021 +0700

    new way to initialize minimum rand

commit 454f30d
Author: Jiradet Ounjai <[email protected]>
Date:   Thu Jun 10 15:51:26 2021 +0700

    add missing header

commit 1ec660d
Author: Jiradet Ounjai <[email protected]>
Date:   Wed Jun 9 22:55:57 2021 +0700

    random uniformly the favored seeds
Squashed commit of the following:

commit e5c1aae
Author: Jiradet Ounjai <[email protected]>
Date:   Tue Jun 29 18:24:04 2021 +0700

    fixed incorrect exec_per_sec formula

commit 6c87212
Author: Jiradet Ounjai <[email protected]>
Date:   Tue Jun 29 00:46:24 2021 +0700

    implemented boost_fast_seqs

commit 2bdcd30
Author: Jiradet Ounjai <[email protected]>
Date:   Tue Jun 22 17:40:13 2021 +0700

    address PR feedback

commit f043b57
Author: Jiradet Ounjai <[email protected]>
Date:   Tue Jun 22 13:56:29 2021 +0700

    record the actual number of fuzz

commit 50a865d
Author: Jiradet Ounjai <[email protected]>
Date:   Tue Jun 22 00:05:30 2021 +0700

    enable boost and throuttle inputs

commit 2ecdb45
Author: Jiradet Ounjai <[email protected]>
Date:   Thu Jun 17 18:06:22 2021 +0700

    assign weighed random to each seed

commit c757066
Author: Jiradet Ounjai <[email protected]>
Date:   Thu Jun 17 16:45:37 2021 +0700

    random double in interval 0.0-1.0

commit 0069e15
Author: Jiradet Ounjai <[email protected]>
Date:   Thu Jun 17 14:16:30 2021 +0700

    new way to initialize minimum rand

commit 454f30d
Author: Jiradet Ounjai <[email protected]>
Date:   Thu Jun 10 15:51:26 2021 +0700

    add missing header

commit 1ec660d
Author: Jiradet Ounjai <[email protected]>
Date:   Wed Jun 9 22:55:57 2021 +0700

    random uniformly the favored seeds
@jiradeto
Copy link
Collaborator Author

jiradeto commented Jul 19, 2021

I am setting up the fuzzbench experiment with the following fuzzers.

  1. vanilla AFL
  2. the latest setting of the random favored PR (increase_boost_inputs && base_weight_fac == 4.0 && max_weight_fac_decr == 3.75)
  3. combination of random favored and weight random selection (this PR with the customzed values same as fuzzer no.2 — increase_boost_inputs && base_weight_fac == 4.0 && max_weight_fac_decr == 3.75)
  4. combination of random favored and weight random selection (this PR with default parameters)

@wuestholz, could you please help to confirm that I have correct fuzzers for the evaluation?

@wuestholz
Copy link

@jiradeto Thanks! This will be a local experiment, right?

Did you already run an experiment to compare increase_boost_inputs with new_increase_boost_fast_seqs (from #4 (comment))? If not we should also include just the increase_boost_inputs configuration.

@jiradeto
Copy link
Collaborator Author

jiradeto commented Jul 19, 2021

@jiradeto Thanks! This will be a local experiment, right?

@wuestholz, yes I mean the local experiment.

So, based on your your comment in another PR (#4 (comment)), I assume the current setting means the default value of increase_boost_inputs which is:

default && max_weight_fac_incr == 15.0

If this is the case, I will run local fuzzbench with the following fuzzers:

  1. vanilla AFL
  2. the increase_boost_inputs setting of the random favored PR (max_weight_fac_incr == 15.0)
  3. combination of random favored and weight random selection (this PR with max_weight_fac_incr == 15.0)
  4. combination of random favored and weight random selection (this PR with default parameters)

Could you please tell me if I am missing something?

@wuestholz
Copy link

@jiradeto Great! Thanks!

I think we don't need the fourth configuration.

Could you please also update this PR to make 15.0 the default value?

@wuestholz
Copy link

wuestholz commented Jul 21, 2021

Let's add the following flags:

  • DISABLE_WRS: disables weighted random selection
  • DISABLE_RF: disables random favorites
  • ENABLE_UF: enables uniformly random favorites (i.e., weight always 1)
  • DISABLE_FAVS: disables favorites by considering every seed to be a favorite

- add flag to toggle weighted rando selection
@jiradeto
Copy link
Collaborator Author

jiradeto commented Jul 22, 2021

  • DISABLE_RF: disables random favorites

@wuestholz, does this mean that we disable both random weighted selection (PR #5) and uniformly random favorites (PR #4)?

@wuestholz
Copy link

  • DISABLE_RF: disables random favorites

@wuestholz, does this mean that we disable both random weighted selection (PR #5) and uniformly random favorites (PR #4)?

@jiradeto No, just uniformly random favorites (PR #4).

@jiradeto
Copy link
Collaborator Author

jiradeto commented Jul 22, 2021

  • DISABLE_RF: disables random favorites

@wuestholz, does this mean that we disable both random weighted selection (PR #5) and uniformly random favorites (PR #4)?

@jiradeto No, just uniformly random favorites (PR #4).

@wuestholz OK, that makes sense.

But I am unsure when to use ENABLE_UF since the default weight is already set to 1.0 and untouched if additional parameters enable_throttle_inputs, enable_boost_fast_seqs, enable_boost_inputs are not enabled.

@wuestholz
Copy link

  • DISABLE_RF: disables random favorites

@wuestholz, does this mean that we disable both random weighted selection (PR #5) and uniformly random favorites (PR #4)?

@jiradeto No, just uniformly random favorites (PR #4).

@wuestholz OK, that makes sense.

But I am unsure when to use ENABLE_UF since the default weight is already set to 1.0 and untouched if additional parameters enable_throttle_inputs, enable_boost_fast_seqs, enable_boost_inputs are not enabled.

@jiradeto I see. I suggest we replace enable_throttle_inputs, enable_boost_fast_seqs, and enable_boost_inputs with a single flag ENABLE_UF. When it is not set we will use enable_boost_fast_seqs and enable_boost_inputs.

We can probably remove the enable_throttle_inputs flag and the corresponding code.

afl-fuzz.c Outdated Show resolved Hide resolved
@wuestholz
Copy link

wuestholz commented Jul 23, 2021

@jiradeto Great! Thanks for the latest changes. There's only a small typo I noticed. I think we could try to set up a fuzzbench experiment with the following fuzzers:

  1. afl (vanilla AFL)
  2. afl_no_favs: DISABLE_WRS && DISABLE_RF && !ENABLE_UF && DISABLE_FAVS
  3. afl_wrs_rf: !DISABLE_WRS && !DISABLE_RF && !ENABLE_UF && !DISABLE_FAVS
  4. afl_rf: DISABLE_WRS && !DISABLE_RF && !ENABLE_UF && !DISABLE_FAVS
  5. afl_rf_u: DISABLE_WRS && !DISABLE_RF && ENABLE_UF && !DISABLE_FAVS
  6. afl_wrs: !DISABLE_WRS && DISABLE_RF && !ENABLE_UF && !DISABLE_FAVS

Can you think of another setup that would be interesting?

@jiradeto
Copy link
Collaborator Author

jiradeto commented Jul 23, 2021

@wuestholz. Thanks for your recommendation! May be we could also try with the following setting:

  1. afl_rf_u_wrs: !DISABLE_WRS && !DISABLE_RF && ENABLE_UF && !DISABLE_FAVS

BTW, you mean the local fuzzbench experiment or the public one?

@wuestholz
Copy link

wuestholz commented Jul 23, 2021

@jiradeto Sure, why not. :) Thanks!

I was thinking a public one.

@jiradeto
Copy link
Collaborator Author

@wuestholz, I feel that I'd rather at least have a local experiment result before I can go with the public one. Maybe we should start with the local experiment to see whether the above configurations behave properly?

@wuestholz
Copy link

@jiradeto Sure, that's also fine with me. 👍

@wuestholz
Copy link

@jiradeto As discussed, I would first do the following:

  1. close [WIP] Increment probability over time for random params #8
  2. merge [WIP] Assign probability for random params per seed #9
  3. merge [WIP] Randomize fuzzing params with prob #7
  4. close [WIP] No favorites #3, [WIP] Random favorites #4, and [WIP] Weighted random seed selection #5

Afterwards, it would be great if you could run a local experiment that compares the following:

  1. afl (vanilla AFL)
  2. afl_wrs_rf: !DISABLE_WRS && !DISABLE_RF && !ENABLE_UF && !DISABLE_FAVS && DISABLE_RP
  3. afl_wrs_rf_u: !DISABLE_WRS && !DISABLE_RF && ENABLE_UF && !DISABLE_FAVS && DISABLE_RP
  4. afl_wrs_rf_t: !DISABLE_WRS && !DISABLE_RF && !ENABLE_UF && !DISABLE_FAVS && DISABLE_RP && changes below

The changes for the last configuration are:

      if (!enable_uniformly_random_favorites) {
        // enable_boost_inputs
        double base_weight_fac_boost_inputs = 1.0;
        double max_weight_fac_incr = 7.0;
        double scale_fac_boost_inputs = 0.001;
        double num_selections = (double)q->num_fuzzed;
        weight *= base_weight_fac_boost_inputs + max_weight_fac_incr / (scale_fac_boost_inputs * num_selections + 1.0);

        // enable_boost_fast_seqs
        double base_weight_fac_boost_fast = 8.0;
        double max_weight_fac_decr = 7.0;
        double scale_fac_boost_fast = 0.005;
        double execs_per_sec = 1000000.0 / (double) q->exec_us;
        weight *= base_weight_fac_boost_fast - max_weight_fac_decr / (scale_fac_boost_fast*execs_per_sec + 1.0);
      }

…_seed

[WIP] Assign probability for random params per seed
[WIP] Randomize fuzzing params with prob
This was referenced Aug 12, 2021
@jiradeto
Copy link
Collaborator Author

@wuestholz thank you for your detailed guidance. The fuzzbench evaluation for the changes you requested is available and can access using the following links:

@wuestholz
Copy link

@jiradeto Thanks a lot! Looks like it's slightly better. If you agree I suggest we update the code.

afl-fuzz.c Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants