Skip to content

Lua Stack Corruption leads to x86 stack overflow #441

Description

@lionkor

Fill out general information
OS (windows, linux, ...): Linux, Debian 12
BeamMP-Server Version: v3.8.5, v3.9.0

Describe the bug
This bug occurred in CaRP.

I debugged the core dump, and essentially the bug is that the stack is in an unexpected state (either due to a threading-related data race, or because it's empty), and then some call across the C++-Lua boundary somewhere panics. This causes the LuaAPI::PanicHandler to be called, which in turn tries to access the stack. This panics Lua, calling the PanicHandler, and so on.

This eventually exhausts the (real) stack of the machine and crashes the server.

The same crash is reproducible with the reproduction steps below, but the CaRP codebase does NOT contain that code. The error is likely different, even though this reproduction might help fix the symptom.

I would carefully suggest running the server with some sanitizers like TSAN or valgrind in production.

To Reproduce
Steps to reproduce similar behavior:

  1. Make a Lua plugin with the content error(nil)
  2. Run the server

Expected behavior
A panic log and the server continues to run as usual, just without the errored plugin.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinghelp wantedExternal contribution(s) appreciated

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions