Skip to content

dart compile exe fails on macOS versions older than macOS 12 #49783

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

Closed
athomas opened this issue Aug 22, 2022 · 24 comments
Closed

dart compile exe fails on macOS versions older than macOS 12 #49783

athomas opened this issue Aug 22, 2022 · 24 comments
Assignees
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. P2 A bug or feature request we're likely to work on

Comments

@athomas
Copy link
Member

athomas commented Aug 22, 2022

The crash was first noticed here:
https://logs.chromium.org/logs/dart-internal/buildbucket/cr-buildbucket/8805124329898895137/+/u/compile_script/stdout

 Info: Compiling with sound null safety
 ===== CRASH =====
 si_signo=Illegal instruction: 4(4), si_code=2, si_addr=0x1031fd454
 version=2.18.0-271.0.dev (dev) (Sat Jul 9 12:06:18 2022 -0700) on "macos_arm64"
 pid=53165, thread=-1, isolate_group=isolate(0x14481b800), isolate=(nil)(0x0)
 isolate_instructions=0, vm_instructions=0
   pc 0x00000001031fd454 fp 0x000000016cee49f0 std::__2::__call_once(unsigned long volatile&, void*, void (*)(void*))+0xc3cc8
   pc 0x00000001031fa298 fp 0x000000016cee4a70 std::__2::__call_once(unsigned long volatile&, void*, void (*)(void*))+0xc0b0c
   pc 0x00000001031f6fa8 fp 0x000000016cee4b90 std::__2::__call_once(unsigned long volatile&, void*, void (*)(void*))+0xbd81c
   pc 0x00000001031f5f68 fp 0x000000016cee4c30 std::__2::__call_once(unsigned long volatile&, void*, void (*)(void*))+0xbc7dc
   pc 0x00000001031ffb98 fp 0x000000016cee4c80 std::__2::__call_once(unsigned long volatile&, void*, void (*)(void*))+0xc640c
   pc 0x0000000103236c8c fp 0x000000016cee51c0 std::__2::__call_once(unsigned long volatile&, void*, void (*)(void*))+0xfd500
   pc 0x0000000103235d58 fp 0x000000016cee5280 std::__2::__call_once(unsigned long volatile&, void*, void (*)(void*))+0xfc5cc
   pc 0x000000010323637c fp 0x000000016cee52b0 std::__2::__call_once(unsigned long volatile&, void*, void (*)(void*))+0xfcbf0
   pc 0x000000010316eb50 fp 0x000000016cee59b0 std::__2::__call_once(unsigned long volatile&, void*, void (*)(void*))+0x353c4
   pc 0x000000010316f42c fp 0x000000016cee6080 std::__2::__call_once(unsigned long volatile&, void*, void (*)(void*))+0x35ca0
   pc 0x000000010316ac78 fp 0x000000016cee6150 std::__2::__call_once(unsigned long volatile&, void*, void (*)(void*))+0x314ec
   pc 0x0000000103065380 fp 0x000000016cee61b0 Cr_z_armv8_crc32_little+0x10c98c
   pc 0x00000001030650b4 fp 0x000000016cee62f0 Cr_z_armv8_crc32_little+0x10c6c0
   pc 0x000000010315ff68 fp 0x000000016cee6380 std::__2::__call_once(unsigned long volatile&, void*, void (*)(void*))+0x267dc
   pc 0x000000010315e01c fp 0x000000016cee6ae0 std::__2::__call_once(unsigned long volatile&, void*, void (*)(void*))+0x24890
   pc 0x000000010315de10 fp 0x000000016cee6f80 std::__2::__call_once(unsigned long volatile&, void*, void (*)(void*))+0x24684
   pc 0x00000001032cbc0c fp 0x000000016cee70c0 Dart_Precompile+0x138
   pc 0x0000000102f401a0 fp 0x000000016cee7270 std::__2::align(unsigned long, unsigned long, void*&, unsigned long&)+0xa88
   pc 0x0000000199c25430 fp 0x000000016cee7290 start+0x4
 -- End of DumpStackTrace
 === Crash occured when compiling dart:core_StateError_StateError. in AOT mode in AllocateRegisters pass
 *** BEGIN CFG
 AllocateRegisters
 ==== dart:core_StateError_StateError. (Constructor)
   0: B0[graph]:0 {
       v0 <- Constant(#null) T{Null?}
 }
   2: B1[function entry]:2 {
       v2 <- Parameter(0) T{StateError}
       v3 <- Parameter(1) T{String}
 }
   4:     StoreInstanceField(v2 . message = v3)
   6:     Return:12(v0)
 *** END CFG
 Error: AOT compilation failed
 Generating AOT snapshot failed!

The program being compiled was bin/find_base_commit.dart from https://dart.googlesource.com/dart_ci/+/refs/heads/main/builder/.

The crash can also be reproduced with a "Hello World" program.

@athomas athomas added area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. P0 A serious issue requiring immediate resolution release-blocker labels Aug 22, 2022
@athomas
Copy link
Member Author

athomas commented Aug 22, 2022

On the latest beta, this crash doesn't seem to happen, instead we get the same failure as on x64 (see also #49275).
https://logs.chromium.org/logs/dart-internal/buildbucket/cr-buildbucket/8805115124636981169/+/u/compile_script/stdout

@athomas athomas added P1 A high priority bug; for example, a single project is unusable or has many test failures and removed P0 A serious issue requiring immediate resolution release-blocker labels Aug 22, 2022
@a-siva
Copy link
Contributor

a-siva commented Aug 22, 2022

@athomas can you confirm on which beta range you saw the crash (I presume beta 2.18.0-271.7,beta does not exhibit the crash but 2.18.0-271.4.beta exhibits the crash)

@a-siva
Copy link
Contributor

a-siva commented Aug 22, 2022

Also does clang upgrades done in the main branch get carried over to the beta branch too ?

@athomas
Copy link
Member Author

athomas commented Aug 22, 2022

Crash confirmed on 2.18.0-271.0.dev (the branch point).
Crash seems fixed on 2.18.0-271.7.beta (assuming it's not a flaky crash).

Clang updates are changes to DEPS, and don't carry over unless CP'ed or landed before the branch point.

@mkustermann
Copy link
Member

To summarize, there's two issues here

  • There's a crash in our AOT compiler (invocation of gen_snapshot while compiling a function). This crash has disappeared, it may have been fixed. So it's no longer an issue?

  • There's a failure to dart compile exe bin/find_base_commit.dart: This issue isn't reproducible locally (according to @sstrickl), but may still exist on the bots, the failure is

Failed to add a linker signed signature, adding a regular signature instead.
Failed to replace the dartaotruntime signature, subcommand terminated with exit code 1.
Subcommand stderr:
/opt/s/w/ir/x/w/recipe_cleanup/tmpmb2rhhen/find_base_commit: replacing existing signature
/usr/libexec/DeveloperTools/codesign_allocate: object: /opt/s/w/ir/x/w/recipe_cleanup/tmpmb2rhhen/find_base_commit malformed object (offset field of section 0 in LC_SEGMENT command 1 not past the headers of the file)
/opt/s/w/ir/x/w/recipe_cleanup/tmpmb2rhhen/find_base_commit: the codesign_allocate helper tool cannot be found or used

This has been reported in the past (see e.g. #49275, #49326)

@athomas says this issue seems to be a regression in 2.18.

If this happens on our CI, we should be able to bisect the issue on one of the VMs?

@mkustermann
Copy link
Member

/usr/libexec/DeveloperTools/codesign_allocate: object:
... malformed object (offset field of section 0 in LC_SEGMENT command 1 not past the headers of the file

The corresponding code for this error message can be found in llvm/lib/Object/MachOObjectFile.cpp which may be helpful for debuging the issue. /cc @sstrickl

@athomas
Copy link
Member Author

athomas commented Aug 23, 2022

Assuming the crash wasn't flaky, it seems to have disappeared. It only occured on arm64 so we have relatively few datapoints on CI, however it was reproducible locally as well.

The signing issue seems to be tied to macOS version:
https://github.com/athomas/github-actions-playground/runs/7969362964?check_suite_focus=true

@sstrickl
Copy link
Contributor

So looking at the dartaotruntime executable we use to create the merged executable, the toolchain generates it with the first _TEXT load command being at file offset 0, which means that its range includes the headers (hence the error). We just copy that over when creating the merged executable without changing it. The first section within that load command starts at a file offset after the headers. My guess is that at one point that check was done, and then later, if kept in any form, they changed it to check the section offsets instead (and thus the error goes away on later MacOS versions because no section is defined to be located within the headers).

We could try to patch this up as we generate the merged binary, changing the file offset of any load sections with non-zero size that start at an offset in the headers to the file offset of the first section within it, adjusting the vm address, size, and file size of the load command accordingly.

However, if the vm address of a load segment needs to, say, be on a page boundary for mmap reasons, that might be a problem, given that in the example build on my machine, the header ends at 3216 and the first section in that load command starts at 3280 (and there's no page boundary between those two values).

That is, it's a possibly very brittle change that isn't even needed for later MacOS versions that have an updated codesign. So I suppose we need to decide if those MacOS versions need supporting, and if they do, then we could just fall back to the old appended executable way of generating things, which means that those executables couldn't be signed on those MacOS versions. Thoughts?

@a-siva
Copy link
Contributor

a-siva commented Aug 23, 2022

Could you state which MacOS versions would be considered later which have the updated codesign ?
Our website claims we support 10.15, 11 and 12 versions.

Flutter claims to support (12 - google tested) and best effort (10.11 and 11.

@athomas
Copy link
Member Author

athomas commented Aug 23, 2022

dart compile exe only works on macOS 12 in the current release candidate, 10.15, 11 don't work. See the GitHub Actions link I posted earlier for details.

@mkustermann
Copy link
Member

mkustermann commented Aug 24, 2022

So I suppose we need to decide if those MacOS versions need supporting, and if they do, then we could just fall back to the old appended executable way of generating things, which means that those executables couldn't be signed on those MacOS versions. Thoughts?

We support several older MachOS versions, not just the oldest. I don't think we can just drop older version support now.

The ability to sign dart compile exeed binaries was afaik introduced in cl/228080 which was included in 2.17.0 where it worked afaik. So I don't think we need to fall back to append snapshot approach, since it used to work. The regression seems to have been introduced since then.

@sstrickl Is there something I'm overlooking?

So looking at the dartaotruntime executable we use to create the merged executable, the toolchain generates it with the first _TEXT load command being at file offset 0, which means that its range includes the headers (hence the error).

Phrased in another way: Are you saying that the dartaotruntime binary itself - as produced with our toolchain / xcodebuild - already has this problem (i.e. cannot be signed) irrespective of using dart compile exe?

If so, why wasn't this an issue before?

@sstrickl
Copy link
Contributor

Phrased in another way: Are you saying that the dartaotruntime binary itself - as produced with our toolchain / xcodebuild - already has this problem (i.e. cannot be signed) irrespective of using dart compile exe?

If so, why wasn't this an issue before?

Cannot be signed on those MacOS versions. I'd guess that the automated process for signing the SDK uses a version of the codesign utility which doesn't have this issue.

@athomas
Copy link
Member Author

athomas commented Aug 24, 2022

I don't see a change in our signing infra that fits in that timeframe:

On 2022-02-17 we upgrade the signing flow to big sur (but that also affects the 2.17.6 release), then there were changes recently to upgrade it to monterey but that happened after the branchpoint.

@a-siva
Copy link
Contributor

a-siva commented Aug 24, 2022

Since a revert has landed I am going to change the priority of this issue to p2.

@a-siva a-siva added P2 A bug or feature request we're likely to work on and removed P1 A high priority bug; for example, a single project is unusable or has many test failures labels Aug 24, 2022
@sstrickl
Copy link
Contributor

sstrickl commented Aug 25, 2022

Okay, so here's the lowdown of what's behind this and the current plan for the future:

We currently create signable MachO standalone executables by adding a new segment load command with a section pointing to the snapshot data in a copy of the dartaotruntime MachO executable. Notably, currently we add the load command/section to the header in the padding between the header and the first actual post-header data, which avoids having to go through all the header and section data and change offsets for all the contents of the original executable that we're just copying over.

However, this approach assumes there's enough space in the padding between the header and the contents of the MachO executable to put this information. Prior to the clang change above, there was (e.g., the headers ended at offset 3064, and the first content started at offset 17280). Afterwards, there wasn't (e.g., the headers ended at offset 3128, and the first content offset was at 3200). Unfortunately, the current code for adding the new header information doesn't check that the available padding can fit the new information, which is why we didn't get an error when this started happening.

Instead, we saw codesign failures because it did verification checks on the resulting MachO file. Unfortunately, these verification checks seem to only happen when the -f argument to force signature overwriting happens, and we only use that flag as a fallback in MacOS <12 when we can't use the linker-signed option to codesign. Thus, we only saw this error on older MacOS versions, like those used by some of the trybots, which muddled the importance of this failure at the time.

Now that we know what the issue is, we've rolled back clang (which as a side effect restores the extra padding) as a temporary fix to unblock the stable release. The longer term fix is to change our approach to combining the snapshot into the MachO executable.

There are three possibilities I currently have in mind, though really only the first and third should be considered:

  1. Adjust the MachO parsing and editing code in pkg:dart2native to adjust all offsets in the copied version of dartaotruntime appropriately for the addition of the new section, if the padding in the file isn't enough. This means much more parsing of the MachO format than we currently do in pkg:dart2native, and will likely be very brittle when new information is added by future compiler versions/MachO format updates that we don't handle.

  2. Instead of trying to cram the snapshot into a copy of the dartaotruntime MachO executable, create a universal binary where the dartaotruntime executable is used for the appropriate architecture, and add a separate section that just contains the snapshot data directly. Thus, we no longer need MachO parsing/writing in pkg:dart2native or the Dart runtime, but instead MacOS universal binary parsing/writing.

    However, I believe this approach means that only the dartaotruntime will be signed by any uses of codesign, and thus the snapshot data could be replaced wholesale without affecting the signature. Thus, I don't suggest this method.

  3. Combine the two approaches: create a universal binary as suggested, but instead of adding the raw snapshot data as a second section, add a MachO wrapper that can be signed. This means we don't need full MachO parsing or writing in pkg:dart2native or the Dart runtime, just enough to wrap the snapshot and to parse what we output. (We'll still need universal binary parsing/writing, of course, but that's a simple format.) This means verifying the signatures on the universal binary will reveal if someone attempts to replace only the snapshot data.

Thus, my plans are to implement the third approach, after which we can reland the clang changes without concern.

@athomas athomas changed the title dart compile exe crash on macOS arm64 dart compile exe fails on macOS versions older than macOS 12 Aug 25, 2022
@athomas
Copy link
Member Author

athomas commented Aug 25, 2022

We've CP'ed the revert of the clang roll to beta.

The crash that started this issue was investigated by @mraleph and turned out to be an infra issue (the crash occurs if you run dart compile exe with an x64 SDK on rosetta).

We still need a long term solution such as those outlined by @sstrickl

@sstrickl
Copy link
Contributor

I'm also making a quick CL to add a check that we're not overwriting the section contents with the expanded header, so that we'll get proper failures if this case ends up happening again while the long-term solution is being worked on.

@mkustermann
Copy link
Member

/cc @mraleph see suggested fix in #49783 (comment).

@mkustermann
Copy link
Member

@sstrickl Thanks for writing up the issue & solution space!

Adjust the MachO parsing and editing code in pkg:dart2native to adjust all offsets in the copied version of dartaotruntime appropriately for the addition of the new section, if the padding in the file isn't enough. This means much more parsing of the MachO format than we currently do in pkg:dart2native, and will likely be very brittle when new information is added by future compiler versions/MachO format updates that we don't handle.

Do we have good understanding of which parts use file offsets that would need to be modified? (Many things may use offsets into sections and not absolute file offset). It would be good to understand before making the implementation decision.

Instead of trying to cram the snapshot into a copy of the dartaotruntime MachO executable, create a universal binary where the dartaotruntime executable is used for the appropriate architecture, and add a separate section that just contains the snapshot data directly.

By piggy-bagging on universal binaries, we rely on tools (strip, signing, ...) to preserve all parts. It may be unusual to have universal binaries with several parts with same architecture. I can imagine there's tools that take universal binaries (containing code for different architectures) and pulling out / stripping to only whats needed - to get smaller binaries. That would be the risk with this approach.

@sstrickl
Copy link
Contributor

That's true, that would be a risk. That, and I think we'd have to use a different (non-supported) architecture for the Dart snapshot MachO, though if we mark it as a dsym or something, that might be enough for it not to be chosen when executing, but that doesn't help against stripping universal binaries back to MachO executables.

The main thing I'm worried about are file offsets inside sections. Handling load segments and section headers is relatively easy, though whether a load command contains file offsets depends on the specific load segment type and so we'd have to make sure we handle what we know about and hope none get added.

However, but if any section contents themselves include file offsets, then it gets even trickier. I'll page back in the MachO specifics I know and see if I have any obvious examples of such to point to.

@mkustermann
Copy link
Member

Another question: If a universal binary is executed, I assume only the specific architecture's MachO is loaded into memory. So if we add another part, would it get loaded by the dynamic loader or we'd need to manually mmap() it into memory ourselves / find file handle / filename and read from the file?

@mraleph
Copy link
Member

mraleph commented Aug 25, 2022

Maybe we could return back to the idea of shipping clang's assembler+linker+linkable-AOT-runtime-library in the SDK instead? This has larger footprint but is guaranteed to work.

@sstrickl
Copy link
Contributor

Yeah, that'd probably be the best in the long run, just to treat the AOT runtime as something linked together with the snapshot to create an executabler rather than trying to do the merging mess we currently do. I should have listed that as a possible solution as well, thanks for mentioning it!

@sstrickl
Copy link
Contributor

So if we add another part, would it get loaded by the dynamic loader or we'd need to manually mmap() it into memory ourselves / find file handle / filename and read from the file?

I might be misremembering but I'm pretty sure we already do this approach, opening the file, finding the snapshot offset, and then using the ELF loader which will mmap() the right part of it.

copybara-service bot pushed a commit that referenced this issue Aug 25, 2022
This catches an inadvertent partial overwrite of the first section
in the `dartaotruntime` executable that happens when there's not
enough padding after the headers. The first section is a text section,
so unless there are no calls to code in this overwritten portion, there
are no runtime failures when this happens.

However, having a MachO section which has a file offset within the
headers is checked by MachO verification code within the `codesign`
utility when run with the `-f` flag, and thus caused failures in
certain tests and builds. Note that we only use that flag when
`codesign` does not have the `linker-signed` option, which is for
MacOS versions prior to 12.0.

Example failure with this change when this case occurs (e.g., prior to
the recent clang revert):
```
$ xcodebuild/ReleaseARM64/dart-sdk/bin/dart compile exe -o test test.dart
Info: Compiling with sound null safety
Error: AOT compilation failed
FormatException: The MachO header overlaps with the first 120 bytes of the section contents
```

Change-Id: Ib27db910777f61b90f162f7a0bcfa4ba6592a5a0
Bug: #49783
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-mac-release-arm64-try,vm-kernel-precomp-mac-product-x64-try,dart-sdk-mac-arm64-try,dart-sdk-mac-try,pkg-mac-release-arm64-try,pkg-mac-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256264
Reviewed-by: Daco Harkes <[email protected]>
Reviewed-by: Martin Kustermann <[email protected]>
Commit-Queue: Tess Strickland <[email protected]>
copybara-service bot pushed a commit that referenced this issue Aug 26, 2022
This reverts commit 161f8fd.

Reason for revert: breaks google3 (b/243899439)

Original change's description:
> [pkg/dart2native] Add negative padding check to MachO writer.
>
> This catches an inadvertent partial overwrite of the first section
> in the `dartaotruntime` executable that happens when there's not
> enough padding after the headers. The first section is a text section,
> so unless there are no calls to code in this overwritten portion, there
> are no runtime failures when this happens.
>
> However, having a MachO section which has a file offset within the
> headers is checked by MachO verification code within the `codesign`
> utility when run with the `-f` flag, and thus caused failures in
> certain tests and builds. Note that we only use that flag when
> `codesign` does not have the `linker-signed` option, which is for
> MacOS versions prior to 12.0.
>
> Example failure with this change when this case occurs (e.g., prior to
> the recent clang revert):
> ```
> $ xcodebuild/ReleaseARM64/dart-sdk/bin/dart compile exe -o test test.dart
> Info: Compiling with sound null safety
> Error: AOT compilation failed
> FormatException: The MachO header overlaps with the first 120 bytes of the section contents
> ```
>
> Change-Id: Ib27db910777f61b90f162f7a0bcfa4ba6592a5a0
> Bug: #49783
> Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-mac-release-arm64-try,vm-kernel-precomp-mac-product-x64-try,dart-sdk-mac-arm64-try,dart-sdk-mac-try,pkg-mac-release-arm64-try,pkg-mac-release-try
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256264
> Reviewed-by: Daco Harkes <[email protected]>
> Reviewed-by: Martin Kustermann <[email protected]>
> Commit-Queue: Tess Strickland <[email protected]>

[email protected],[email protected],[email protected]

Change-Id: Iccf27ffab6c6b6272e366b77c5092b346145e263
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: #49783
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-mac-release-arm64-try,vm-kernel-precomp-mac-product-x64-try,dart-sdk-mac-arm64-try,dart-sdk-mac-try,pkg-mac-release-arm64-try,pkg-mac-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256460
Reviewed-by: Martin Kustermann <[email protected]>
Commit-Queue: Emmanuel Pellereau <[email protected]>
Reviewed-by: Emmanuel Pellereau <[email protected]>
Reviewed-by: Tess Strickland <[email protected]>
copybara-service bot pushed a commit that referenced this issue Sep 7, 2022
* Move parsing functions to static methods of the classes that
  represent the data being parsed.

* Move calculations for adjusting offsets in load commands into the
  corresponding classes.

* Make function to insert a new payload segment an instance method
  of MachOFile.

* Remove unnecessary abstractions and definitions for MachO load
  commands that we don't need to parse.

These refactorings are being done to make later changes easier to
review, by first lifting the initial refactorings out into a
separate CL.

Issue: #49783
Change-Id: I133eb368cbb9ee0d8e4f3998ba1a0bbe8555b8aa
Cq-Include-Trybots: luci.dart.try:analyzer-mac-release-try,dart-sdk-mac-arm64-try,dart-sdk-mac-try,pkg-mac-release-arm64-try,pkg-mac-release-try,vm-kernel-precomp-mac-product-x64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256821
Reviewed-by: Daco Harkes <[email protected]>
Commit-Queue: Tess Strickland <[email protected]>
Reviewed-by: Ryan Macnak <[email protected]>
copybara-service bot pushed a commit that referenced this issue Sep 29, 2022
To create a Dart standalone executable on MacOS, we modify the
dartaotruntime executable to add the snapshot contents, and the
VM looks into the executable on disk to find the snapshot to load.

Previously, we did this by adding a new 64-bit segment load command
with a single section, where the section's file offset and size
describes the inserted snapshot. This meant the Mach-O header size increased by 152 bytes.

Originally, this wasn't an issue as there was plenty of padding, but
later clang updates removed most of this padding, and so writing the
new header actually overwrote the initial contents of the first section
in the file, which happens to be the __text section. In addition, since
the first section's offset was now declared to be within the header,
utilities that strictly validated the Mach-O format, like codesign,
would report errors.

This CL changes it so that we actually reserve space in the
dartaotruntime header using the -add_empty_section flag to the linker.
In addition, we change from using a segment load command to using a
(40 byte) note load command. This is because a segment load command
specifies that the contents should be loaded in memory, but we don't
use that loaded version. Instead, the VM reloads it from the executable
on disk so it can appropriately mmap the different parts of the
snapshot. A note section instead just declares a section of the
executable as arbitrary data that the owner can read from the file
and use as desired, which is semantically closer to our current usage.

This CL also adds a test to pkg/dartdev/test/commands/compile_test to
ensure that corrupting a random part of the snapshot in the executable
causes signature verification to fail.

This CL also reverts CL 256208, thus relanding the clang changes
starting from June that originally raised awareness of the issue by
greatly reduced the amount of padding after the load commands.

TEST=pkg/dartdev/test/commands/compile_test

Bug: #49783
Change-Id: Iee554d87b0eabaecd7a534ca4e4facfefbce6385
Cq-Include-Trybots: luci.dart.try:analyzer-mac-release-try,dart-sdk-mac-arm64-try,dart-sdk-mac-try,pkg-mac-release-arm64-try,pkg-mac-release-try,vm-kernel-precomp-mac-product-x64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260108
Reviewed-by: Ryan Macnak <[email protected]>
Reviewed-by: Daco Harkes <[email protected]>
Commit-Queue: Tess Strickland <[email protected]>
copybara-service bot pushed a commit that referenced this issue Oct 7, 2022
To avoid these flags being applied to unexpected build rules, we
separate them out into a separate config that is then pulled in
explicitly in the `dart_precompiled_runtime{,_product}` executable
rules. Only those two executables need the additional empty section:
the product version because it becomes `dartaotruntime` in the SDK
bundle, and the non-product version because some of our tests build
standalone executables using it.

The linker flags were originally removed due to
flutter/flutter#112687.
With the recent removal of bitcode support from Flutter (see
flutter/flutter#107883), I can build
the `ios_release` target locally without any issue.

This also reverts the clang DEPS changes from CL 256208 (again).

TEST=pkg/dartdev/test/commands/compile_test

Bug: #49783
Cq-Include-Trybots: luci.dart.try:analyzer-mac-release-try,dart-sdk-mac-arm64-try,dart-sdk-mac-try,pkg-mac-release-arm64-try,pkg-mac-release-try,vm-kernel-precomp-mac-product-x64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try
Change-Id: Ie46402ec2eeda23109247eb9d7a64935ec2052cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262429
Reviewed-by: Martin Kustermann <[email protected]>
Commit-Queue: Tess Strickland <[email protected]>
@sstrickl sstrickl closed this as completed Oct 7, 2022
copybara-service bot pushed a commit that referenced this issue Dec 14, 2022
Now that 9df6656 has appropriately propagated and the build rules in
google3 have been updated, re-add checks to ensure that the empty
section used to pad the original header exists and that the new header
is smaller than the old header.

Bug: #49783
Change-Id: I5b8b31bf9edf4814686eb7928457a9a7d53c0727
Cq-Include-Trybots: luci.dart.try:dart-sdk-mac-try,dart-sdk-mac-arm64-try,pkg-mac-release-arm64-try,pkg-mac-release-try,vm-kernel-mac-release-arm64-try,vm-kernel-mac-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275622
Commit-Queue: Tess Strickland <[email protected]>
Reviewed-by: Daco Harkes <[email protected]>
Reviewed-by: Alexander Markov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. P2 A bug or feature request we're likely to work on
Projects
None yet
Development

No branches or pull requests

5 participants