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

config refactoring #51

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open

config refactoring #51

wants to merge 18 commits into from

Conversation

DLochmelis33
Copy link
Contributor

@DLochmelis33 DLochmelis33 commented Feb 23, 2025

list of changes:

  • remade KFuzzConfig, it now supports a) splitting properties into separate files b) granular editing via builder c) project properties
  • refactored project to use the new config
  • remade gradle plugin DSL to be independent and aligned with gradle docs

@DLochmelis33 DLochmelis33 added the in progress PR is not ready to be reviewed label Feb 23, 2025
@DLochmelis33 DLochmelis33 added ready for review PR is ready to be reviewed and removed in progress PR is not ready to be reviewed labels Feb 24, 2025
Comment on lines +115 to +117
// TODO: we have to know which engine to use before building the config...
// Viable solution for future: build a stub config, check the engine, build a new config.
// Will need to be careful with instantiating delegates, as they will get validated.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't we initialize all of them? I believe that users can have settings for several engines and use one of them by specifying engine field. It might be unclear how to keep API independent on supported engines, but since we directly specify jazzer here it is ok (probably)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what Will need to be careful with instantiating delegates, as they will get validated. means here: if we try to initialize them, but properties are missing, validation will fail. I guess an alternative option is to allow some properties to remain invalid

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If nobody objects, I will leave this as-is for the time being

val keepGoing: Long = KFuzzConfigImpl.Companion.Defaults.KEEP_GOING,
val maxFuzzTime: String = KFuzzConfigImpl.Companion.Defaults.MAX_SINGLE_TARGET_FUZZ_TIME_STRING,
val keepGoing: Long = TargetConfig.Defaults.KEEP_GOING,
val maxFuzzTime: String = TargetConfig.Defaults.MAX_FUZZ_TIME_STRING,
val instrument: Array<String> = [],
val customHookExcludes: Array<String> = [],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe, we should move instrument and customHookExcludes from TargetConfig to GlobalConfig. I can't see reasons to instrument different classes depending on target (we could instrument only the code we execute, but it's a different thing). Same for customHookExcludes: if we want to exclude something, we most likely want to exclude it everywhere

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that I fully agree with that. I think there might be reasons to want to instrument different parts of code for different targets. Because depending on what is instrumented, fuzzer will change its behaviour. So if I want a target to fuzz a specific part of the project, I would want to "communicate" that idea to the fuzzer

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO it makes more sense to have customHookINCLUDES for some targets and others not. But this is again a question about borrowing Jazzer naming. Will remove these two from @KFuzzTest arguments as well


sealed interface EngineConfig

interface JazzerConfig : EngineConfig {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now, JunitEngine doesn't depend on any concerete FuzzEngine. However, here we have JazzerConfig in the API. From my point of view, concerete FuzzEngines should be configured somehow independently from the kotlinx.fuzz in general, since we might want to change them

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I too dislike the fact that all configs have to go into api subproject. That may be possible without ruining the syntax too much, but internal apis like KFuzzProperty will have to be made public and leak outside. In general what we are trying to do here is serialization into properties, and in order to not risk implementing our own kotlinx.serialization, I suggest keeping this as-is


interface JazzerConfig : EngineConfig {
val libFuzzerRssLimitMb: Int
val enableLogging: Boolean
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, we should rework this option

  1. It doesn't "enable logging". It repeats JazzerEngine's log into console
  2. It would be usefull for any FuzzEngine not just for jazzer.

So, consider moving it to global config under name like "detailedConsoleLog"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On that note, I think we borrowed more names from Jazzer and we might want to reconsider them too, for example instrument seems way too unclear for me just from the name

@DLochmelis33
Copy link
Contributor Author

Let's merge this PR before any others, because it conflicts with basically everything and I'm tired of fixing merge conflicts :D

val hooks: Boolean
val logLevel: LogLevel
val regressionEnabled: Boolean
val detailedLogging: Boolean
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on its usage, it is more like "loggingToConsole". We log information in a file anyway, this flag just copies it to the standard output

@FerrumBrain
Copy link
Contributor

Overall, it looks good to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for review PR is ready to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants