Skip to content

[RFC] Introducing Lua support to OSS-Fuzz via luzer #13782

@ligurio

Description

@ligurio

I'm an active contributor in OSS Fuzz (https://github.com/google/oss-fuzz/graphs/contributors), I'm maintaining PUC Rio Lua and Tarantool integrations in OSS Fuzz for the last three years, and we found a lot of bugs in PUC Rio and LuaJIT, see trophies. We do fuzzing via Lua C API and also via Lua API and luzer help us with this. Lua is not popular language (see a position in ratings: TIOBE - 31 1, PYPL PopularitY of Programming Language - 19 2, IEEE Spectrum - 34 3, "Fastest growing language" in 2022 4, StackOverflow - 23), but Lua language quite often is embedded to C/C++ projects for programming business logic (see 5 and 6). Fuzzing these projects via Lua API will allow finding additional issues. Also, luzer can help with fuzzing native extensions like cmsgpack implemented in Lua C API, because fuzzing such extensions as a C code is not straightforward.

I'm creating this issue to discuss the details of adding Lua language support to OSS-Fuzz. The goal is to incorporate Lua support into OSS-Fuzz via luzer, a Lua fuzzer that has been developed by me. You can read about luzer in the blog post Introducing luzer, a coverage-guided Lua fuzzer.

Please note that we already use luzer locally:

I will focus on those concerns below first, as the rest will be easier to discuss once we create a PR with the complete code.

Installing Lua

luzer requires at least version Lua 5.1, meaning we can use any version available in popular Linux distributives. As it stands, we are installing Lua library and headers and then Lua within it in the base-builder (it's also required later in the base-runner, so it needs to be copied there).

Does that sound acceptable to you?

Do you have any specific preferences?

Building a project

I'm seeking the most efficient method to transfer a project from the build environment to the execution environment, potentially necessitating a custom directory for building. If you have prior experience with this, I would appreciate your insights on its usage. Additionally, if you have suggestions on how to compile in the build location and relocate the project to the execution docker environment, I would like to hear them. This implementation will likely be similar to the Python + Atheris OSS-Fuzz language support, so I may draw inspiration from there.

Overall

If you’d like to have a more concrete discussion, I can finish a Proof of Concept and create a pull request so we will discuss implementation details while reviewing the current implementation. I would greatly value your feedback and expertise while we work on the final implementation - I believe the remainder of my implementation is fairly straightforward. If you have any general questions or suggestions, I'm more than happy to answer them.

References

Footnotes

  1. https://www.tiobe.com/tiobe-index/

  2. https://pypl.github.io/PYPL.html

  3. https://spectrum.ieee.org/top-programming-languages-2022

  4. https://octoverse.github.com/2022/top-programming-languages

  5. https://www.lua.org/about.html

  6. https://en.wikipedia.org/wiki/Category:Lua_(programming_language)-scriptable_software

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