Skip to content

Commit

Permalink
Clear the busy flag if GetEvergreenInfo() fails (#4461)
Browse files Browse the repository at this point in the history
With a crosstool evergreen build, GetEvergreenInfo() is called before
SetEvergreenInfo() because of the early call to SbLogRawDumpStack(3) to
work around b/151118284. GetEvergreenInfo() doesn't currently release
the g_busy flag after it finds invalid g_evergreen_info, and this
prevents SetEvergreenInfo() from acquiring it later.

b/369808307

Change-Id: Ibcfe894cf3c29be90d731a0fb934690df5b0e89a
  • Loading branch information
hlwarriner authored Dec 3, 2024
1 parent 4c9a213 commit 148eac2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions starboard/elf_loader/evergreen_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <string.h>

#include "starboard/atomic.h"
#include "starboard/common/log.h"

static EvergreenInfo g_evergreen_info;
static bool g_valid_info = false;
Expand All @@ -28,6 +29,7 @@ bool SetEvergreenInfo(const EvergreenInfo* evergreen_info) {
// Bailing out is OK as the process crashed
// before we launched the application and in that
// case the evergreen information is not needed.
SB_LOG(ERROR) << "SetEvergreenInfo() failed to set the busy flag, bailing";
return false;
}
if (evergreen_info != NULL && evergreen_info->base_address != 0 &&
Expand Down Expand Up @@ -58,6 +60,10 @@ bool GetEvergreenInfo(EvergreenInfo* evergreen_info) {
// Make sure all memory changes are visible to the current thread.
SbAtomicMemoryBarrier();
if (!g_valid_info) {
SB_LOG(ERROR) << "g_evergreen_info not yet set";

// Clear the busy flag.
SbAtomicNoBarrier_CompareAndSwap(&g_busy, 1, 0);
return false;
}

Expand Down

0 comments on commit 148eac2

Please sign in to comment.