Bug 251649 - net/libvncserver: Update to 0.9.13 and adopt port
Summary: net/libvncserver: Update to 0.9.13 and adopt port
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Jan Beich
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-06 20:25 UTC by Neel Chauhan
Modified: 2021-02-12 15:22 UTC (History)
2 users (show)

See Also:


Attachments
Patch (Revision 1) (8.51 KB, patch)
2020-12-06 20:25 UTC, Neel Chauhan
no flags Details | Diff
Patch (Revision 1) (5.00 KB, patch)
2020-12-06 23:32 UTC, Neel Chauhan
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Neel Chauhan freebsd_committer freebsd_triage 2020-12-06 20:25:59 UTC
Created attachment 220325 [details]
Patch (Revision 1)

Passes poudriere.
Comment 1 Daniel Engberg freebsd_committer freebsd_triage 2020-12-06 23:23:56 UTC
Patch is incorrect, it changes multiple unrelated ports
Are options not handled in Makefile disabled by default? If not, you most likely want to disable those as the port may pull in dependencies otherwise if installed.
Comment 2 Neel Chauhan freebsd_committer freebsd_triage 2020-12-06 23:24:50 UTC
I bumped PORTREVISION on dependent ports.
Comment 3 Neel Chauhan freebsd_committer freebsd_triage 2020-12-06 23:32:54 UTC
Created attachment 220332 [details]
Patch (Revision 1)

Actually, you're right.
Comment 4 commit-hook freebsd_committer freebsd_triage 2020-12-11 12:52:14 UTC
A commit references this bug:

Author: jbeich
Date: Fri Dec 11 12:51:37 UTC 2020
New revision: 557730
URL: https://svnweb.freebsd.org/changeset/ports/557730

Log:
  net/libvncserver: update to 0.9.13

  - Pass maintainership

  Changes:	https://github.com/LibVNC/libvncserver/releases/tag/LibVNCServer-0.9.13
  ABI:		https://abi-laboratory.pro/tracker/timeline/libvncserver/
  PR:		251649
  Submitted by:	Neel Chauhan <neel@neelc.org>
  Reviewed by:	daniel.engberg.lists@pyret.net

Changes:
  head/net/libvncserver/Makefile
  head/net/libvncserver/distinfo
  head/net/libvncserver/files/patch-libvncclient_sasl.c
  head/net/libvncserver/files/patch-rfb_rfb.h
  head/net/libvncserver/files/patch-rfbssl_openssl.c
  head/net/libvncserver/pkg-plist
Comment 5 Jan Beich freebsd_committer freebsd_triage 2020-12-11 12:57:11 UTC
Thanks. Landed. Do you need this on 2020Q4 (/quarterly) as well?
Comment 6 martin 2021-02-09 23:47:12 UTC
I'm not sure if it makes sense to update the closed bug. I've noticed this version broke emulators/virtualbox-ose version. Whole VM crashes when I connect to VM using VNC and press a key. 
Last working version of libvncserver in my setup is r549922.

My setup: FreeBSD 12.2-RELEASE amd64 r367186

virtualbox-ose-5.2.44_4
virtualbox-ose-kmod-5.2.44_4

I've set the host to create coredumps and verified it fails always in the same function: 

#0  0x0000000802918abd in VNCServerImpl::vncKeyboardEvent (down=0 '\000', keycode=703, cl=0x114) at src/VBox/ExtPacks/VNC/VBoxVNC.cpp:1177
#1  0x000000080293761d in rfbProcessClientMessage () from /usr/local/lib/libvncserver.so.1
#2  0x0000000802933b0d in clientInput () from /usr/local/lib/libvncserver.so.1

(gdb) i r $rdi $rsi $rdx
rdi            0x0                 0
rsi            0x2bf               703
rdx            0x114               276
(gdb) x/4i $pc
=> 0x802918abd <_ZN13VNCServerImpl16vncKeyboardEventEajP13_rfbClientRec+29>:	mov    rax,QWORD PTR [rdx]
   0x802918ac0 <_ZN13VNCServerImpl16vncKeyboardEventEajP13_rfbClientRec+32>:	mov    r15,QWORD PTR [rax+0x30]
   0x802918ac4 <_ZN13VNCServerImpl16vncKeyboardEventEajP13_rfbClientRec+36>:	cmp    ebx,0x7f
   0x802918ac7 <_ZN13VNCServerImpl16vncKeyboardEventEajP13_rfbClientRec+39>:	jae    0x802918b02 <_ZN13VNCServerImpl16vncKeyboardEventEajP13_rfbClientRec+98>
(gdb)
Comment 7 martin 2021-02-10 15:29:27 UTC
I did a mistake above. The last working version of libvncserver is r556980. 
I tried to debug what's happening when using working and non-working version. 

Code that is being called seems to be the same:  libvncserver/rfbserver.c:2487 in r557730, libvncserver/rfbserver.c:2456 in r556980.

Problem seems to be this call:

2487                 cl->screen->ptrAddEvent(msg.pe.buttonMask,
2488                         ScaleX(cl->scaledScreen, cl->screen, Swap16IfLE(msg.pe.x)),
2489                         ScaleY(cl->scaledScreen, cl->screen, Swap16IfLE(msg.pe.y)),
2490                         cl);

While I didn't trace what sets this function pointer (and how it is being updated), every time I trace it in working version it was always pointing to VNCServerImpl::vncMouseEvent(int, int, int, _rfbClientRec*), i.e. 4 argument function. 

In updated version this function pointer was pointing to VNCServerImpl::vncKeyboardEvent(signed char, unsigned int, _rfbClientRec*)


In the crash version %rcx is pointing to proper cl structure as one would expect in 4 arg function. 

ptrAddEvent() needs 4 args while vncKeyboardEvent() is 3.
Comment 8 martin 2021-02-12 15:22:49 UTC
Just for the clarification problem was on my side. virtualbox-ose\* has dependency on libvncserver. In my setup I held virtualbox back in /usr/local/etc/pkgtools.conf. 

The main structure (rfb/rfb.h: rfbScreenInfoPtr) grew in size a bit in higher version. The not updated VNC module in virtualbox (/usr/local/lib/virtualbox/ExtensionPacks/VNC/VBoxVNC.so) was using wrong offsets and hence setting this structure incorrectly. 

Updating the virtualbox properly fixed this issue, as expected. 
Sorry for the confusion here.