llvm / llvm/llvm-project

BOLT: Assertion failed: buffer overflow, function name too large

Open
#169,899 1 comment 0 reactions 0 assignees View on GitHub
BOLT
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Hey team,

I am trying to use BOLT on Redpanda and running into the following crash/assertion:

```
[cluster] - node-1: Assertion failed: buffer overflow, function name too large
[cluster] - node-0: Assertion failed: buffer overflow, function name too large
[cluster] - node-2: Assertion failed: buffer overflow, function name too large
```

Code here: https://github.com/llvm/llvm-project/blob/1ab64e4d5f4a09846c8ab31528a3719a953650f4/bolt/runtime/instr.cpp#L614

This is using instrumented mode, the above is not happening in sampling mode but I assume the same would happen if we were lucky enough to sample the function with the large name.

This is only happening on arm (not sure whether mangling or type-info results in longer names on arm or something).

I see the buffer size is hardcoded to 10KB here: https://github.com/llvm/llvm-project/blob/main/bolt/runtime/common.h#L164

Can this be bumped? Going through blame history I see previously there was a comment acompanying this line which seems to have gotten lost:

> // We use a stack-allocated buffer for string manipulation in many pieces of
> // this code, including the code that prints each line of the fdata file. This
> // buffer needs to accomodate large function names, but shouldn't be arbitrarily
> // large (dynamically allocated) for simplicity of our memory space usage.

So I guess 5xing this or something would still be fine?

Alternatively I am wondering whether the code can be changed to not assert out but rather just drop the specific function from the profile? In all likely hood that one function doesn't make a big difference but in the current implementation the profile will just be cut short and might miss other possibly important functions.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.