Popax21 / synaTudor

GNU Lesser General Public License v2.1
89 stars 10 forks source link

exit code 159 #3

Closed Etaash-mathamsetty closed 2 years ago

Etaash-mathamsetty commented 2 years ago

I am using arch linux with the latest of everything as of today

Hm. Can you reinstall after running meson configure -DUNMOUNTFS=false, and then after reproducing the crash run sudo coredumpctl debug and then backtrace?

how exactly would I do that btw? (nvm figured it out)

Etaash-mathamsetty commented 2 years ago

this is probably one of the most interesting errors I have ever seen (I am running 5.18.11 kernel btw)

Program terminated with signal SIGSYS, Bad system call.
#0  0x00007ffd34329872 in gettimeofday ()
Popax21 commented 2 years ago

Hm, seems like some versions of glibc seem to use this syscall to access time information. I'll add it to the whitelist real quick.

Popax21 commented 2 years ago

Pushed now, could you try again?

Etaash-mathamsetty commented 2 years ago

Pushed now, could you try again?

fixed! thank you for your help!

Popax21 commented 2 years ago

By the way you'll very likely want to do a clean reinstall (so completely delete your build directory and start from scratch) for security reasons - UNMOUNTFS has huge security implications and should only ever be disabled for debugging.

p-try commented 2 years ago

I have a very similar error, this time it's about clone3(). Here's my coredump:

           PID: 1671 (tudor_host)
           UID: 3333 (3333)
           GID: 3333 (3333)
        Signal: 31 (SYS)
     Timestamp: Thu 2022-07-21 19:22:23 CEST (46s ago)
  Command Line: tudor_host
    Executable: /usr/sbin/tudor/tudor_host
 Control Group: /system.slice/tudor-host-launcher.service
          Unit: tudor-host-launcher.service
         Slice: system.slice
       Boot ID: fb2f6954d0c6431c805a9eff4f1bc6c1
    Machine ID: f5d6e1c173fb432e91afca515aa1c9c4
      Hostname: Deanston-Ubuntu
       Storage: /var/lib/systemd/coredump/core.tudor_host.3333.fb2f6954d0c6431c805a9eff4f1bc6c1.1671.1658424143000000.zst (present)
     Disk Size: 1.0M
       Message: Process 1671 (tudor_host) of user 3333 dumped core.

                Found module linux-vdso.so.1 with build-id: 98e9f48cb6b66edb82741ee55e355401927a64b4
                Found module libudev.so.1 with build-id: 71c6dd2c37a71a30f69782a1cf7ee6c480764f6c
                Found module ld-linux-x86-64.so.2 with build-id: aa1b0b998999c397062e1016f0c95dc0e8820117
                Found module libc.so.6 with build-id: 89c3cb85f9e55046776471fed05ec441581d1969
                Found module libseccomp.so.2 with build-id: 5e29725d7f0bd8cb9a04f40eb45d6b75ca6bfbd2
                Found module libcap.so.2 with build-id: 9e11e3bca4b0a25d047cb36e933e1d727663cf8e
                Found module libusb-1.0.so.0 with build-id: 8974a74dbeb0e144e076801cc8d7dea1423597b0
                Found module libcrypto.so.3 with build-id: 60d206c3617ae7d35f62345a1431caf7c464033c
                Found module libtudor.so with build-id: 917b3ea3a44d2dbc2f22d2e9a9ae83f5891d9eba
                Found module tudor_host with build-id: 6044eac23595e9627f56c234f65253878295ec9c
                Stack trace of thread 1671:
                #0  0x00007f1cdd5269ed __clone3 (libc.so.6 + 0x1269ed)

GNU gdb (Ubuntu 12.0.90-0ubuntu1) 12.0.90
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/sbin/tudor/tudor_host...
[New LWP 1671]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `tudor_host'.
Program terminated with signal SIGSYS, Bad system call.
#0  clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:62
Popax21 commented 2 years ago

Thanks, will add it to the whitelist soon!

p-try commented 2 years ago

I'm not a C developer but from the code and the previous comments I have found out how to add the syscall to the whitelist. cant_fail(seccomp_rule_add(scmp_ctx, SCMP_ACT_ALLOW, SCMP_SYS(clone3), 0)); in sandbox.c Thank you again so much for this project. It is working now, I have already added my fingerprints in GNOME settings. Absolutely wonderful.

Popax21 commented 2 years ago

I'm not a C developer but from the code and the previous comments I have found out how to add the syscall to the whitelist. cant_fail(seccomp_rule_add(scmp_ctx, SCMP_ACT_ALLOW, SCMP_SYS(clone3), 0)); in sandbox.c Thank you again so much for this project. It is working now, I have already added my fingerprints in GNOME settings. Absolutely wonderful.

Glad you figured it out, but I would be a bit carefull, as clone3 also allows for new processes, while only new threads should be allowed. For now it works though.

Popax21 commented 2 years ago

Update: a proper fix has now been pushed.

IchMogle commented 2 years ago

I also get exit code 159. These are my logs: fprintd.log tudor.log

Popax21 commented 2 years ago

Hm. Can you reinstall after running meson configure -DUNMOUNTFS=false, and then after reproducing the crash run sudo coredumpctl debug and then backtrace?

Can you do the same?

IchMogle commented 2 years ago

My coredump:

           PID: 3993 (tudor_host)
           UID: 3333 (3333)
           GID: 3333 (3333)
        Signal: 31 (SYS)
     Timestamp: Sat 2022-07-23 14:15:09 CEST (2min 29s ago)
  Command Line: tudor_host
    Executable: /usr/sbin/tudor/tudor_host
 Control Group: /system.slice/tudor-host-launcher.service
          Unit: tudor-host-launcher.service
         Slice: system.slice
       Boot ID: 7d16d173fc814350b6f5e10dceb4a6f6
    Machine ID: c7a177ea368d4d84ac6931807a8a60ad
      Hostname: mo-ideapad
       Storage: /var/lib/systemd/coredump/core.tudor_host.3333.7d16d173fc814350b6f5e10dceb4a6f6.3993.1658578509000000.zst (present)
     Disk Size: 1.9M
       Message: Process 3993 (tudor_host) of user 3333 dumped core.

                Found module linux-vdso.so.1 with build-id: 8e8a518f3cc6d25156e7f0c6c164fed69a1130b7
                Found module libudev.so.1 with build-id: 71c6dd2c37a71a30f69782a1cf7ee6c480764f6c
                Found module ld-linux-x86-64.so.2 with build-id: aa1b0b998999c397062e1016f0c95dc0e8820117
                Found module libc.so.6 with build-id: 89c3cb85f9e55046776471fed05ec441581d1969
                Found module libseccomp.so.2 with build-id: 5e29725d7f0bd8cb9a04f40eb45d6b75ca6bfbd2
                Found module libcap.so.2 with build-id: 9e11e3bca4b0a25d047cb36e933e1d727663cf8e
                Found module libusb-1.0.so.0 with build-id: 8974a74dbeb0e144e076801cc8d7dea1423597b0
                Found module libcrypto.so.3 with build-id: 60d206c3617ae7d35f62345a1431caf7c464033c
                Found module libtudor.so with build-id: a53a4b6b9efab84df793540f369e1d1a096113f4
                Found module tudor_host with build-id: cfe21adff8f460854c503065bf4336c4c87425ac
                Stack trace of thread 3993:
                #0  0x00007f327f430ba6 __clone (libc.so.6 + 0x125ba6)

GNU gdb (Ubuntu 12.0.90-0ubuntu1) 12.0.90
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/sbin/tudor/tudor_host...
[New LWP 3993]
[New LWP 3994]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `tudor_host'.
Program terminated with signal SIGSYS, Bad system call.
#0  clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:83
83  ../sysdeps/unix/sysv/linux/x86_64/clone.S: No such file or directory.

And the most recent logs: fprintd.log tudor.log

Popax21 commented 2 years ago

My coredump:

           PID: 3993 (tudor_host)
           UID: 3333 (3333)
           GID: 3333 (3333)
        Signal: 31 (SYS)
     Timestamp: Sat 2022-07-23 14:15:09 CEST (2min 29s ago)
  Command Line: tudor_host
    Executable: /usr/sbin/tudor/tudor_host
 Control Group: /system.slice/tudor-host-launcher.service
          Unit: tudor-host-launcher.service
         Slice: system.slice
       Boot ID: 7d16d173fc814350b6f5e10dceb4a6f6
    Machine ID: c7a177ea368d4d84ac6931807a8a60ad
      Hostname: mo-ideapad
       Storage: /var/lib/systemd/coredump/core.tudor_host.3333.7d16d173fc814350b6f5e10dceb4a6f6.3993.1658578509000000.zst (present)
     Disk Size: 1.9M
       Message: Process 3993 (tudor_host) of user 3333 dumped core.

                Found module linux-vdso.so.1 with build-id: 8e8a518f3cc6d25156e7f0c6c164fed69a1130b7
                Found module libudev.so.1 with build-id: 71c6dd2c37a71a30f69782a1cf7ee6c480764f6c
                Found module ld-linux-x86-64.so.2 with build-id: aa1b0b998999c397062e1016f0c95dc0e8820117
                Found module libc.so.6 with build-id: 89c3cb85f9e55046776471fed05ec441581d1969
                Found module libseccomp.so.2 with build-id: 5e29725d7f0bd8cb9a04f40eb45d6b75ca6bfbd2
                Found module libcap.so.2 with build-id: 9e11e3bca4b0a25d047cb36e933e1d727663cf8e
                Found module libusb-1.0.so.0 with build-id: 8974a74dbeb0e144e076801cc8d7dea1423597b0
                Found module libcrypto.so.3 with build-id: 60d206c3617ae7d35f62345a1431caf7c464033c
                Found module libtudor.so with build-id: a53a4b6b9efab84df793540f369e1d1a096113f4
                Found module tudor_host with build-id: cfe21adff8f460854c503065bf4336c4c87425ac
                Stack trace of thread 3993:
                #0  0x00007f327f430ba6 __clone (libc.so.6 + 0x125ba6)

GNU gdb (Ubuntu 12.0.90-0ubuntu1) 12.0.90
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/sbin/tudor/tudor_host...
[New LWP 3993]
[New LWP 3994]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `tudor_host'.
Program terminated with signal SIGSYS, Bad system call.
#0  clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:83
83    ../sysdeps/unix/sysv/linux/x86_64/clone.S: No such file or directory.

And the most recent logs: fprintd.log tudor.log

Can you print a backtrace as well (using bt)?

IchMogle commented 2 years ago

My coredump:

           PID: 3993 (tudor_host)
           UID: 3333 (3333)
           GID: 3333 (3333)
        Signal: 31 (SYS)
     Timestamp: Sat 2022-07-23 14:15:09 CEST (2min 29s ago)
  Command Line: tudor_host
    Executable: /usr/sbin/tudor/tudor_host
 Control Group: /system.slice/tudor-host-launcher.service
          Unit: tudor-host-launcher.service
         Slice: system.slice
       Boot ID: 7d16d173fc814350b6f5e10dceb4a6f6
    Machine ID: c7a177ea368d4d84ac6931807a8a60ad
      Hostname: mo-ideapad
       Storage: /var/lib/systemd/coredump/core.tudor_host.3333.7d16d173fc814350b6f5e10dceb4a6f6.3993.1658578509000000.zst (present)
     Disk Size: 1.9M
       Message: Process 3993 (tudor_host) of user 3333 dumped core.

                Found module linux-vdso.so.1 with build-id: 8e8a518f3cc6d25156e7f0c6c164fed69a1130b7
                Found module libudev.so.1 with build-id: 71c6dd2c37a71a30f69782a1cf7ee6c480764f6c
                Found module ld-linux-x86-64.so.2 with build-id: aa1b0b998999c397062e1016f0c95dc0e8820117
                Found module libc.so.6 with build-id: 89c3cb85f9e55046776471fed05ec441581d1969
                Found module libseccomp.so.2 with build-id: 5e29725d7f0bd8cb9a04f40eb45d6b75ca6bfbd2
                Found module libcap.so.2 with build-id: 9e11e3bca4b0a25d047cb36e933e1d727663cf8e
                Found module libusb-1.0.so.0 with build-id: 8974a74dbeb0e144e076801cc8d7dea1423597b0
                Found module libcrypto.so.3 with build-id: 60d206c3617ae7d35f62345a1431caf7c464033c
                Found module libtudor.so with build-id: a53a4b6b9efab84df793540f369e1d1a096113f4
                Found module tudor_host with build-id: cfe21adff8f460854c503065bf4336c4c87425ac
                Stack trace of thread 3993:
                #0  0x00007f327f430ba6 __clone (libc.so.6 + 0x125ba6)

GNU gdb (Ubuntu 12.0.90-0ubuntu1) 12.0.90
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/sbin/tudor/tudor_host...
[New LWP 3993]
[New LWP 3994]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `tudor_host'.
Program terminated with signal SIGSYS, Bad system call.
#0  clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:83
83  ../sysdeps/unix/sysv/linux/x86_64/clone.S: No such file or directory.

And the most recent logs: fprintd.log tudor.log

Can you print a backtrace as well (using bt)?

#0  clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:83
#1  0x00007f47201cca9f in __GI___clone_internal (cl_args=cl_args@entry=0x7ffdd1bc7290, func=func@entry=0x7f472013a850 <start_thread>, 
    arg=arg@entry=0x7f471f6ca640) at ../sysdeps/unix/sysv/linux/clone-internal.c:83
#2  0x00007f472013a759 in create_thread (pd=pd@entry=0x7f471f6ca640, attr=attr@entry=0x7ffdd1bc73b0, 
    stopped_start=stopped_start@entry=0x7ffdd1bc73ae, stackaddr=stackaddr@entry=0x7f471eeca000, stacksize=8388224, 
    thread_ran=thread_ran@entry=0x7ffdd1bc73af) at ./nptl/pthread_create.c:295
#3  0x00007f472013b280 in __pthread_create_2_1 (newthread=<optimized out>, attr=<optimized out>, start_routine=<optimized out>, 
    arg=<optimized out>) at ./nptl/pthread_create.c:828
#4  0x00007f4720785e19 in CreateThread (security_attrs=0x0, stack_size=0, start_proc=0x7f471f77ffc0, param=0x5621db5121e0, flags=0, 
    id=0x7ffdd1bc7610) at ../libtudor/src/winapi/thread.c:96
#5  0x00007f471f78015b in ?? ()
#6  0x0000000000000000 in ?? ()
Popax21 commented 2 years ago

./nptl/pthread_create.c:295

Thanks, can you also dump all registers (using info registers)?

IchMogle commented 2 years ago
rax            0x38                56
rbx            0x7ffe36864880      140729813190784
rcx            0x7f58aa8c6ba6      140018795178918
rdx            0x7f58a9dc5910      140018783639824
rsi            0x7f58a9dc4e70      140018783637104
rdi            0x3d0f00            4001536
rbp            0xffffffffffffff00  0xffffffffffffff00
rsp            0x7ffe36864828      0x7ffe36864828
r8             0x7f58a9dc5640      140018783639104
r9             0x7f58a9dc5640      140018783639104
r10            0x7f58a9dc5910      140018783639824
r11            0x202               514
r12            0x7f58a9dc5640      140018783639104
r13            0x3d                61
r14            0x7f58aa835850      140018794584144
r15            0x7ffe368649e0      140729813191136
rip            0x7f58aa8c6ba6      0x7f58aa8c6ba6 <clone+54>
eflags         0x202               [ IF ]
cs             0x33                51
ss             0x2b                43
ds             0x0                 0
es             0x0                 0
fs             0x0                 0
gs             0x0                 0
Popax21 commented 2 years ago
rax            0x38                56
rbx            0x7ffe36864880      140729813190784
rcx            0x7f58aa8c6ba6      140018795178918
rdx            0x7f58a9dc5910      140018783639824
rsi            0x7f58a9dc4e70      140018783637104
rdi            0x3d0f00            4001536
rbp            0xffffffffffffff00  0xffffffffffffff00
rsp            0x7ffe36864828      0x7ffe36864828
r8             0x7f58a9dc5640      140018783639104
r9             0x7f58a9dc5640      140018783639104
r10            0x7f58a9dc5910      140018783639824
r11            0x202               514
r12            0x7f58a9dc5640      140018783639104
r13            0x3d                61
r14            0x7f58aa835850      140018794584144
r15            0x7ffe368649e0      140729813191136
rip            0x7f58aa8c6ba6      0x7f58aa8c6ba6 <clone+54>
eflags         0x202               [ IF ]
cs             0x33                51
ss             0x2b                43
ds             0x0                 0
es             0x0                 0
fs             0x0                 0
gs             0x0                 0

Thanks, I just pushed something to try to fix this. Can you try again?

IchMogle commented 2 years ago

Yep, seems to work fine now. Thank you so much, for your effort and patience! :)