Skip to content

Take a mutex before accessing the l_ApiScriptFrames#10675

Merged
julianbrost merged 1 commit intoIcinga:masterfrom
WuerthPhoenix:10674-race-condition-use-after-free-on-http-console
Mar 3, 2026
Merged

Take a mutex before accessing the l_ApiScriptFrames#10675
julianbrost merged 1 commit intoIcinga:masterfrom
WuerthPhoenix:10674-race-condition-use-after-free-on-http-console

Conversation

@w1ll-i-code
Copy link
Copy Markdown
Contributor

Take a mutex to avoid race conditions in the map that lead to segmentation faults. Move the ApiScriptFrame object back behind a shared pointer to avoid holding the mutex for too long.

Fixes #10674

@cla-bot cla-bot Bot added the cla/signed label Dec 12, 2025
Copy link
Copy Markdown
Member

@julianbrost julianbrost left a comment

Choose a reason for hiding this comment

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

First of all: good catch and thanks for bringing this up.

Comment thread lib/remote/consolehandler.cpp Outdated
Comment thread lib/remote/consolehandler.cpp Outdated
Comment thread lib/remote/consolehandler.cpp Outdated
Comment thread lib/remote/consolehandler.cpp
@w1ll-i-code w1ll-i-code force-pushed the 10674-race-condition-use-after-free-on-http-console branch from 54e3b15 to d126cfa Compare December 16, 2025 09:03
@julianbrost julianbrost added bug Something isn't working area/api REST API core/crash Shouldn't happen, requires attention labels Dec 18, 2025
@w1ll-i-code
Copy link
Copy Markdown
Contributor Author

@julianbrost understood. Should be good to go now.

@w1ll-i-code w1ll-i-code force-pushed the 10674-race-condition-use-after-free-on-http-console branch 2 times, most recently from 67e81b5 to c716bdd Compare January 5, 2026 09:31
Copy link
Copy Markdown
Member

@julianbrost julianbrost left a comment

Choose a reason for hiding this comment

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

Looking good mostly now, there are just two places that need some minor cleanup. Apart from that, I noticed there's also a race condition if multiple requests are sent in parallel for the same session ID, I'll create a second PR for that one soon.

Comment thread lib/remote/consolehandler.cpp Outdated
Comment thread lib/remote/consolehandler.cpp
@julianbrost julianbrost added the consider backporting Should be considered for inclusion in a bugfix release label Jan 7, 2026
Take a mutex to avoid race conditions in the map that lead to
segmentation faults. Move the ApiScriptFrame object back behind a
shared pointer to avoid holding the mutex for too long.

Fixes Icinga#10674
@w1ll-i-code w1ll-i-code force-pushed the 10674-race-condition-use-after-free-on-http-console branch from c716bdd to 11726b7 Compare February 25, 2026 07:37
@w1ll-i-code
Copy link
Copy Markdown
Contributor Author

@julianbrost I am so sorry. I genuinely thought this PR was already merged and have not look at it since. Fixed your comments and rebased onto master :D

Copy link
Copy Markdown
Member

@julianbrost julianbrost left a comment

Choose a reason for hiding this comment

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

Thank you!

I am so sorry. I genuinely thought this PR was already merged and have not look at it since.

Don't worry, I said to myself that I'll wait for a week or two and otherwise just do that small cleanup myself, and then I forgot about it myself. 😅

@julianbrost julianbrost added this to the 2.16.0 milestone Feb 25, 2026
@julianbrost julianbrost added backport-to-support/2.15 PRs with this label will automatically be backported to the v2.15 support branch. and removed consider backporting Should be considered for inclusion in a bugfix release labels Mar 3, 2026
@julianbrost julianbrost merged commit d78662f into Icinga:master Mar 3, 2026
29 checks passed
@backbot-ci
Copy link
Copy Markdown

backbot-ci Bot commented Mar 3, 2026

Backport failed for support/2.15, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin support/2.15
git worktree add -d .worktree/backport-10675-to-support/2.15 origin/support/2.15
cd .worktree/backport-10675-to-support/2.15
git switch --create backport-10675-to-support/2.15
git cherry-pick -x 11726b741cfbb0813e13193d11b69c2228836bea

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

Labels

area/api REST API backport-to-support/2.15 PRs with this label will automatically be backported to the v2.15 support branch. bug Something isn't working cla/signed core/crash Shouldn't happen, requires attention

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Race-condition / use-after-free on http console endpoints.

2 participants