theinvisible / openfortigui

VPN-GUI to connect to Fortigate-Hardware, based on openfortivpn
https://hadler.me/linux/openfortigui/
GNU General Public License v3.0
490 stars 54 forks source link

Segfault on Ubuntu18 #99

Closed pegii86 closed 11 months ago

pegii86 commented 4 years ago

I have Ubuntu 18: Linux WSW-N035 5.0.0-32-generic #34~18.04.2-Ubuntu SMP Thu Oct 10 10:36:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

and I see segfault during connection:

Nov 7 16:17:37 WSW-N035 kernel: [ 820.702247] openfortigui[3205]: segfault at 12a0 ip 00005644aab69cd4 sp 00007fff43c34928 error 4 in openfortigui[5644aab17000+e9000] Nov 7 16:17:37 WSW-N035 kernel: [ 820.702258] Code: b2 6d fc ff 66 90 48 83 ec 08 e8 c7 f4 01 00 31 ff 48 83 c4 08 e9 0c 5a fc ff 66 90 66 2e 0f 1f 84 00 00 00 00 00 48 8b 7f 10 a7 a0 12 00 00 66 0f 1f 44 00 00 41 57 41 56 41 55 41 54 55 53

Checked on openfortiGUI 0.8.0 and 0.8.1

boospy commented 4 years ago

If you start the application on CMD with "sudo", did the app crash again?

theinvisible commented 4 years ago

Hi, the whole app crashes or only the vpn worker process?

To help further please enable debug log in main preferences / vpn profile and post the specific logs.

jbrzozoski commented 4 years ago

My previously working setup started hitting this same issue after upgrading Ubuntu to 19.10.... I'm apparently on a really old version of openfortiGUI though... lemme upgrade that first and then get you some logs... (I actually did a quick run with debug logging turned on with the old version of openfortigui, and in my case the main app kept running and the vpn worker crashed. there was NO logging output for the VPN, only the main application... but, like i said, openfortigui 0.7.4)

jbrzozoski commented 4 years ago

Alright, I'm back... System info: Ubuntu 19.10 with kernel 5.3.0-29-generic I cloned git from the current head (commit 40cf98e), built using the debug instructions on the main webpage, and ran it with debug logging enabled. The main openfortigui.log shows this:

Feb 7 21:05:17 openfortiGUI::Debug: "start-main::"
Feb 7 21:05:17 openfortiGUI::Warning: QMetaObject::connectSlotsByName: No matching signal for on_btnAddVPN_clicked()
Feb 7 21:05:17 openfortiGUI::Warning: QMetaObject::connectSlotsByName: No matching signal for on_btnDeleteVPN_clicked()
Feb 7 21:05:17 openfortiGUI::Warning: QMetaObject::connectSlotsByName: No matching signal for on_btnEditVPN_clicked()
Feb 7 21:05:17 openfortiGUI::Warning: QMetaObject::connectSlotsByName: No matching signal for on_btnCopyVPN_clicked()
Feb 7 21:05:17 openfortiGUI::Warning: QMetaObject::connectSlotsByName: No matching signal for on_btnAddGroup_clicked()
Feb 7 21:05:17 openfortiGUI::Warning: QMetaObject::connectSlotsByName: No matching signal for on_btnDeleteGroup_clicked()
Feb 7 21:05:17 openfortiGUI::Warning: QMetaObject::connectSlotsByName: No matching signal for on_btnEditGroup_clicked()
Feb 7 21:05:17 openfortiGUI::Warning: QMetaObject::connectSlotsByName: No matching signal for on_btnCopyGroup_clicked()
Feb 7 21:05:17 openfortiGUI::Warning: QObject::connect: No such signal vpnLogger::finished() in vpnmanager.cpp:46
Feb 7 21:05:17 openfortiGUI::Warning: QObject::connect: No such signal vpnLogger::finished() in vpnmanager.cpp:47
Feb 7 21:05:17 openfortiGUI::Debug: tiConfVpnProfile::readVpnProfiles() -> vpnprofile found: "/home/justin/.openfortigui/vpnprofiles/CTS Cincinnati.conf"
Feb 7 21:05:17 openfortiGUI::Debug: tiConfVpnProfile::readVpnProfiles() -> vpnprofile found: "/home/justin/.openfortigui/vpnprofiles/AWL Milwaukee.conf"
Feb 7 21:05:17 openfortiGUI::Debug: MainWindow::refreshVpnProfileList() -> vpnprofiles found:: "CTS Cincinnati"
Feb 7 21:05:17 openfortiGUI::Debug: MainWindow::refreshVpnProfileList() -> vpnprofiles found:: "AWL Milwaukee"
Feb 7 21:05:17 openfortiGUI::Debug: tiConfVpnProfile::readVpnProfiles() -> vpnprofile found: "/home/justin/.openfortigui/vpnprofiles/CTS Cincinnati.conf"
Feb 7 21:05:17 openfortiGUI::Debug: tiConfVpnProfile::readVpnProfiles() -> vpnprofile found: "/home/justin/.openfortigui/vpnprofiles/AWL Milwaukee.conf"
Feb 7 21:05:23 openfortiGUI::Debug: static bool LibSecretKeyring::deletePassword(const QString&, const QString&, QKeychain::JobPrivate*)
Feb 7 21:05:23 openfortiGUI::Debug: static bool LibSecretKeyring::deletePassword(const QString&, const QString&, QKeychain::JobPrivate*)
Feb 7 21:05:26 openfortiGUI::Debug: active-tab:: 0
Feb 7 21:05:26 openfortiGUI::Debug: start vpn: "CTS Cincinnati" active-tab:: 0
Feb 7 21:05:26 openfortiGUI::Debug: Start vpn:: "CTS Cincinnati"
Feb 7 21:05:26 openfortiGUI::Debug: add logger "/home/justin/.openfortigui/main.conf"
Feb 7 21:05:26 openfortiGUI::Debug: vpnManager::onClientConnected()
Feb 7 21:05:26 openfortiGUI::Debug: client api helo command:: 0 ::name:: "CTS Cincinnati"
Feb 7 21:05:26 openfortiGUI::Debug: client disconnected:: "CTS Cincinnati"
Feb 7 21:05:26 openfortiGUI::Debug: vpnManager::onClientVPNStatusChanged() "CTS Cincinnati" status 0
Feb 7 21:05:26 openfortiGUI::Debug: MainWindow::onClientVPNStatusChanged:: "CTS Cincinnati" ::status:: 0
Feb 7 21:05:26 openfortiGUI::Debug: VPN process  "CTS Cincinnati"  error occurred!
Feb 7 21:05:26 openfortiGUI::Debug: VPN process  "CTS Cincinnati"  finished!

The VPN logs are not being updated at all. Did I miss an option for them or is that sub-process not getting to the point of starting the log? Dmesg output shows this around that time:

[Fri Feb  7 21:05:25 2020] openfortigui[7001]: segfault at 70 ip 00007f1e1caf2b14 sp 00007ffec1e6add8 error 4 in libQt5Core.so.5.12.4[7f1e1c9c9000+2df000]
[Fri Feb  7 21:05:25 2020] Code: 48 89 0f 8b 11 83 c2 01 83 fa 01 77 09 c3 0f 1f 84 00 00 00 00 00 f0 83 01 01 c3 90 66 2e 0f 1f 84 00 00 00 00 00 f3 0f 1e fa <48> 8b 0e 48 89 f8 48 89 0f 8b 11 83 c2 01 83 fa 01 77 09 c3 0f 1f

I'm willing to compile/run test builds if you want to send me patches.

pegii86 commented 4 years ago

After upgrade to openfortiGUI 0.8.2 problem stopped occurring on my system.

jbrzozoski commented 4 years ago

Digging a bit more. Man I am rusty w/ gdb...

(gdb) run
Starting program: /home/justin/work/openfortigui/openfortigui/openfortigui --start-vpn --vpn-name CTS\ Cincinnati --main-config /home/justin/.openfortigui/main.conf
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff6a43ae4 in QDir::fromNativeSeparators(QString const&) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
(gdb) backtrace
#0  0x00007ffff6a43ae4 in QDir::fromNativeSeparators(QString const&) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#1  0x00007ffff6a57877 in QFileInfo::QFileInfo(QString const&) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#2  0x000055555559f237 in vpnProcess::checkVPNSettings (this=0x7fffffffd120, profile=0x0) at proc/vpnprocess.cpp:185
#3  0x000055555559e7dc in vpnProcess::startVPN (this=0x7fffffffd120) at proc/vpnprocess.cpp:91
#4  0x00005555555c1948 in vpnProcess::qt_static_metacall (_o=0x7fffffffd120, _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0x7fffffffcbb0) at moc_vpnprocess.cpp:95
#5  0x00007ffff6b483f8 in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#6  0x00007ffff6b556d3 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#7  0x00007ffff6b48de5 in QObject::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#8  0x00007ffff6b1ca07 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#9  0x00007ffff6b73990 in QTimerInfoList::activateTimers() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#10 0x00007ffff6b7426c in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#11 0x00007ffff639c84d in g_main_context_dispatch () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#12 0x00007ffff639cad0 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#13 0x00007ffff639cb73 in g_main_context_iteration () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#14 0x00007ffff6b74635 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#15 0x00007ffff6b1b5cb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#16 0x00007ffff6b23336 in QCoreApplication::exec() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#17 0x000055555556eaab in main (argc=6, argv=0x7fffffffe558) at main.cpp:170
jbrzozoski commented 4 years ago

Meh. That is the most mundane location for a failure, trying to use the Qt library to access file info. I've tried it with a few different settings for the pppd log file (the file being examined when the segfault occurs) and it doesn't seem to help. I'm suspicious that I've somehow got mismatched libraries... But I just recompiled on my machine.

Still trying to figure this out... Currently staring at the output of ldd --verbose:

./openfortigui:
    libgcc_s.so.1 (GCC_3.0) => /lib/x86_64-linux-gnu/libgcc_s.so.1
    libutil.so.1 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/libutil.so.1
    libQt5Network.so.5 (Qt_5) => /usr/lib/x86_64-linux-gnu/libQt5Network.so.5
    libssl.so.1.1 (OPENSSL_1_1_0) => /usr/lib/x86_64-linux-gnu/libssl.so.1.1
    libcrypto.so.1.1 (OPENSSL_1_1_0) => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1
    libstdc++.so.6 (GLIBCXX_3.4.21) => /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    libstdc++.so.6 (CXXABI_1.3) => /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    libstdc++.so.6 (GLIBCXX_3.4) => /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    libc.so.6 (GLIBC_2.14) => /lib/x86_64-linux-gnu/libc.so.6
    libc.so.6 (GLIBC_2.4) => /lib/x86_64-linux-gnu/libc.so.6
    libc.so.6 (GLIBC_2.3) => /lib/x86_64-linux-gnu/libc.so.6
    libc.so.6 (GLIBC_2.7) => /lib/x86_64-linux-gnu/libc.so.6
    libc.so.6 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/libc.so.6
    libQt5Core.so.5 (Qt_5.12) => /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
    libQt5Core.so.5 (Qt_5) => /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
    libQt5Widgets.so.5 (Qt_5) => /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
    libQt5Gui.so.5 (Qt_5) => /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
    libpthread.so.0 (GLIBC_2.3.2) => /lib/x86_64-linux-gnu/libpthread.so.0
    libpthread.so.0 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/libpthread.so.0
dennisoehme commented 4 years ago

Having the same issue since yesterday. I'm using version 0.8.0* on arch linux. Seems that any update breaks OpenfortiGUI. 0.8.2 doesn't fix the error for now. Try to investigate into this issue later this day.

*0.8.0 ist the latest version in AUR

setcolmbia commented 4 years ago

I have the same issue on LinuxMint (Based on ubuntu 18.04) using the latest version (0.8.2-1 AMD64). Running with "sudo" does not help.

Enteris commented 4 years ago

If I can add more information on this : Ubuntu 18.04. Crashing on certain VPN configuration (which I'm not the owner of) but here is the GDB backtrace :

syslogs seems to refer to a corrupted List

$ gdb openfortigui GNU gdb (Ubuntu 8.1-0ubuntu3.2) 8.1.0.20180409-git Copyright (C) 2018 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: http://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"...

warning: /home/jabeaumont/repository/pwndbg/gdbinit.py: No such file or directory Reading symbols from openfortigui...(no debugging symbols found)...done. (gdb) run Starting program: /usr/bin/openfortigui [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [New Thread 0x7fffeab00700 (LWP 7683)] [New Thread 0x7fffe0539700 (LWP 7687)] [New Thread 0x7fffdfd38700 (LWP 7688)] [New Thread 0x7fffde2a1700 (LWP 7689)] [New Thread 0x7fffdcbb9700 (LWP 7695)] [New Thread 0x7fffcd287700 (LWP 7697)]

Thread 1 "openfortigui" received signal SIGSEGV, Segmentation fault. __memmove_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:249 249 ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S: No such file or directory. (gdb) bt

0 0x00007ffff4db0b1f in __memmove_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:249

1 0x00007ffff5882fa6 in QByteArray::reallocData(unsigned int, QFlags) ()

at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5

2 0x00007ffff58f2270 in QRingBuffer::reserve(long long) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5

3 0x00007ffff59dec17 in () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5

4 0x00007ffff59df250 in () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5

5 0x00007ffff5a8c555 in QMetaObject::activate(QObject*, int, int, void**) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5

6 0x00007ffff5a989d8 in QSocketNotifier::activated(int, QSocketNotifier::QPrivateSignal) ()

at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5

7 0x00007ffff5a98da2 in QSocketNotifier::event(QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5

8 0x00007ffff6b6783c in QApplicationPrivate::notify_helper(QObject, QEvent) ()

at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5

9 0x00007ffff6b6f104 in QApplication::notify(QObject, QEvent) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5

10 0x00007ffff5a5d8d8 in QCoreApplication::notifyInternal2(QObject, QEvent) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5

11 0x00007ffff5ab74ed in () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5

12 0x00007ffff2d48417 in g_main_context_dispatch () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0

13 0x00007ffff2d48650 in () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0

14 0x00007ffff2d486dc in g_main_context_iteration () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0

15 0x00007ffff5ab688f in QEventDispatcherGlib::processEvents(QFlags) ()

at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5

16 0x00007ffff5a5b90a in QEventLoop::exec(QFlags) ()

at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5

17 0x00007ffff5a649b4 in QCoreApplication::exec() () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5

18 0x000055555557070f in ()

19 0x00007ffff4c43b97 in __libc_start_main (main=

0x55555556fd10, argc=1, argv=0x7fffffffd908, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffd8f8) at ../csu/libc-start.c:310

20 0x0000555555570eca in ()

GuyKroizman commented 4 years ago

For me the issue is fixed by going to the setting and checking the checkbox for: SUDO -E Option

theinvisible commented 4 years ago

Anyone else here in the thread can confirm this is solved with the SUDO -E Option?

setcolmbia commented 4 years ago

In my case the issue continues, even with the option. I had to use an older version of it (https://hadler.me/linux/forticlient-sslvpn-deb-packages/). I use Ubuntu 18.04LTS.

seboss666 commented 4 years ago

I'm using Plasma 5/KDE on Manjaro and launching it from the '.desktop' file modified to use kdesu. Tried to switch to "sudo -E", but I have no password prompt and the program does not start. Running as user does not create the network interface so it's useless.

It crashes from time to time, again a segfault, pointing to something in libqt5core :

[mar. juin 23 11:07:36 2020] openfortigui[2122]: segfault at 55c84a5d78f8 ip 00007f4c3bb22806 sp 00007fffe8f5c0d0 error 4 in libQt5Core.so.5.15.0[7f4c3baa2000+306000]
[mar. juin 23 11:07:36 2020] Code: 00 31 d2 be 08 00 00 00 bf 10 00 00 00 67 e8 51 9d fc ff 48 89 03 48 63 50 04 48 8b 48 10 48 c1 e2 04 48 8d 5c 0a f0 48 01 c3 <48> 8b 13 8b 02 83 f8 01 76 0c 48 89 df 67 e8 27 ef ff ff 48 8b 13

This happens with 0.8.x or the recently released 0.9.0. AUR package compiles the sources with warnings, but it works (it has always been with warnings since I've began to use it last year). My system was already running on the same versions the packages compiled against, just to be precise :)

JLopeDeB commented 3 years ago

Anyone else here in the thread can confirm this is solved with the SUDO -E Option?

I had mixed results. Currently having 2 connections, one of them was fixed with the "sudo" option, one of them not. Problem started after migrating Linux Mint from 19.3 to 20. App version is 0.9.1.

theinvisible commented 11 months ago

Ubuntu 18.04 is out of LTS support, will close this