Bug 265056 - net/remmina: Crashing immediately on FreeBSD 13.1 and 13-STABLE
Summary: net/remmina: Crashing immediately on FreeBSD 13.1 and 13-STABLE
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Fernando Apesteguía
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-06 06:08 UTC by O. Hartmann
Modified: 2023-03-05 12:55 UTC (History)
6 users (show)

See Also:
bugzilla: maintainer-feedback? (fernape)
fernape: merge-quarterly+


Attachments
Patch to update net/remmina to 1.4.27 (9.22 KB, patch)
2022-07-07 15:20 UTC, Fernando Apesteguía
fernape: maintainer-approval+
Details | Diff
Make python dependency optional and move it to USES (2.07 KB, patch)
2022-07-12 10:21 UTC, Vladimir Druzenko
no flags Details | Diff
Patch to fix segfault (594 bytes, patch)
2023-03-02 22:04 UTC, Fernando Apesteguía
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description O. Hartmann 2022-07-06 06:08:52 UTC
net/remmina (remmina-1.4.25), installed on FreeBSD 13.1-RELEASE releng/13.1-n250148-fc952ac2212 GENERIC amd64, is silently crashing recently installed via the "latest" official pkg repository. The host in question is a guest within a VBox hosted by a special Linux of my employer. 
The same behaviour I see on a FreeBSD 13-STABLE, custom kernel, most recent and with home-brewn packages (poudriere/pkg server). On the FreeBSD 13-STABLE box with its packages I saw this strange behaviour around six weeks ago the first time. Since we have customized package configs I'd decided to wait for a full build cycle on the poudriere host after cleaning all packages, but until now, the problems didn't vanish. 
Now, on official package sites and official 13.1-RELENG-p0 installations, I'm facing the problem also on bare-metal installations as well as VBox installations, where FreeBSD is the guest OS.

I'm sorry, I can not provide more details, since the remmina client is cashing silently after popping up for a few seconds, no chance to select any configured target.
Comment 1 O. Hartmann 2022-07-06 06:16:13 UTC
Addendum:
[Taken from the VBox host. Can not provide core dump due to restrictions]

ohartmann@host:~ $ remmina
remmina-Message: 08:14:25.626: Remmina does not log all output statements. Turn on more verbose output by using "G_MESSAGES_DEBUG=all" as an environment variable.
More info available on the Remmina wiki at:
https://gitlab.com/Remmina/Remmina/-/wikis/Usage/Remmina-debugging
Load modules from /usr/local/lib/remmina/plugins
Remmina plugin glibsecret (type=Secret) has been registered, but is not yet initialized/activated. The initialization order is 2000.
The glibsecret secret plugin has been initialized and it will be your default secret plugin

(org.remmina.Remmina:8051): GLib-CRITICAL **: 08:14:25.885: g_ascii_strdown: assertion 'str != NULL' failed

(org.remmina.Remmina:8051): GLib-CRITICAL **: 08:14:25.885: g_strrstr: assertion 'haystack != NULL' failed

(org.remmina.Remmina:8051): GLib-CRITICAL **: 08:14:25.885: g_strrstr: assertion 'haystack != NULL' failed

(org.remmina.Remmina:8051): GLib-CRITICAL **: 08:14:25.885: g_strrstr: assertion 'haystack != NULL' failed

(org.remmina.Remmina:8051): GLib-CRITICAL **: 08:14:25.885: g_strrstr: assertion 'haystack != NULL' failed

(org.remmina.Remmina:8051): Gtk-WARNING **: 08:14:26.035: gtk_menu_attach_to_widget(): menu already attached to GtkMenuItem
**
GLib-GIO:ERROR:../gio/gsocketclient.c:1982:g_socket_client_enumerator_callback: assertion failed: (data->error_info->best_error)
Bail out! GLib-GIO:ERROR:../gio/gsocketclient.c:1982:g_socket_client_enumerator_callback: assertion failed: (data->error_info->best_error)
Abort trap (core dumped)
Comment 2 Fernando Apesteguía freebsd_committer freebsd_triage 2022-07-06 12:26:47 UTC
Thanks for the report.

Remmina was last updated in May. I think this might be related to any of the plugins remmina itself uses. Nevertheless, it should not crash like that, an error message and graceful shutdown would be nice.

1.4.27 is out: https://gitlab.com/Remmina/Remmina/-/releases

We can try to update and see if that fixes the problem. It will take me a while. My machine has multiple ports queued already :S
Comment 3 Fernando Apesteguía freebsd_committer freebsd_triage 2022-07-07 15:20:43 UTC
Created attachment 235107 [details]
Patch to update net/remmina to 1.4.27

I can not reproduce your error on FreeBSD 13.1.
Would you try this patch to update to 1.4.27?
Comment 4 Graham Perrin freebsd_committer freebsd_triage 2022-07-07 20:03:04 UTC
(In reply to O. Hartmann from comment #0)

> net/remmina (remmina-1.4.25), installed on FreeBSD 13.1-RELEASE 
> releng/13.1-n250148-fc952ac2212 GENERIC amd64, is silently crashing 
> recently installed via the "latest" official pkg repository. …

Crash-free here in KDE Plasma on 13.1-RELEASE. 

----

Side note: four of the packages that are installed for remmina are subsequently removable with pkg autoremove. 

root@fuji:~ # pkg autoremove
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 4 packages:

Installed packages to be REMOVED:
        portaudio: 19.6.0_6,1
        python38: 3.8.13_2
        sndio: 1.8.1
        tcl86: 8.6.12

Number of packages to be removed: 4

The operation will free 128 MiB.

Proceed with deinstalling packages? [y/N]: y
[1/4] Deinstalling sndio-1.8.1...
[1/4] Deleting files for sndio-1.8.1: 100%
==> You should manually remove the "_sndio" user. 
==> You should manually remove the "_sndio" group 
[2/4] Deinstalling python38-3.8.13_2...
[2/4] Deleting files for python38-3.8.13_2: 100%
[3/4] Deinstalling portaudio-19.6.0_6,1...
[3/4] Deleting files for portaudio-19.6.0_6,1: 100%
[4/4] Deinstalling tcl86-8.6.12...
[4/4] Deleting files for tcl86-8.6.12: 100%
root@fuji:~ # tail -f -n 0 /var/log/messages
^C     
root@fuji:~ # date 
Thu Jul  7 20:59:44 BST 2022
root@fuji:~ # pkg -vv | grep -e url -e enabled
    url             : "pkg+http://pkg0.pkt.freebsd.org/FreeBSD:13:amd64/latest",
    enabled         : yes,
    url             : "file:///usr/local/poudriere/data/packages/thirteen-default",
    enabled         : yes,
root@fuji:~ # uname -aKU
FreeBSD fuji 13.1-RELEASE FreeBSD 13.1-RELEASE releng/13.1-n250148-fc952ac2212 GENERIC amd64 1301000 1301000
root@fuji:~ #
Comment 5 Fernando Apesteguía freebsd_committer freebsd_triage 2022-07-11 05:32:27 UTC
Ping
Comment 6 Graham Perrin freebsd_committer freebsd_triage 2022-07-12 06:17:57 UTC
(In reply to Graham Perrin from comment #4)

> … Side note: …

I took this elsewhere: 

pkg-autoremove(8): portaudio, python38, sndio and tcl86
<https://lists.freebsd.org/archives/freebsd-questions/2022-July/001499.html>
Comment 7 Vladimir Druzenko freebsd_committer freebsd_triage 2022-07-12 10:21:36 UTC
Created attachment 235211 [details]
Make python dependency optional and move it to USES

Use mandatory dependency on python with force version isn't good idea, IMHO: LIB_DEPENDS=libpython3.9.so:lang/python39
Replaced with optional PYTHON_USES=python

Tested on 13.1 amd64 with PYTHON ON and OFF: check-plist, install, run.
Comment 8 Fernando Apesteguía freebsd_committer freebsd_triage 2022-07-12 11:23:00 UTC
Thanks for the patch.

Would you mind opening a separate issue for this? I will close this one in a few days with Feedback Timeout if the OP doesn't show up.

Thanks!
Comment 9 O. Hartmann 2022-07-12 12:06:17 UTC
(In reply to Fernando Apesteguía from comment #8)

Here I am ...
Comment 10 O. Hartmann 2022-07-12 12:09:20 UTC
On boxes I can compile remmina via make/manually and the OS is also manually maintained (CURRENT and 13-STABLE), I do not have any issue, even with the patch (we use windowmaker on most systems, nothing more resouce consuming, if this matters - I mention this because KDE has been mentioned ...).

I havn't had a chance to appl;y the patch on one of our poudriere builders since I need to wait for the recent cycle to be ready - I can check tommorow for a application possible.
Comment 11 Vladimir Druzenko freebsd_committer freebsd_triage 2022-07-12 16:45:31 UTC
(In reply to Fernando Apesteguía from comment #8)
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=265174
Comment 12 O. Hartmann 2022-07-16 08:08:25 UTC
Version 1.4.27 is still crashing, this time in a verys obscure way.

On hosts with traditinal make built ports (CURRENT, most recent) as well as 13-STABLE (most recent as of Friday `5th July, those are the faster boxes in our portfolio, so I did a "portmaster -df" ensure to build everything):

remmina is now not crashing when opening up as reported initially in this PR, now I can see the ssh terminal awaiting keyboard input. When typing the first key, remmina dies immediately. Those connections are SSH terminals with a saved password, so I see the login greeting from the remote host, but hitting any key immediately let remmina die. The same with ssh public key. Login is all right, typing let the terminal/remmina die immediately.
Comment 13 Fernando Apesteguía freebsd_committer freebsd_triage 2022-07-16 15:50:43 UTC
Are you connecting through a proxy? What version of GLib do you have?
I think it might be related to this bug:https://gitlab.gnome.org/GNOME/glib/-/issues/2597
Comment 14 Fernando Apesteguía freebsd_committer freebsd_triage 2022-07-19 05:24:14 UTC
This has been just committed to the tree: https://cgit.freebsd.org/ports/commit/?id=943a699e47d7205726f1f77983fef0b5e6c82a56

It contains several fixes: https://gitlab.gnome.org/GNOME/glib/-/tags/2.72.3

Would you try again?
Comment 15 Fernando Apesteguía freebsd_committer freebsd_triage 2022-07-22 07:32:34 UTC
Any news on this?
Comment 16 Fernando Apesteguía freebsd_committer freebsd_triage 2022-08-02 05:37:34 UTC
ping!
Comment 17 O. Hartmann 2022-08-04 05:25:12 UTC
Pong!

I have tight time constraints and managing to deal with "overlays" in poudriere is a pain in the arse. Got this to work now and I'll report back as soon as I have patched, built and tested ...
Comment 18 mururoa 2022-08-11 14:46:05 UTC
Hi,
On GhostBSD (up to date, FreeBSD 13.1-Stable) I have a different style of crash.
If I start an ssh session with remmina, all is good until I enter first character. At that moment remmina crash.
--> kernel: pid 84269 (remmina), jid 0, uid 1002: exited on signal 11
I tried package and port; same behavior.
But if I use RDP and not ssh there is no problem ...
Comment 19 Fernando Apesteguía freebsd_committer freebsd_triage 2022-08-15 18:03:37 UTC
I was able to reproduce this. It seems the a corruption when invoking a callback for the ssh plugin.
Comment 20 Ferenc Gal 2022-08-17 00:26:46 UTC
Experience the crashing also but my end when using the VNC plugin. First time the connection goes well but after a disconnect, if i try to connect to the same host again the result is a core dump:

remmina-Message: 02:24:27.271: Remmina does not log all output statements. Turn on more verbose output by using "G_MESSAGES_DEBUG=all" as an environment variable.
More info available on the Remmina wiki at:
https://gitlab.com/Remmina/Remmina/-/wikis/Usage/Remmina-debugging
Load modules from /usr/local/lib/remmina/plugins

(org.remmina.Remmina:3626): GLib-GObject-WARNING **: 02:24:27.500: invalid (NULL) pointer instance

(org.remmina.Remmina:3626): GLib-GObject-CRITICAL **: 02:24:27.500: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed
Warning: Remmina is running without a secret plugin. Passwords will be saved in a less secure way.

(org.remmina.Remmina:3626): Gtk-WARNING **: 02:24:27.527: gtk_menu_attach_to_widget(): menu already attached to GtkMenuItem
Bus error (core dumped)
Comment 21 Fernando Apesteguía freebsd_committer freebsd_triage 2022-08-17 05:32:26 UTC
The invocation of the callback is completely corrupted.

Thread 53 received signal SIGSEGV, Segmentation fault.
Invalid permissions for mapped object.
[Switching to LWP 101845 of process 1657]
0x00000000002c8e96 in remimna_ssh_cp_to_ch_cb (fd=<error reading variable: Cannot access memory at address 0x7fffdf3f7e58>, revents=<error reading variable: Cannot access memory at address 0x7fffdf3f7e54>, userdata=<error reading variable: Cannot access memory at address 0x7fffdf3f7e48>) at /wrkdirs/usr/ports/net/remmina/work-default/Remmina-9d409a3556c8c2759a376b4f4ac5149db7aacf4f/src/remmina_ssh.c:478
478     /wrkdirs/usr/ports/net/remmina/work-default/Remmina-9d409a3556c8c2759a376b4f4ac5149db7aacf4f/src/remmina_ssh.c: No such file or directory.
(gdb) info threads 
  Id   Target Id                                 Frame 
  1    LWP 100789 of process 1657                0x0000000800b72db8 in ?? () from /usr/local/bin/../lib/libgtk-3.so.0
  2    LWP 101794 of process 1657 "pool-spawner" 0x0000000801b1db6c in ?? () from /lib/libthr.so.3
  3    LWP 101795 of process 1657 "gmain"        0x0000000801c7663a in _poll () from /lib/libc.so.7
  4    LWP 101796 of process 1657 "gdbus"        0x0000000801c7663a in _poll () from /lib/libc.so.7
* 53   LWP 101845 of process 1657                0x00000000002c8e96 in remimna_ssh_cp_to_ch_cb (
    fd=<error reading variable: Cannot access memory at address 0x7fffdf3f7e58>, 
    revents=<error reading variable: Cannot access memory at address 0x7fffdf3f7e54>, 
    userdata=<error reading variable: Cannot access memory at address 0x7fffdf3f7e48>)
    at /wrkdirs/usr/ports/net/remmina/work-default/Remmina-9d409a3556c8c2759a376b4f4ac5149db7aacf4f/src/remmina_ssh.c:478
(gdb) bt
#0  0x00000000002c8e96 in remimna_ssh_cp_to_ch_cbPython Exception <class 'gdb.MemoryError'>: Cannot access memory at address 0x7fffdf3f7e58
 (fd=#1  0x00000008013c8737 in  () at /usr/local/bin/../lib/libssh.so.4
#2  0x00000000002c6b20 in remmina_ssh_shell_thread (data=0x80be32000)
    at /wrkdirs/usr/ports/net/remmina/work-default/Remmina-9d409a3556c8c2759a376b4f4ac5149db7aacf4f/src/remmina_ssh.c:2993
#3  0x0000000801b2083a in  () at /lib/libthr.so.3
#4  0x0000000000000000 in  ()
Comment 22 rajhlinux 2023-02-27 22:51:00 UTC
I get the same exact error as to what the user "mururo" stated on this post at: "2022-08-11 14:46:05 UTC"

I installed Remmina 1.4.27_1 both from ports and source tree and when I log into remote SSH, the moment I hit the first character, remmina crashes and seg faults.

FreeBSD 13.1
Comment 23 Fernando Apesteguía freebsd_committer freebsd_triage 2023-02-28 09:41:34 UTC
(In reply to rajhlinux from comment #22)
I still can't pin-point the problem. I'll keep investigating.
Comment 24 Fernando Apesteguía freebsd_committer freebsd_triage 2023-03-02 12:47:24 UTC
I've updated to 1.4.29. Despite the fact that some sigsegv have been fixed, I can confirm the problem is still reproducible :S
Comment 25 Fernando Apesteguía freebsd_committer freebsd_triage 2023-03-02 16:59:58 UTC
There is a problem of stack smashing:

==2408== Warning: client switching stacks?  SP change: 0x7db5fae70 --> 0x7db3fae20
==2408==          to suppress, use: --max-stackframe=2097232 or greater

And the culprit is this 2 MB buffer (that is roughly the stack smashing size 0x7db3fae20 - 0x7db5fae70:

gchar buf[0x200000];

I reduced it to 1024 and now ssh plugin works fine and valgrind does not complain. Note that this problem, if unpatched, doesn't go away by increasing the stack size with limits(1) or ulimit(1). I think it is because this is compiled with -fstack-protector-strong.

Would you please try this patch?

Thank you all.
Comment 26 rajhlinux 2023-03-02 20:12:01 UTC
Hello Fernando Apesteguía.

I'm not sure how to patch it.

I apologize, I never did patching on these types of things.

Is it possible you can show an article or maybe describe the steps needed to patch and test?

Thank you for your effort in debugging.
Comment 27 Fernando Apesteguía freebsd_committer freebsd_triage 2023-03-02 22:04:01 UTC
Created attachment 240547 [details]
Patch to fix segfault

Sorry, I forgot to actually attach the patch.

From the root of your ports directory:

patch -p1 remmina.patch.

Then build the port normally. I've created a package for 13.1 amd64. You can get it here:

https://people.freebsd.org/~fernape/remmina-1.4.29.pkg
Comment 28 rajhlinux 2023-03-03 19:42:30 UTC
(In reply to Fernando Apesteguía from comment #27)

Hello Fernando,

Thank You. The patch works.
Remmina does not crash when logged into SSH while entering characters to the SSH shell.

I was not able to apply the patch via the ports by doing the following:

log in as root

# pkg delete remmina
# cd /usr/ports/net/remmina/
# make clean
# make deinstall clean
# patch -p1 remmina.patch

When I enter "patch -p1 remmina.patch", nothing happens.

However when I installed the attached patch you have provided, that installs and works:

# pkg install /home/user/Downloads/remmina-1.4.29.pkg

Thanks again.
Comment 29 Fernando Apesteguía freebsd_committer freebsd_triage 2023-03-03 22:37:09 UTC
(In reply to rajhlinux from comment #28)
Glad it works for you.

About the patch, as I said "From the root of your ports directory:"

So cd /usr/ports && patch -p1 < remmina.patch

I will update remmina during this weekend and contact upstream.

Thanks!
Comment 30 commit-hook freebsd_committer freebsd_triage 2023-03-05 12:35:13 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=4967d9eb09c1369d5c3dd41edaedba25fd127f3d

commit 4967d9eb09c1369d5c3dd41edaedba25fd127f3d
Author:     Fernando Apesteguía <fernape@FreeBSD.org>
AuthorDate: 2023-03-02 16:45:19 +0000
Commit:     Fernando Apesteguía <fernape@FreeBSD.org>
CommitDate: 2023-03-05 12:29:16 +0000

    net/remmina: Fix ssh plugin.

    Reduce size of the buffer to avoid stack smashing.

    PR:             265056
    Reported by:    ohartmann@walstatt.org
    MFH:            2023Q1 (bug fix)

 net/remmina/Makefile                             |  1 +
 net/remmina/files/patch-src_remmina__ssh.c (new) | 11 +++++++++++
 2 files changed, 12 insertions(+)
Comment 31 Fernando Apesteguía freebsd_committer freebsd_triage 2023-03-05 12:37:16 UTC
Committed and merged to 2023Q1.

I'll contact upstream.

Thank you all.
Comment 32 commit-hook freebsd_committer freebsd_triage 2023-03-05 12:37:16 UTC
A commit in branch 2023Q1 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=a9cb9c75a0200535b922be6057ef08cb238092be

commit a9cb9c75a0200535b922be6057ef08cb238092be
Author:     Fernando Apesteguía <fernape@FreeBSD.org>
AuthorDate: 2023-03-02 16:45:19 +0000
Commit:     Fernando Apesteguía <fernape@FreeBSD.org>
CommitDate: 2023-03-05 12:32:14 +0000

    net/remmina: Fix ssh plugin.

    Reduce size of the buffer to avoid stack smashing.

    PR:             265056
    Reported by:    ohartmann@walstatt.org
    MFH:            2023Q1 (bug fix)

    (cherry picked from commit 4967d9eb09c1369d5c3dd41edaedba25fd127f3d)

 net/remmina/Makefile                             |  2 +-
 net/remmina/files/patch-src_remmina__ssh.c (new) | 11 +++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)
Comment 33 Fernando Apesteguía freebsd_committer freebsd_triage 2023-03-05 12:55:33 UTC
Upstream issue: https://gitlab.com/Remmina/Remmina/-/issues/2864