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

Starting daemon causes segfault (arm64e, M1 mini, 2020) #9

Closed
j1ah0ng opened this issue Jan 17, 2022 · 2 comments
Closed

Starting daemon causes segfault (arm64e, M1 mini, 2020) #9

j1ah0ng opened this issue Jan 17, 2022 · 2 comments

Comments

@j1ah0ng
Copy link

j1ah0ng commented Jan 17, 2022

Issue: Starting the GUI as a normal user, clicking "install" and authenticating results in "Daemon Status" and "Daemon Running" both turning green briefly, before settling on the following state:
Screen Shot 2022-01-17 at 12 43 39 PM

Environment: macOS Monterey, M1 mini (2020)

$ uname -a
Darwin mini.local 21.2.0 Darwin Kernel Version 21.2.0: Sun Nov 28 20:29:10 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T8101 arm64

Build: (from master as of 01-17)

$ git rev-parse HEAD
f53893276beebfb006771144f0ec01416f88017f
$ cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_OSX_ARCHITECTURES=arm64e -B build .
$ cmake --build build -- install -j$(nproc)
$ sudo mv build/dist/Odourless /Applications
@j1ah0ng j1ah0ng changed the title Starting daemon from GUI does not work as non-root Starting daemon from GUI does not work Jan 17, 2022
@j1ah0ng
Copy link
Author

j1ah0ng commented Jan 17, 2022

It seems like something is causing a segfault in the daemon process. Running the daemon by hand:

/Applications/Odourless.app/Contents/Resources/bin $ sudo ./odourless-daemon
[1]    32272 trace trap  sudo ./odourless-daemon

and in a debugger:

/Applications/Odourless.app/Contents/Resources/bin $ lldb odourless-daemon 
(lldb) target create "odourless-daemon"
b main
Current executable set to '/Applications/Odourless.app/Contents/Resources/bin/odourless-daemon' (arm64e).
(lldb) b main
Breakpoint 1: 22 locations.
(lldb) r
Process 32227 launched: '/Applications/Odourless.app/Contents/Resources/bin/odourless-daemon' (arm64e)
Process 32227 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
    frame #0: 0x0000000100008e88 odourless-daemon`main
odourless-daemon`main:
->  0x100008e88 <+0>:  pacibsp 
    0x100008e8c <+4>:  sub    sp, sp, #0x1a0            ; =0x1a0 
    0x100008e90 <+8>:  stp    x28, x27, [sp, #0x180]
    0x100008e94 <+12>: stp    x29, x30, [sp, #0x190]
Target 0: (odourless-daemon) stopped.
(lldb) n
Process 32227 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = instruction step over
    frame #0: 0x0000000100008e8c odourless-daemon`main + 4
odourless-daemon`main:
->  0x100008e8c <+4>:  sub    sp, sp, #0x1a0            ; =0x1a0 
    0x100008e90 <+8>:  stp    x28, x27, [sp, #0x180]
    0x100008e94 <+12>: stp    x29, x30, [sp, #0x190]
    0x100008e98 <+16>: add    x29, sp, #0x190           ; =0x190 
Target 0: (odourless-daemon) stopped.

... (next instruction) multiple times ...

(lldb) 
Process 32227 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = instruction step over
    frame #0: 0x0000000100008ed4 odourless-daemon`main + 76
odourless-daemon`main:
->  0x100008ed4 <+76>: bl     0x10000b1f8               ; Log::init(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
    0x100008ed8 <+80>: sub    x0, x29, #0x38            ; =0x38 
    0x100008edc <+84>: bl     0x1002d86cc               ; ___lldb_unnamed_symbol6485$$odourless-daemon
    0x100008ee0 <+88>: bl     0x1002dcfd8               ; symbol stub for: getuid
Target 0: (odourless-daemon) stopped.
(lldb) 
Process 32227 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x2000010051c840)
Note: Possible pointer authentication failure detected.
Found value that failed to authenticate at address=0x10051c840.

    frame #0: 0x000000010000d32c odourless-daemon`___lldb_unnamed_symbol284$$odourless-daemon + 60
odourless-daemon`___lldb_unnamed_symbol284$$odourless-daemon:
->  0x10000d32c <+60>: brk    #0xc472
    0x10000d330 <+64>: add    x9, x16, #0x38            ; =0x38 
    0x10000d334 <+68>: ldr    x8, [x16, #0x38]
    0x10000d338 <+72>: mov    x17, x9
Target 0: (odourless-daemon) stopped.
(lldb) ^D

The log file at /usr/local/var/.odourless_cage/daemon.log is never created.

@j1ah0ng j1ah0ng changed the title Starting daemon from GUI does not work Starting daemon causes segfault (arm64e, M1 mini, 2020) Jan 17, 2022
@xiaozhuai xiaozhuai reopened this Feb 16, 2022
@xiaozhuai
Copy link
Owner

duplicated #6

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

No branches or pull requests

2 participants