Segmentation fault when ASAN was turned on - clang

I am trying to debug with ASAN. (address sanitizer)
But I have met a segmentation fault.
I try to debug with lldb.
It seems that there is a bug in ASAN that causes the error.
Process 71756 stopped
* thread #1, stop reason = EXC_BAD_ACCESS (code=1, address=0x180000000)
frame #0: 0x0000000100bfa5f4 libclang_rt.asan_osx_dynamic.dylib`__sanitizer::get_dyld_hdr() + 184
libclang_rt.asan_osx_dynamic.dylib`__sanitizer::get_dyld_hdr:
-> 0x100bfa5f4 <+184>: ldr w9, [x0]
0x100bfa5f8 <+188>: cmp w21, w9, lsr #1
0x100bfa5fc <+192>: b.ne 0x100bfa5b0 ; <+116>
0x100bfa600 <+196>: ldr w9, [x0, #0xc]
The gcc and g++ version are AppleClang 12.0.5.12050022 for arm64(M1).
Note. ASAN works good until I upgraded the osx to 13.2.1.
Can I upgrade or downgrade my gcc/g++ version to fix it? and how?

Related

CF network error in iOS 16.1.1 with XCode 14.1 unable to find a solution

error log in xcode , no issue in iOS version below 16 , im using XCode 14.1
libsp.dylib`spd_checkin_socket.cold.1:
0x204699364 <+0>: adrp x8, 143811
0x204699368 <+4>: adrp x9, 0
0x20469936c <+8>: add x9, x9, #0xa3f; "Linked against modern SDK, VOIP socket will not wake. Use Local Push Connectivity instead"
0x204699370 <+12>: str x9, [x8, #0x130]
-> 0x204699374 <+16>: brk #0x1

App freezes on launch screen when on device but works fine on simulator

I went back to an app I had not touched for a couple of months. However when installing and launching it on the device (iPhone X), it freezes on the launch screen.
Here is what is displayed in the console :
dyld: Library not loaded: #rpath/GTMSessionFetcher.framework/GTMSessionFetcher
Referenced from: /private/var/containers/Bundle/Application/7ECE2655-24A5-4B69-8B99-4294C970E67F/Bangos Noir.app/Bangos Noir
Reason: no suitable image found. Did find:
/private/var/containers/Bundle/Application/7ECE2655-24A5-4B69-8B99-4294C970E67F/Bangos Noir.app/Frameworks/GTMSessionFetcher.framework/GTMSessionFetcher: code signature invalid for '/private/var/containers/Bundle/Application/7ECE2655-24A5-4B69-8B99-4294C970E67F/Bangos Noir.app/Frameworks/GTMSessionFetcher.framework/GTMSessionFetcher'
/private/var/containers/Bundle/Application/7ECE2655-24A5-4B69-8B99-4294C970E67F/Bangos Noir.app/Frameworks/GTMSessionFetcher.framework/GTMSessionFetcher: code signature invalid for '/private/var/containers/Bundle/Application/7ECE2655-24A5-4B69-8B99-4294C970E67F/Bangos Noir.app/Frameworks/GTMSessionFetcher.framework/GTMSessionFetcher'
/private/var/containers/Bundle/Application/7ECE2655-24A5-4B69-8B99-4294C970E67F/Bangos Noir.app/Frameworks/GTMSessionFetcher.framework/GTMSessionFetcher: stat() failed with errno=1
/private/var/containers/Bundle/Application/7ECE2655-24A5-4B69-8B99-4294C970E67F/Bangos Noir.app/Frameworks/GTMSessionFetcher.framework/GTMSessionFetcher: code signature invalid for '/private/var/containers/Bundle/Application/7ECE2655-24A5-4B69-8B99-4294C970E67F/Bangos Noir.app/Frameworks/GTMSessionFetcher.framework/GTMSessionFetcher'
/private/var/containers/Bundle/Application/7ECE2655-24A5-4B69-8B99-4294C970E67F/Bangos Noir.app/Frameworks/GTMSessionFetcher.framework/GTMSessionFetcher: stat() failed with errno=1
(lldb)
Moreover here is the log from the debug navigator :
dyld`__abort_with_payload:
0x100e8f5dc <+0>: mov x16, #0x209
0x100e8f5e0 <+4>: svc #0x80
-> 0x100e8f5e4 <+8>: b.lo 0x100e8f600 ; <+36>
0x100e8f5e8 <+12>: stp x29, x30, [sp, #-0x10]!
0x100e8f5ec <+16>: mov x29, sp
0x100e8f5f0 <+20>: bl 0x100e8dbe8 ; cerror_nocancel
0x100e8f5f4 <+24>: mov sp, x29
0x100e8f5f8 <+28>: ldp x29, x30, [sp], #0x10
0x100e8f5fc <+32>: ret
0x100e8f600 <+36>: ret
However, the app runs just fine on a simulator.
I found a possible solution here
https://stackoverflow.com/a/60257204/10213202
But it does not work for me.
PS : app name is Bangos Noir.

Flutter won't run on iphone

Flutter does not work on my iOS device (iPhone X).
When I run using 'flutter run' it keeps compiling ( up to 'Installing and launching...' ) and opening a blank app for like a second.
When I run my app using Xcode, it opens a blank app, and I receive this error message:
dyld`__abort_with_payload:
0x1013975dc <+0>: mov x16, #0x209
0x1013975e0 <+4>: svc #0x80
-> 0x1013975e4 <+8>: b.lo 0x101397600 ; <+36> #Thread 1: signal SIGABRT
0x1013975e8 <+12>: stp x29, x30, [sp, #-0x10]!
0x1013975ec <+16>: mov x29, sp
0x1013975f0 <+20>: bl 0x101395be8 ; cerror_nocancel
0x1013975f4 <+24>: mov sp, x29
0x1013975f8 <+28>: ldp x29, x30, [sp], #0x10
0x1013975fc <+32>: ret
0x101397600 <+36>: ret
and:
dyld: Library not loaded: #rpath/Flutter.framework/Flutter
Referenced from: /private/var/containers/Bundle/Application/57467581-3BC4-4097-AA4A-717D2AA9BF93/Runner.app/Runner
Reason: no suitable image found. Did find:
/private/var/containers/Bundle/Application/57467581-3BC4-4097-AA4A-717D2AA9BF93/Runner.app/Frameworks/Flutter.framework/Flutter: code signature invalid for '/private/var/containers/Bundle/Application/57467581-3BC4-4097-AA4A-717D2AA9BF93/Runner.app/Frameworks/Flutter.framework/Flutter'
/private/var/containers/Bundle/Application/57467581-3BC4-4097-AA4A-717D2AA9BF93/Runner.app/Frameworks/Flutter.framework/Flutter: code signature invalid for '/private/var/containers/Bundle/Application/57467581-3BC4-4097-AA4A-717D2AA9BF93/Runner.app/Frameworks/Flutter.framework/Flutter'
/private/var/containers/Bundle/Application/57467581-3BC4-4097-AA4A-717D2AA9BF93/Runner.app/Frameworks/Flutter.framework/Flutter: stat() failed with errno=1
/private/var/containers/Bundle/Application/57467581-3BC4-4097-AA4A-717D2AA9BF93/Runner.app/Frameworks/Flutter.framework/Flutter: code signature invalid for '/private/var/containers/Bundle/Application/57467581-3BC4-4097-AA4A-717D2AA9BF93/Runner.app/Frameworks/Flutter.framework/Flutter'
/private/var/containers/Bundle/Application/57467581-3BC4-4097-AA4A-717D2AA9BF93/Runner.app/Frameworks/Flutter.framework/Flutter: stat() failed with errno=1
/private/var/containers/Bundle/Application/57467581-3BC4-4097-AA4A-717D2AA9BF93/Runner.app/Frameworks/Flutter.framework/Flutter: code signature invalid for '/private/var/containers/Bundle/Application/57467581-3BC4-4097-AA4A-717D2AA9BF93/Runner.app/Frameworks/Flutter.framework/Flutter'
/private/var/containers/Bundle/Application/57467581-3BC4-4097-AA4A-717D2AA9BF93/Runner.app/Frameworks/Flutter.framework/Flutter: stat() failed with errno=1
/private/var/containers/Bundle/Application/57467581-3BC4-4097-AA4A-717D2AA9BF93/Runner.app/Frameworks/Flutter.framework/Flutter: code signature invalid for '/private/var/containers/Bundle/Application/57467581-3BC4-4097-AA4A-717D2AA9BF93/Runner.app/Frameworks/Flutter.framework/Flutter'
/private/var/containers/Bundle/Application/57467581-3BC4-4097-AA4A-717D2AA9BF93/Runner.app/Frameworks/Flutter.framework/Flutter: stat() failed with errno=1
Flutter doctor:
[✓] Flutter (Channel stable, v1.12.13+hotfix.7, on Mac OS X 10.15.3 19D76,
locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
[✓] Android Studio (version 3.5)
[✓] IntelliJ IDEA Ultimate Edition (version 2019.3.2)
[✓] VS Code (version 1.38.1)
[✓] Connected device (1 available)
• No issues found!
iOS version: 13.3.1
MacOs version: Catalina 10.15.3
Important notice: It works on my iPad or on a Simulator ( iOS and Android ).
This is not a flutter issue, it has to do with apple latest ios 13.3.1.
It also reproduces by creating a new Xcode project and just adding a framework target, which automatically gets embedded and linked in the app target.
More details about the issue:
https://github.com/flutter/flutter/issues/49504

Xcode 11.2.1 Thread Sanitizer abort_with_payload

I'm trying to use the Thread Sanitizer in Xcode 11.2.1 but whenever the app launches (just a single view app from Xcode's template, nothing added) it hits __abort_with_payload:
libsystem_kernel.dylib`__abort_with_payload:
0x7fff51b73be0 <+0>: movl $0x2000209, %eax ; imm = 0x2000209
0x7fff51b73be5 <+5>: movq %rcx, %r10
0x7fff51b73be8 <+8>: syscall
-> 0x7fff51b73bea <+10>: jae 0x7fff51b73bf4 ; <+20>
0x7fff51b73bec <+12>: movq %rax, %rdi
0x7fff51b73bef <+15>: jmp 0x7fff51b54a89 ; cerror_nocancel
0x7fff51b73bf4 <+20>: retq
0x7fff51b73bf5 <+21>: nop
0x7fff51b73bf6 <+22>: nop
0x7fff51b73bf7 <+23>: nop
None of Apple's docs or other people's guides to using the Thread Sanitizer say you need to do anything more than tick the box in the scheme's settings but for me that doesn't work :(
Printing out $arg5 gives
pthread_t was corrupted
which doesn't sound great!
This is on Catalina 10.15.2 using the iPhone 11 Pro Max simulator
This issue has been fixed as of Xcode 11.3.1, thanks to vandzi for pointing it out!
I also faced similar issue, Thread Sanitizer was ON in scheme settings and turning that off solved the problem in my case.
Looks like it is connected to this tsan commit
https://github.com/llvm/llvm-project/commit/f9a706a36ae5dcb87b0b6649d0c80e989400f48e
https://reviews.llvm.org/D71559
I need to run thread sanitizer very badly, so
built the newest llvm with
> mkdir workspace/
> git clone https://github.com/llvm/llvm-project.git
> cd llvm-project; mkdir build; cd build
>cmake -G Ninja ../llvm -DLLVM_ENABLE_PROJECTS='clang;clang-tools-extra;libcxx;libcxxabi;libunwind;lldb;compiler-rt;lld;polly' -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=$HOME/llvm -DLLVM_ENABLE_DUMP=ON # not everything is needed though here
>ninja
and replaced
~/Library/Developer/CoreSimulator/Devices/C0E36E0C-C22A-426E-80B7-557164B2FBD3/data/Containers/Bundle/Application/D6D4D9DB-4C26-4FA0-8363-5CA03A47B6C0/Spotify.app/Frameworks/libclang_rt.tsan_iossim_dynamic.dylib
with the newly built lib from
/workspace/llvm-project/build/lib/clang/10.0.0/lib/darwin/libclang_rt.tsan_iossim_dynamic.dylib # 10.0.0 is the previos version some artifact of my bulding, it had the fixed revision ^
the app seem to load in the simulator and not crash with
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x00007fff523d5bea __abort_with_payload + 10
1 libsystem_kernel.dylib 0x00007fff523d74f3 abort_with_payload_wrapper_internal + 80
2 libsystem_kernel.dylib 0x00007fff523d74a3 abort_with_reason + 19
3 libsystem_pthread.dylib 0x00007fff52469974 pthread_self.cold.1 + 24
4 libsystem_pthread.dylib 0x00007fff52462fe3 pthread_self + 34
5 libclang_rt.tsan_iossim_dynamic.dylib 0x000000013b59816b __tsan::cur_thread() + 11
6 libclang_rt.tsan_iossim_dynamic.dylib 0x000000013b56d985 wrap_sysctlbyname + 37
7 libsystem_sim_kernel.dylib 0x00007fff52470331 assert_simulator_supported_host + 44
8 libSystem.B.dylib 0x00007fff4ff167c1 libSystem_initializer + 78
9 dyld_sim 0x000000013b3a73a7 ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) + 517
any more! my app seems to show the first screen but freeze afterwards, so not sure its completely workable.
hope that helps

Docker build crash due to docker-credential-helper

I am using a script and in that script I'm building a Docker image. I pipe the Dockerfile to docker build as explained here: https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#pipe-dockerfile-through-stdin.
Here is my code:
docker build -t alpine-rsync - <<EOF
FROM alpine
RUN apk update
RUN apk add rsync
EOF
Unfotunately, I get this strange error message now when I execute the script. Can somebody help me what I did wrong?
free(): invalid pointer
SIGABRT: abort
PC=0x7ff4beae2e97 m=0 sigcode=18446744073709551610
signal arrived during cgo execution
goroutine 1 [syscall, locked to thread]:
runtime.cgocall(0x4afd50, 0xc420049cc0, 0xc420049ce8)
/usr/lib/go-1.8/src/runtime/cgocall.go:131 +0xe2 fp=0xc420049c90 sp=0xc420049c50
github.com/docker/docker-credential-helpers/secretservice._Cfunc_free(0x2135270)
github.com/docker/docker-credential-helpers/secretservice/_obj/_cgo_gotypes.go:111 +0x41 fp=0xc420049cc0 sp=0xc420049c90
github.com/docker/docker-credential-helpers/secretservice.Secretservice.List.func5(0x2135270)
/build/golang-github-docker-docker-credential-helpers-cMhSy1/golang-github-docker-docker-credential-helpers-0.5.0/obj-x86_64-linux-gnu/src/github.com/docker/docker-credential-helpers/secretservice/secretservice_linux.go:96 +0x60 fp=0xc420049cf8 sp=0xc420049cc0
github.com/docker/docker-credential-helpers/secretservice.Secretservice.List(0x0, 0x756060, 0xc420012360)
/build/golang-github-docker-docker-credential-helpers-cMhSy1/golang-github-docker-docker-credential-helpers-0.5.0/obj-x86_64-linux-gnu/src/github.com/docker/docker-credential-helpers/secretservice/secretservice_linux.go:97 +0x217 fp=0xc420049da0 sp=0xc420049cf8
github.com/docker/docker-credential-helpers/secretservice.(*Secretservice).List(0x77e548, 0xc420049e88, 0x410022, 0xc4200122c0)
<autogenerated>:4 +0x46 fp=0xc420049de0 sp=0xc420049da0
github.com/docker/docker-credential-helpers/credentials.List(0x756ba0, 0x77e548, 0x7560e0, 0xc42000e018, 0x0, 0x10)
/build/golang-github-docker-docker-credential-helpers-cMhSy1/golang-github-docker-docker-credential-helpers-0.5.0/obj-x86_64-linux-gnu/src/github.com/docker/docker-credential-helpers/credentials/credentials.go:145 +0x3e fp=0xc420049e68 sp=0xc420049de0
github.com/docker/docker-credential-helpers/credentials.HandleCommand(0x756ba0, 0x77e548, 0x7ffced22f7a4, 0x4, 0x7560a0, 0xc42000e010, 0x7560e0, 0xc42000e018, 0x40e398, 0x4d35c0)
/build/golang-github-docker-docker-credential-helpers-cMhSy1/golang-github-docker-docker-credential-helpers-0.5.0/obj-x86_64-linux-gnu/src/github.com/docker/docker-credential-helpers/credentials/credentials.go:60 +0x16d fp=0xc420049ed8 sp=0xc420049e68
github.com/docker/docker-credential-helpers/credentials.Serve(0x756ba0, 0x77e548)
/build/golang-github-docker-docker-credential-helpers-cMhSy1/golang-github-docker-docker-credential-helpers-0.5.0/obj-x86_64-linux-gnu/src/github.com/docker/docker-credential-helpers/credentials/credentials.go:41 +0x1cb fp=0xc420049f58 sp=0xc420049ed8
main.main()
/build/golang-github-docker-docker-credential-helpers-cMhSy1/golang-github-docker-docker-credential-helpers-0.5.0/secretservice/cmd/main_linux.go:9 +0x4f fp=0xc420049f88 sp=0xc420049f58
runtime.main()
/usr/lib/go-1.8/src/runtime/proc.go:185 +0x20a fp=0xc420049fe0 sp=0xc420049f88
runtime.goexit()
/usr/lib/go-1.8/src/runtime/asm_amd64.s:2197 +0x1 fp=0xc420049fe8 sp=0xc420049fe0
goroutine 17 [syscall, locked to thread]:
runtime.goexit()
/usr/lib/go-1.8/src/runtime/asm_amd64.s:2197 +0x1
rax 0x0
rbx 0x7ffced22dcf0
rcx 0x7ff4beae2e97
rdx 0x0
rdi 0x2
rsi 0x7ffced22da80
rbp 0x7ffced22ddf0
rsp 0x7ffced22da80
r8 0x0
r9 0x7ffced22da80
r10 0x8
r11 0x246
r12 0x7ffced22dcf0
r13 0x1000
r14 0x0
r15 0x30
rip 0x7ff4beae2e97
rflags 0x246
cs 0x33
fs 0x0
gs 0x0
Sending build context to Docker daemon 2.048kB
As can be seen here, this is an issue with docker-credential-helpers and not with the syntax.
According to the issue above, this has been fixed in v0.6.3 which is available to download from the release page on Github.
Alternately, as suggested by this comment, you can remove docker-credential-helpers with the following command and continue as normal:
dpkg -r --force-depends golang-docker-credential-helpers

Resources