Skip to content
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

[ObjC] Remove OSReadLittle* due to alignment requirements #6678

Merged
merged 1 commit into from Sep 20, 2019

Conversation

@dmaclach
Copy link
Contributor

commented Sep 20, 2019

Objective C Protocol buffers can crash on ARM32.

The OSReadLittleInt64 function as defined by Apple reduces down to:

return *(volatile uint64_t *)((uintptr_t)base + byteOffset);

which means we are type-punning using a cast. On ARMv7 and other aligned architectures this can cause crashes.
Minimal example: https://gist.github.com/dmaclach/b10b0a71ae614d304c067cb9bd264336

Language: objective-c
release notes: yes

The OSReadLittleInt64 function as defined by Apple reduces down to:

`return *(volatile uint64_t *)((uintptr_t)base + byteOffset);`

which means we are type-punning using a cast. On ARMv7 and other aligned architectures this can cause crashes. 
Minimal example: https://gist.github.com/dmaclach/b10b0a71ae614d304c067cb9bd264336
@googlebot googlebot added the cla: yes label Sep 20, 2019
@thomasvl thomasvl self-assigned this Sep 20, 2019
@thomasvl thomasvl changed the title Remove OSReadLittle* due to alignment requirements [ObjC] Remove OSReadLittle* due to alignment requirements Sep 20, 2019
@thomasvl thomasvl merged commit 4702ba9 into protocolbuffers:master Sep 20, 2019
49 of 56 checks passed
49 of 56 checks passed
Dist artifact installation Kokoro build started.
Details
Linux C++ Distcheck Kokoro build started.
Details
Linux C++ TC Malloc Kokoro build started.
Details
Linux Java JDK 7 Kokoro build started.
Details
Linux Python Release Kokoro build started.
Details
MacOS Obj-C CocoaPods Integration Kokoro build started.
Details
MacOS Python Release Kokoro build started.
Details
Bazel Kokoro build successful
Details
Linux 32-bit Kokoro build successful
Details
Linux C# Kokoro build successful
Details
Linux Golang Kokoro build successful
Details
Linux Java Compatibility Kokoro build successful
Details
Linux Java Linkage Monitor Kokoro build successful
Details
Linux Java Oracle 7 Kokoro build successful
Details
Linux JavaScript Kokoro build successful
Details
Linux PHP Kokoro build successful
Details
Linux Python Kokoro build successful
Details
Linux Python 2.7 Kokoro build successful
Details
Linux Python 2.7 C++ Kokoro build successful
Details
Linux Python 3.3 Kokoro build successful
Details
Linux Python 3.3 C++ Kokoro build successful
Details
Linux Python 3.4 Kokoro build successful
Details
Linux Python 3.4 C++ Kokoro build successful
Details
Linux Python 3.5 Kokoro build successful
Details
Linux Python 3.5 C++ Kokoro build successful
Details
Linux Python 3.6 Kokoro build successful
Details
Linux Python 3.6 C++ Kokoro build successful
Details
Linux Python 3.7 Kokoro build successful
Details
Linux Python 3.7 C++ Kokoro build successful
Details
Linux Python C++ Kokoro build successful
Details
Linux Python Compatibility Kokoro build successful
Details
Linux Ruby 2.3 Kokoro build successful
Details
Linux Ruby 2.4 Kokoro build successful
Details
Linux Ruby 2.5 Kokoro build successful
Details
Linux Ruby 2.6 Kokoro build successful
Details
Linux Ruby Release Kokoro build successful
Details
MacOS C++ Kokoro build successful
Details
MacOS C++ Distcheck Kokoro build successful
Details
MacOS JavaScript Kokoro build successful
Details
MacOS Obj-C OS X Kokoro build successful
Details
MacOS Obj-C iOS Debug Kokoro build successful
Details
MacOS Obj-C iOS Release Kokoro build successful
Details
MacOS PHP5.6 Kokoro build successful
Details
MacOS PHP7.0 Kokoro build successful
Details
MacOS Python Kokoro build successful
Details
MacOS Python C++ Kokoro build successful
Details
MacOS Ruby 2.3 Kokoro build successful
Details
MacOS Ruby 2.4 Kokoro build successful
Details
MacOS Ruby 2.5 Kokoro build successful
Details
MacOS Ruby 2.6 Kokoro build successful
Details
MacOS Ruby Release Kokoro build successful
Details
Mergeable Mergeable Run has been Completed!
Details
Windows C# Kokoro build successful
Details
Windows Csharp Release Kokoro build successful
Details
Windows Python Release Kokoro build successful
Details
cla/google All necessary CLAs are signed
thomasvl added a commit to thomasvl/protobuf that referenced this pull request Sep 20, 2019
)

The OSReadLittleInt64 function as defined by Apple reduces down to:

`return *(volatile uint64_t *)((uintptr_t)base + byteOffset);`

which means we are type-punning using a cast. On ARMv7 and other aligned architectures this can cause crashes. 
Minimal example: https://gist.github.com/dmaclach/b10b0a71ae614d304c067cb9bd264336

Fixes protocolbuffers#6679
thomasvl added a commit to thomasvl/protobuf that referenced this pull request Sep 20, 2019
)

The OSReadLittleInt64 function as defined by Apple reduces down to:

`return *(volatile uint64_t *)((uintptr_t)base + byteOffset);`

which means we are type-punning using a cast. On ARMv7 and other aligned architectures this can cause crashes. 
Minimal example: https://gist.github.com/dmaclach/b10b0a71ae614d304c067cb9bd264336

Fixes protocolbuffers#6679
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.