Overview

Medium
Severity
—
CVSS
No
Exploited ITW
Fixed
Fix Status
ImpactUse after free in Performance
DescriptionUse after free in Performance
ComponentPerformance
Sub-componentProfiler
Bug ClassUAF
Tracker561926123
Fix commit549d3c92d6ee (v8/v8) +11/-2
CISA KEVNot listed
CreditedGoogle
Disclosed2026-10-20

Changed Functions

FunctionChangeNotes
TEST_F
test/unittests/flags/flag-definitions-unittest.cc
modified

Files Changed

  • test/unittests/flags/flag-definitions-unittest.cc
  • src/flags/flag-definitions.h
  • src/profiler/cpu-profiler.cc
From 549d3c92d6ee6a45176d26184b772e5233450706 Mon Sep 17 00:00:00 2001
From: Simon Zünd <[email protected]>
Date: Thu, 17 Sep 2026 05:36:52 +0000
Subject: [PATCH] [profiler] Reject negative --cpu-profiler-sampling-interval values

Change cpu_profiler_sampling_interval from DEFINE_INT to DEFINE_UINT so
negative values passed on the command line are rejected by
TryParseUnsigned and the default sampling interval (1000us) is preserved
instead of triggering a DCHECK in CpuProfile::CheckSubsample.

Also add a DCHECK_GE in CpuProfiler::set_sampling_interval to catch any
internal callers passing negative TimeDeltas.

TAG=agy
CONV=3fcd8b38-1a75-4f2a-b6f0-de9220fcc36a

Fixed: 561926123
Change-Id: If536c94c0f652f7931605ac8dfe2f3542762e4ea
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8423899
Reviewed-by: Camillo Bruni <[email protected]>
Commit-Queue: Simon Zünd <[email protected]>
Cr-Commit-Position: refs/heads/main@{#109923}
---
diff --git a/src/flags/flag-definitions.h b/src/flags/flag-definitions.h
index 6150a19..547b857 100644
--- a/src/flags/flag-definitions.h
+++ b/src/flags/flag-definitions.h
@@ -3190,8 +3190,8 @@
 DEFINE_IMPLICATION(parallel_compile_tasks_for_lazy, lazy_compile_dispatcher)
 
 // cpu-profiler.cc
-DEFINE_INT(cpu_profiler_sampling_interval, 1000,
-           "CPU profiler sampling interval in microseconds")
+DEFINE_UINT(cpu_profiler_sampling_interval, 1000,
+            "CPU profiler sampling interval in microseconds")
 
 // debugger
 DEFINE_BOOL(simulator_debugger, false,
diff --git a/src/profiler/cpu-profiler.cc b/src/profiler/cpu-profiler.cc
index 5c3955f..0204463 100644
--- a/src/profiler/cpu-profiler.cc
+++ b/src/profiler/cpu-profiler.cc
@@ -570,6 +570,7 @@
 
 void CpuProfiler::set_sampling_interval(base::TimeDelta value) {
   DCHECK(!is_profiling_);
+  DCHECK_GE(value, base::TimeDelta());
   base_sampling_interval_ = value;
 }
 
diff --git a/test/unittests/flags/flag-definitions-unittest.cc b/test/unittests/flags/flag-definitions-unittest.cc
index 2e06620..bfafc52 100644
--- a/test/unittests/flags/flag-definitions-unittest.cc
+++ b/test/unittests/flags/flag-definitions-unittest.cc
@@ -173,6 +173,14 @@
   CHECK_EQ(0, FlagList::SetFlagsFromString(str, strlen(str)));
 }
 
+TEST_F(FlagDefinitionsTest, RejectNegativeUnsignedFlagAndKeepDefault) {
+  int argc = 2;
+  const char* argv[] = {"Test", "--cpu-profiler-sampling-interval=-100"};
+  CHECK_EQ(1, FlagList::SetFlagsFromCommandLine(&argc, const_cast<char**>(argv),
+                                                true));
+  CHECK_EQ(1000u, v8_flags.cpu_profiler_sampling_interval.value());
+}
+
 TEST_F(FlagDefinitionsTest, FlagsRemoveIncomplete) {
   // Test that processed command line arguments are removed, even
   // if the list of arguments ends unexpectedly.
Loading diff…

Regression Test / PoC

shipped with the fix
diff --git a/test/unittests/flags/flag-definitions-unittest.cc b/test/unittests/flags/flag-definitions-unittest.cc
index 2e06620..bfafc52 100644
--- a/test/unittests/flags/flag-definitions-unittest.cc
+++ b/test/unittests/flags/flag-definitions-unittest.cc
@@ -173,6 +173,14 @@
   CHECK_EQ(0, FlagList::SetFlagsFromString(str, strlen(str)));
 }
 
+TEST_F(FlagDefinitionsTest, RejectNegativeUnsignedFlagAndKeepDefault) {
+  int argc = 2;
+  const char* argv[] = {"Test", "--cpu-profiler-sampling-interval=-100"};
+  CHECK_EQ(1, FlagList::SetFlagsFromCommandLine(&argc, const_cast<char**>(argv),
+                                                true));
+  CHECK_EQ(1000u, v8_flags.cpu_profiler_sampling_interval.value());
+}
+
 TEST_F(FlagDefinitionsTest, FlagsRemoveIncomplete) {
   // Test that processed command line arguments are removed, even
   // if the list of arguments ends unexpectedly.
Loading diff…

Original Bug Report

reported by [email protected]

DCHECK failure in source_sampling_interval >= base::TimeDelta() in profile-generator.cc

Detailed Report: https://clusterfuzz.com/testcase?key=5475144105492480

Fuzzer: big_sleep Job Type: linux_asan_d8_bigsleep_dbg Platform Id: linux

Crash Type: DCHECK failure Crash Address: Crash State: source_sampling_interval >= base::TimeDelta() in profile-generator.cc v8::internal::CpuProfile::CheckSubsample v8::internal::CpuProfile::AddPath

Sanitizer: address (ASAN)

Crash Revision: https://clusterfuzz.com/revisions?job=linux_asan_d8_bigsleep_dbg&revision=109797

Reproducer Testcase: https://clusterfuzz.com/download?testcase_id=5475144105492480

Issue filed automatically.

To reproduce this, please build the target in this report and run it against the reproducer testcase. Please use the GN arguments provided at bottom of this report when building the binary.

If you have trouble reproducing, please also export the environment variables listed under “[Environment]” in the crash stacktrace.

If you have any feedback on reproducing test cases, let us know at https://forms.gle/Yh3qCYFveHj6E5jz5 so we can improve.

View on issue tracker