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

in_syslog: Fix double free when no parser is set #8976

Merged
merged 1 commit into from
Jul 8, 2024

Conversation

belzerus
Copy link

When running syslog example:
bin/fluent-bit -i syslog -o stdout -f 1

if no parser is set we get a double-free:

  [2024/06/18 15:36:32] [ info] [fluent bit] version=3.1.0, commit=2bef95819e, pid=144050
  [2024/06/18 15:36:32] [ info] [storage] ver=1.5.2, type=memory, sync=normal, checksum=off, m  ax_chunks_up=128
  [2024/06/18 15:36:32] [ info] [cmetrics] version=0.9.1
  [2024/06/18 15:36:32] [ info] [ctraces ] version=0.5.1
  free(): double free detected in tcache 2
  [2024/06/18 15:36:32] [ info] [input:syslog:syslog.0] initializing
  zsh: IOT instruction  bin/fluent-bit -i syslog -o stdout -f 1

Remove the redundent flb_log_event_encoder_destroy, since that is already done in syslog_conf_destroy.


Enter [N/A] in the box, if an item is not applicable to your change.

Testing
Before we can approve your change; please submit the following in a comment:

  • Example configuration file for the change
    bin/fluent-bit -i syslog -o stdout -f 1
  • Debug log output from testing the change

"parser not set" is displayed.

[2024/06/18 15:53:08] [ info] [fluent bit] version=3.1.0, commit=2bef95819e, pid=145607
[2024/06/18 15:53:08] [ info] [storage] ver=1.5.2, type=memory, sync=normal, checksum=off, max_chunks_up=128
[2024/06/18 15:53:08] [ info] [cmetrics] version=0.9.1
[2024/06/18 15:53:08] [ info] [ctraces ] version=0.5.1
[2024/06/18 15:53:08] [ info] [input:syslog:syslog.0] initializing
[2024/06/18 15:53:08] [ info] [input:syslog:syslog.0] storage_strategy='memory' (memory only)
[2024/06/18 15:53:08] [error] [in_syslog] parser not set
[2024/06/18 15:53:08] [error] [input:syslog:syslog.0] could not initialize plugin
[2024/06/18 15:53:08] [error] failed initialize input syslog.0
[2024/06/18 15:53:08] [error] [engine] input initialization failed
  • Attached Valgrind output that shows no leaks or memory corruption was found

Same output as before this fix, when running valgrind.

If this is a change to packaging of containers or native binaries then please confirm it works for all targets.

  • [N/A] Run local packaging test showing all targets (including any new ones) build.
  • [N/A] Set ok-package-test label to test for all targets (requires maintainer to do).

Documentation

  • [N/A] Documentation required for this feature

Backporting

  • Backport to latest stable release.

Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.

When running syslog example:
 `bin/fluent-bit -i syslog -o stdout -f 1`

 if no parser is set we get a double-free:

```
  [2024/06/18 15:36:32] [ info] [fluent bit] version=3.1.0, commit=2bef95819e, pid=144050
  [2024/06/18 15:36:32] [ info] [storage] ver=1.5.2, type=memory, sync=normal, checksum=off, m  ax_chunks_up=128
  [2024/06/18 15:36:32] [ info] [cmetrics] version=0.9.1
  [2024/06/18 15:36:32] [ info] [ctraces ] version=0.5.1
  free(): double free detected in tcache 2
  [2024/06/18 15:36:32] [ info] [input:syslog:syslog.0] initializing
  zsh: IOT instruction  bin/fluent-bit -i syslog -o stdout -f 1
```

Remove the redundent flb_log_event_encoder_destroy, since that is
already done in syslog_conf_destroy.

Signed-off-by: Petter Mabacker <petter.mabacker@esab.se>
Copy link
Contributor

@pwhelan pwhelan left a comment

Choose a reason for hiding this comment

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

LGTM

@edsiper edsiper merged commit a9a978c into fluent:master Jul 8, 2024
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants