[iOS arm64e] Fix base/profiler to work correctly with arm64e [chromium/src : main]

0 views
Skip to first unread message

Justin Novosad (Gerrit)

unread,
Apr 15, 2026, 3:21:04 PM (11 days ago) Apr 15
to android-bu...@system.gserviceaccount.com, Sylvain Defresne, Mark Mentovai, Sean Maher, Dave Tapuska, chromiu...@luci-project-accounts.iam.gserviceaccount.com, chromium...@chromium.org, Thiabaud Engelbrecht, tracing...@chromium.org, wfh+...@chromium.org, spang...@chromium.org, mac-r...@chromium.org
Attention needed from Dave Tapuska, Mark Mentovai, Sean Maher and Sylvain Defresne

Justin Novosad added 5 comments

File base/debug/stack_trace_unittest.cc
Line 7, Patchset 23:#include <ptrauth.h>
Mark Mentovai . resolved

Will this really work unguarded in all environments?

Justin Novosad

As far as I can tell this should be perfectly safe. In ptrauth.h there's an `#else` clause that defines no-op versions of all the intrinsic wrappers whenever ptrauth is not supported. Also, CQ checks pass.

File base/profiler/register_context_registers.h
Line 230, Patchset 23:#if BUILDFLAG(ARCH_CPU_PTRAUTH)
#define __sp __opaque_sp
#define __fp __opaque_fp
#define __pc __opaque_pc
#endif // BUILDFLAG(ARCH_CPU_PTRAUTH)
Mark Mentovai . resolved

I don’t love it: these may already have been `#define`d as macros, and the `#undef` later on undoes that. Double-underscore names really aren’t ours to alter. Can you find a different strategy?

Justin Novosad

Done

Line 106, Patchset 23:#if defined(ARCH_CPU_ARM_FAMILY) && defined(ARCH_CPU_32_BITS)
Mark Mentovai . resolved

These cascades are about CPU type, not CPU family. It’s kind of backwards to tie the CPU family and bitness together to get the CPU type, when we already have `ARCH_CPU_*` macros without the `*_FAMILY` to fit the bill: `ARCH_CPU_ARMEL`, `ARCH_CPU_ARM64`, `ARCH_CPU_X86`, `ARCH_CPU_X86_64`.

Same in other functions.

Justin Novosad

Done

Line 59, Patchset 23:#endif
Mark Mentovai . resolved

```
#else
#error port
```

because these void-returning functions otherwise give no indication that they’re accidental no-ops if not ported to new architectures.

Same in the two other setter functions.

Justin Novosad

This logic is not new to this CL. If I'm reading it correctly there's no risk of accidental no-op here. The final `#else` assumes X86 (32 bit). If that assumption is wrong, compilation will fail because Esp will be undefined. Anyways, explicitly checking for X86 with a fallback that emits an error makes this clearer. Fixed.

Line 244, Patchset 22:#if defined(ARCH_CPU_PTRAUTH)
AsUintPtr(&context->__opaque_sp) = val;
#else // !defined(ARCH_CPU_PTRAUTH)
context->__sp = val;
#endif // !defined(ARCH_CPU_PTRAUTH)
Mark Mentovai . resolved

Same: cane these be simplified? A common function that inserts the __opaque by string pasting in ptrauth mode?

Justin Novosad

By the time I got to addressing this comment, I had already simplified this code in response to Sylvain's comments. I used macros to inject the `opaque` prefix. WDYT?

Justin Novosad

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Dave Tapuska
  • Mark Mentovai
  • Sean Maher
  • Sylvain Defresne
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Icdbf3d8859c5751aa5bac473c71cd0d891216aae
Gerrit-Change-Number: 7708137
Gerrit-PatchSet: 23
Gerrit-Owner: Justin Novosad <ju...@chromium.org>
Gerrit-Reviewer: Dave Tapuska <dtap...@chromium.org>
Gerrit-Reviewer: Justin Novosad <ju...@chromium.org>
Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
Gerrit-Reviewer: Sean Maher <sp...@chromium.org>
Gerrit-Reviewer: Sylvain Defresne <sdef...@chromium.org>
Gerrit-CC: Thiabaud Engelbrecht <thia...@google.com>
Gerrit-Attention: Mark Mentovai <ma...@chromium.org>
Gerrit-Attention: Sylvain Defresne <sdef...@chromium.org>
Gerrit-Attention: Sean Maher <sp...@chromium.org>
Gerrit-Attention: Dave Tapuska <dtap...@chromium.org>
Gerrit-Comment-Date: Wed, 15 Apr 2026 19:20:58 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Mark Mentovai <ma...@chromium.org>
Comment-In-Reply-To: Justin Novosad <ju...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Mark Mentovai (Gerrit)

unread,
Apr 16, 2026, 11:00:25 AM (10 days ago) Apr 16
to Justin Novosad, android-bu...@system.gserviceaccount.com, Sylvain Defresne, Sean Maher, Dave Tapuska, Chromium LUCI CQ, chromium...@chromium.org, Thiabaud Engelbrecht, tracing...@chromium.org, wfh+...@chromium.org, spang...@chromium.org, mac-r...@chromium.org
Attention needed from Dave Tapuska, Justin Novosad and Sylvain Defresne

Mark Mentovai voted and added 1 comment

Votes added by Mark Mentovai

Code-Review+1

1 comment

File base/debug/stack_trace_unittest.cc
Line 7, Patchset 23:#include <ptrauth.h>
Mark Mentovai . resolved

Will this really work unguarded in all environments?

Justin Novosad

As far as I can tell this should be perfectly safe. In ptrauth.h there's an `#else` clause that defines no-op versions of all the intrinsic wrappers whenever ptrauth is not supported. Also, CQ checks pass.

Mark Mentovai

As far as I can tell this should be perfectly safe. In ptrauth.h there's an `#else` clause that defines no-op versions of all the intrinsic wrappers whenever ptrauth is not supported. Also, CQ checks pass.

Ah, Clang always provides its own `<ptrauth.h>`. OK.

I expect this to be a spot that will need further attention in order for this code to build with other toolchains. But as long as our bots like it, it’s fine to kick that can down the road (and to the people who will be affected). We (they) can deal with it when it happens.

Open in Gerrit

Related details

Attention is currently required from:
  • Dave Tapuska
  • Justin Novosad
  • Sylvain Defresne
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Icdbf3d8859c5751aa5bac473c71cd0d891216aae
Gerrit-Change-Number: 7708137
Gerrit-PatchSet: 25
Gerrit-Owner: Justin Novosad <ju...@chromium.org>
Gerrit-Reviewer: Dave Tapuska <dtap...@chromium.org>
Gerrit-Reviewer: Justin Novosad <ju...@chromium.org>
Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
Gerrit-Reviewer: Sean Maher <sp...@chromium.org>
Gerrit-Reviewer: Sylvain Defresne <sdef...@chromium.org>
Gerrit-Attention: Justin Novosad <ju...@chromium.org>
Gerrit-Attention: Sylvain Defresne <sdef...@chromium.org>
Gerrit-Attention: Dave Tapuska <dtap...@chromium.org>
Gerrit-Comment-Date: Thu, 16 Apr 2026 15:00:18 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Justin Novosad <ju...@chromium.org>
Comment-In-Reply-To: Mark Mentovai <ma...@chromium.org>
satisfied_requirement
open
diffy

Justin Novosad (Gerrit)

unread,
Apr 16, 2026, 11:09:28 AM (10 days ago) Apr 16
to Mark Mentovai, android-bu...@system.gserviceaccount.com, Sylvain Defresne, Sean Maher, Dave Tapuska, Chromium LUCI CQ, chromium...@chromium.org, Thiabaud Engelbrecht, tracing...@chromium.org, wfh+...@chromium.org, spang...@chromium.org, mac-r...@chromium.org
Attention needed from Dave Tapuska and Sylvain Defresne

Justin Novosad voted Commit-Queue+2

Commit-Queue+2
Open in Gerrit

Related details

Attention is currently required from:
  • Dave Tapuska
  • Sylvain Defresne
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Icdbf3d8859c5751aa5bac473c71cd0d891216aae
Gerrit-Change-Number: 7708137
Gerrit-PatchSet: 25
Gerrit-Owner: Justin Novosad <ju...@chromium.org>
Gerrit-Reviewer: Dave Tapuska <dtap...@chromium.org>
Gerrit-Reviewer: Justin Novosad <ju...@chromium.org>
Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
Gerrit-Reviewer: Sean Maher <sp...@chromium.org>
Gerrit-Reviewer: Sylvain Defresne <sdef...@chromium.org>
Gerrit-CC: Thiabaud Engelbrecht <thia...@google.com>
Gerrit-Attention: Sylvain Defresne <sdef...@chromium.org>
Gerrit-Attention: Dave Tapuska <dtap...@chromium.org>
Gerrit-Comment-Date: Thu, 16 Apr 2026 15:09:23 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Sylvain Defresne (Gerrit)

unread,
Apr 16, 2026, 11:20:47 AM (10 days ago) Apr 16
to Justin Novosad, Mark Mentovai, android-bu...@system.gserviceaccount.com, Sean Maher, Dave Tapuska, Chromium LUCI CQ, chromium...@chromium.org, Thiabaud Engelbrecht, tracing...@chromium.org, wfh+...@chromium.org, spang...@chromium.org, mac-r...@chromium.org
Attention needed from Dave Tapuska and Justin Novosad

Sylvain Defresne voted and added 1 comment

Votes added by Sylvain Defresne

Code-Review+1

1 comment

Patchset-level comments
File-level comment, Patchset 25 (Latest):
Sylvain Defresne . resolved

lgtm

Open in Gerrit

Related details

Attention is currently required from:
  • Dave Tapuska
  • Justin Novosad
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Icdbf3d8859c5751aa5bac473c71cd0d891216aae
Gerrit-Change-Number: 7708137
Gerrit-PatchSet: 25
Gerrit-Owner: Justin Novosad <ju...@chromium.org>
Gerrit-Reviewer: Dave Tapuska <dtap...@chromium.org>
Gerrit-Reviewer: Justin Novosad <ju...@chromium.org>
Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
Gerrit-Reviewer: Sean Maher <sp...@chromium.org>
Gerrit-Reviewer: Sylvain Defresne <sdef...@chromium.org>
Gerrit-CC: Thiabaud Engelbrecht <thia...@google.com>
Gerrit-Attention: Justin Novosad <ju...@chromium.org>
Gerrit-Attention: Dave Tapuska <dtap...@chromium.org>
Gerrit-Comment-Date: Thu, 16 Apr 2026 15:20:28 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Chromium LUCI CQ (Gerrit)

unread,
Apr 16, 2026, 1:26:42 PM (10 days ago) Apr 16
to Justin Novosad, Sylvain Defresne, Mark Mentovai, android-bu...@system.gserviceaccount.com, Sean Maher, Dave Tapuska, chromium...@chromium.org, Thiabaud Engelbrecht, tracing...@chromium.org, wfh+...@chromium.org, spang...@chromium.org, mac-r...@chromium.org

Chromium LUCI CQ submitted the change

Change information

Commit message:
[iOS arm64e] Fix base/profiler to work correctly with arm64e

With this CL, it is now possible to build base_unittests for arm64e.
Some of the tests still crash due to missing explicit pointer
authentication handling in low level routines and assembly code.

Access to pointer registers in the thread state had to be refactored to
use getter and setter methods (instead of readwrite access via
references) so that opaque pointers can be encoded and decoded correctly
using arm64e pointer authentication.

There are no automated tests that cover the arm64e builds at this
time because the build is not yet functional. However, it is
possible to manually test this CL using the following steps:
* In a Bling checkout, set the target_cpu gn arg to "arm64e" in
a build configuration that is otherwise set up to build for
a physical device (e.g. out/Debug-iphoneos)
* Build the base_unittests target.
Note: much of Chromium won't currently build correctly in arm64e,
but base unittests does, as of this CL. Because rust does not
support arm64e, you will see linker warnings about rust deps being
ignored. This is fine, you will still be able to build and run
the tests and it will still include the unit tests affected by
this CL.
* Run base_unittests on a physical device. To get around tests that
still crash, use the --gtest_filter command line arg to successfully
run the following test cases, which are relevant to this CL:
StackCopierTest, StackCopierSuspendTest, StackBufferTest,
StackTraceTest, StackTraceDeathTest, FramePointerUnwinder,

Low-Coverage-Reason: COVERAGE_UNDERREPORTED The gaps in coverage
signalled by the code coverage checks are in areas of the code that are
specific to certain CPU architectures. These gaps due to a combination
of certain tests being disabled on linux and not all runs of
base_unittests being tracked for code coverage analysis.
Bug: 495838671
Change-Id: Icdbf3d8859c5751aa5bac473c71cd0d891216aae
Commit-Queue: Justin Novosad <ju...@chromium.org>
Reviewed-by: Mark Mentovai <ma...@chromium.org>
Reviewed-by: Sylvain Defresne <sdef...@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1615987}
Files:
  • M base/debug/stack_trace_unittest.cc
  • M base/profiler/chrome_unwinder_android_32.cc
  • M base/profiler/chrome_unwinder_android_32_unittest.cc
  • M base/profiler/frame_pointer_unwinder.cc
  • M base/profiler/frame_pointer_unwinder_unittest.cc
  • M base/profiler/register_context_registers.h
  • M base/profiler/stack_copier.cc
  • M base/profiler/stack_copier.h
  • M base/profiler/stack_copier_signal.cc
  • M base/profiler/stack_copier_signal.h
  • M base/profiler/stack_copier_suspend.cc
  • M base/profiler/stack_copier_suspend.h
  • M base/profiler/stack_copier_suspend_unittest.cc
  • M base/profiler/stack_copier_unittest.cc
  • M base/profiler/stack_sampler_unittest.cc
  • M base/profiler/suspendable_thread_delegate_mac.cc
  • M base/profiler/suspendable_thread_delegate_mac.h
  • M base/profiler/suspendable_thread_delegate_win.cc
  • M base/profiler/suspendable_thread_delegate_win.h
  • M base/profiler/thread_delegate.h
  • M base/profiler/thread_delegate_posix.cc
  • M base/profiler/thread_delegate_posix.h
  • M build/build_config.h
  • M chrome/renderer/v8_unwinder.cc
Change size: L
Delta: 24 files changed, 575 insertions(+), 241 deletions(-)
Branch: refs/heads/main
Submit Requirements:
  • requirement satisfiedCode-Review: +1 by Mark Mentovai, +1 by Sylvain Defresne
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Icdbf3d8859c5751aa5bac473c71cd0d891216aae
Gerrit-Change-Number: 7708137
Gerrit-PatchSet: 26
Gerrit-Owner: Justin Novosad <ju...@chromium.org>
Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
Gerrit-Reviewer: Dave Tapuska <dtap...@chromium.org>
Gerrit-Reviewer: Justin Novosad <ju...@chromium.org>
Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
Gerrit-Reviewer: Sean Maher <sp...@chromium.org>
Gerrit-Reviewer: Sylvain Defresne <sdef...@chromium.org>
open
diffy
satisfied_requirement

luci-bisection@appspot.gserviceaccount.com (Gerrit)

unread,
Apr 16, 2026, 1:38:48 PM (10 days ago) Apr 16
to Justin Novosad, Chromium LUCI CQ, Sylvain Defresne, Mark Mentovai, android-bu...@system.gserviceaccount.com, Sean Maher, Dave Tapuska, chromium...@chromium.org, Thiabaud Engelbrecht, tracing...@chromium.org, wfh+...@chromium.org, spang...@chromium.org, mac-r...@chromium.org

Message from luci-bi...@appspot.gserviceaccount.com

  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Icdbf3d8859c5751aa5bac473c71cd0d891216aae
Gerrit-Change-Number: 7708137
Gerrit-PatchSet: 26
Gerrit-Owner: Justin Novosad <ju...@chromium.org>
Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
Gerrit-Reviewer: Dave Tapuska <dtap...@chromium.org>
Gerrit-Reviewer: Justin Novosad <ju...@chromium.org>
Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
Gerrit-Reviewer: Sean Maher <sp...@chromium.org>
Gerrit-Reviewer: Sylvain Defresne <sdef...@chromium.org>
Gerrit-CC: Thiabaud Engelbrecht <thia...@google.com>
Gerrit-Comment-Date: Thu, 16 Apr 2026 17:38:38 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
satisfied_requirement
open
diffy

Mohannad Farrag (Gerrit)

unread,
Apr 17, 2026, 8:02:48 AM (9 days ago) Apr 17
to Justin Novosad, Chromium LUCI CQ, luci-bi...@appspot.gserviceaccount.com, Sylvain Defresne, Mark Mentovai, android-bu...@system.gserviceaccount.com, Sean Maher, Dave Tapuska, chromium...@chromium.org, Thiabaud Engelbrecht, tracing...@chromium.org, wfh+...@chromium.org, spang...@chromium.org, mac-r...@chromium.org

Mohannad Farrag has created a revert of this change

Related details

Attention set is empty
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: revert
satisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages