crashappsec / crashappsec/chalk

integrate libcon4m

Open
#269 0 comments 0 reactions 1 assignee Claimed by @ee7 View on GitHub
Dominant language
Nim
Stars
436
Forks
25
PR merge metrics
No merged PRs in 30d

Description

con4m was rewritten, most importantly to:

- Decrease the chalk startup time
- Supported multi-threaded attribute access

### Current flow

Currently, building chalk execs the `con4m` executable to generate `c4autoconf.nim` for Nim-native data structures and getter procs:

https://github.com/crashappsec/chalk/blob/4157b586e484f12c6b37ee2c68afd5bd5ac330dd/chalk.nimble#L54-L60

Then running chalk:

1. Runs con4m code to load and validate the chalk config (which doesn't change)
1. Uses that environment to load and validate the built-in configs
1. Uses _that_ environment to load and validate any user-supplied config

This also involves flushing the con4m attribute state to the Nim-native data structures a few times, so it stays synced.

### Future flow

libcon4m allows chalk to save and restore runtime state by embedding an object file into the chalk binary, such that chalk can perform only the necessary work that would change per-invocation (like user-supplied config). This should reduce complexity overall in configuration loading - there's no more stacking.

That is, with libcon4m, building chalk should:

1. Run the chalk configuration, generating an object file
1. Embed that object file into chalk

Then running chalk should:

1. Restore the state from the object file
1. Partially process the command-line to find external configs
1. Process those external configs
1. Perform the requested operations

Eventually we may want to allow pre-compiling user-configs for later runs, but that introduces significant complexity for much less important gains.

There are also breaking changes in the language.

Refs: https://github.com/crashappsec/chalk/issues/26
Refs: https://github.com/crashappsec/chalk/issues/214

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.