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

Crash in objc_end_catch when catching re-thrown exception on armeabi-v7a #161

Open
triplef opened this issue Jun 3, 2020 · 3 comments
Open

Comments

@triplef
Copy link
Member

triplef commented Jun 3, 2020

Calling the following -test method on armeabi-v7a crashes with SEGV_MAPERR in objc_end_catch() (eh_personality.c:638) using the libc++ branch (#152) because td->caughtExceptions is NULL. Other ABIs (arm64, i386) are unaffected.

- (void)test
{
	@try {
		[self catchAndRethrowException];
	} @catch (NSException *e) {
		NSLog(@"ObjC exception 2: %@", e);
	}
}

- (void)catchAndRethrowException
{
	@try {
		[[NSException exceptionWithName:NSInternalInconsistencyException reason:@"Test ObjC Exception" userInfo:nil] raise];
	} @catch (NSException *e) {
		NSLog(@"ObjC exception 1: %@", e);
		[e raise];
	}
}

Unfortunately I’m not able to test this with the latest master as it doesn’t build for ARM. The latest EH changes seem to assume the Itanium ABI, as the private_1/private_2 fields don’t exist on ARM (please let me know if I should open a separate issue for this):

eh_personality.c:571:22: error: no member named 'private_1' in 'struct _Unwind_Exception'
                ex->cxx_exception->private_1 = exceptionObject->private_1;
@davidchisnall
Copy link
Member

Does this still fail? The C++ exception interop tests fail in CI on 32-bit Arm, but I don't think that's related?

@hmelder
Copy link
Collaborator

hmelder commented Apr 27, 2024

Cannot reproduce this on Debian Unstable armhf (armv7l-unknown-linux-gnueabihf). Have to test this on Android with armeabi-v7a.

root@debian:~# clang-18 --version
Debian clang version 18.1.4 (1)
Target: arm-unknown-linux-gnueabihf
Thread model: posix
InstalledDir: /usr/bin
2024-04-27 15:00:16.895 a.out[11050:11050] ObjC exception 1: <NSException: 0x1e809a4> NAME:NSInternalInconsistencyException REASON:Test ObjC Exception INFO:(null)
2024-04-27 15:00:16.921 a.out[11050:11050] ObjC exception 2: <NSException: 0x1e809a4> NAME:NSInternalInconsistencyException REASON:Test ObjC Exception INFO:(null)

@hmelder
Copy link
Collaborator

hmelder commented May 7, 2024

Was able to reproduce this on armeabi-v7a Android 10 API29.

2024-05-07 09:24:40.653 18735-18735 com.exampl...pplication com.example.myapplication            E  [thread:2579433444] Testing Objective-C Exceptions
2024-05-07 09:24:40.657 18735-18735 libc                    com.example.myapplication            A  Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 18735 (e.myapplication), pid 18735 (e.myapplication)
2024-05-07 09:24:40.797 18828-18828 DEBUG                   pid-18828                            A  pid: 18735, tid: 18735, name: e.myapplication  >>> com.example.myapplication <<<
2024-05-07 09:24:41.623 18828-18828 DEBUG                   crash_dump32                         A        #01 pc 00086d55  /data/app/com.example.myapplication-bvkfI6_5gXWTYAVnmUw2pA==/base.apk!libc++_shared.so (offset 0x6c8000) (BuildId: 02d0aa8c4dc8332a9dad132ede6ba1a9e24cee0b)
2024-05-07 09:24:41.623 18828-18828 DEBUG                   crash_dump32                         A        #02 pc 00087209  /data/app/com.example.myapplication-bvkfI6_5gXWTYAVnmUw2pA==/base.apk!libc++_shared.so (offset 0x6c8000) (BuildId: 02d0aa8c4dc8332a9dad132ede6ba1a9e24cee0b)
2024-05-07 09:24:41.623 18828-18828 DEBUG                   crash_dump32                         A        #03 pc 000871a5  /data/app/com.example.myapplication-bvkfI6_5gXWTYAVnmUw2pA==/base.apk!libc++_shared.so (offset 0x6c8000) (BuildId: 02d0aa8c4dc8332a9dad132ede6ba1a9e24cee0b)
2024-05-07 09:24:41.623 18828-18828 DEBUG                   crash_dump32                         A        #04 pc 00086e6b  /data/app/com.example.myapplication-bvkfI6_5gXWTYAVnmUw2pA==/base.apk!libc++_shared.so (offset 0x6c8000) (__gxx_personality_v0+174) (BuildId: 02d0aa8c4dc8332a9dad132ede6ba1a9e24cee0b)
2024-05-07 09:24:41.623 18828-18828 DEBUG                   crash_dump32                         A        #05 pc 00011e35  /data/app/com.example.myapplication-bvkfI6_5gXWTYAVnmUw2pA==/base.apk!libobjc.so (offset 0x610000) (__gnustep_objcxx_personality_v0+216) (BuildId: a7d7a17ffe869b89ba802b0dc285ce588a0aa629)
2024-05-07 09:24:41.623 18828-18828 DEBUG                   crash_dump32                         A        #06 pc 0001c278  /data/app/com.example.myapplication-bvkfI6_5gXWTYAVnmUw2pA==/base.apk!libobjc.so (offset 0x610000) (BuildId: a7d7a17ffe869b89ba802b0dc285ce588a0aa629)
2024-05-07 09:24:41.623 18828-18828 DEBUG                   crash_dump32                         A        #07 pc 0001c1b0  /data/app/com.example.myapplication-bvkfI6_5gXWTYAVnmUw2pA==/base.apk!libobjc.so (offset 0x610000) (BuildId: a7d7a17ffe869b89ba802b0dc285ce588a0aa629)
2024-05-07 09:24:41.623 18828-18828 DEBUG                   crash_dump32                         A        #08 pc 000118a7  /data/app/com.example.myapplication-bvkfI6_5gXWTYAVnmUw2pA==/base.apk!libobjc.so (offset 0x610000) (objc_exception_throw+146) (BuildId: a7d7a17ffe869b89ba802b0dc285ce588a0aa629)
2024-05-07 09:24:41.623 18828-18828 DEBUG                   crash_dump32                         A        #09 pc 0029df6b  /data/app/com.example.myapplication-bvkfI6_5gXWTYAVnmUw2pA==/base.apk!libgnustep-base.so (offset 0x290c000) (BuildId: c5457c2c730de792682f69f84d2ed999b74595cd)
2024-05-07 09:24:41.623 18828-18828 DEBUG                   crash_dump32                         A        #10 pc 00001e87  /data/app/com.example.myapplication-bvkfI6_5gXWTYAVnmUw2pA==/base.apk!libnative-lib.so (offset 0x3544000) (BuildId: e589f4513c32bb10cca8e9a2ce75df50c81abc7f)
2024-05-07 09:24:41.624 18828-18828 DEBUG                   crash_dump32                         A        #11 pc 00001dbf  /data/app/com.example.myapplication-bvkfI6_5gXWTYAVnmUw2pA==/base.apk!libnative-lib.so (offset 0x3544000) (BuildId: e589f4513c32bb10cca8e9a2ce75df50c81abc7f)
2024-05-07 09:24:41.624 18828-18828 DEBUG                   crash_dump32                         A        #12 pc 00001f6d  /data/app/com.example.myapplication-bvkfI6_5gXWTYAVnmUw2pA==/base.apk!libnative-lib.so (offset 0x3544000) (Java_com_example_myapplication_MainActivity_blockOperation+52) (BuildId: e589f4513c32bb10cca8e9a2ce75df50c81abc7f)
2024-05-07 09:24:41.625 18828-18828 DEBUG                   crash_dump32                         A        #21 pc 00000354  [anon:dalvik-classes4.dex extracted in memory from /data/app/com.example.myapplication-bvkfI6_5gXWTYAVnmUw2pA==/base.apk!classes4.dex] (com.example.myapplication.MainActivity.onCreate+32)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants