any1 / neatvnc

A liberally licensed VNC server library with a clean interface
ISC License
118 stars 29 forks source link

wayvnc coredump with latest neatvnc commit b5f37d0 #90

Closed ppascher closed 1 year ago

ppascher commented 1 year ago

When connecting to a wayvnc session I get an error ("TLS Handshake failed") and wayvnc creates a coredump. Reverting the latest neatvnc commit ( commit b5f37d0227c42c1f4b7f99741dbb24435ff4f164 ) fixes the issue.

Version:

wayvnc -V
wayvnc: v0.6.2-30-g945f590 (master)
neatvnc: v0.6.0-27-gb5f37d0 (master)
aml: v0.3.0-1-gede4249 (master)

Coredump:

(gdb) bt full
#0  0x00007ff69ec9900b in pthread_kill () at /usr/lib/libc.so.6
any1/wayvnc#1  0x00007ff69ec3e5e8 in raise () at /usr/lib/libc.so.6
any1/wayvnc#2  0x00007ff69ec224f8 in abort () at /usr/lib/libc.so.6
any1/wayvnc#3  0x00007ff69ec2349b in  () at /usr/lib/libc.so.6
any1/wayvnc#4  0x00007ff69eca34c7 in  () at /usr/lib/libc.so.6
any1/wayvnc#5  0x00007ff69eca5904 in  () at /usr/lib/libc.so.6
any1/wayvnc#6  0x00007ff69eca80e3 in free () at /usr/lib/libc.so.6
any1/wayvnc#7  0x00007ff69f2c3da8 in aml__free_handler (self=0x563bd086f390) at ../subprojects/aml/src/aml.c:930
        self = 0x563bd086f390
        ref = 0
        __PRETTY_FUNCTION__ = "aml_unref"
any1/wayvnc#8  aml_unref (obj=0x563bd086f390) at ../subprojects/aml/src/aml.c:991
        self = 0x563bd086f390
        ref = 0
        __PRETTY_FUNCTION__ = "aml_unref"
any1/wayvnc#9  aml_unref (obj=obj@entry=0x563bd086f390) at ../subprojects/aml/src/aml.c:966
        self = 0x563bd086f390
        ref = 0
        __PRETTY_FUNCTION__ = "aml_unref"
any1/wayvnc#10 0x00007ff69f2c46b4 in aml_dispatch (self=self@entry=0x563bd08642f0) at ../subprojects/aml/src/aml.c:854
        now = <optimized out>
        earliest = <optimized out>
        sig_old = {__val = {2, 13940054446484402944, 32, 13940054446484402944, 94814901585312, 120, 94814901585824, 140697209164243, 140697204173472, 5221458336, 94814901554912, 13940054446484402944, 94814901554912, 13940054446484402944, 94814901519352, 94814900094304}}
        sig_new = {__val = {18446744067267100671, 0, 0, 0, 0, 0, 0, 13940054446484402944, 15025965006569078785, 94811403081275, 140729824946448, 140697202747759, 192, 18446744073709551168, 206158430232, 140729824911040}}
        obj = 0x563bd086f390
        __PRETTY_FUNCTION__ = "aml_dispatch"
any1/wayvnc#11 0x0000563bd021bd0a in main (argc=<optimized out>, argv=<optimized out>) at ../src/main.c:1545
        self = {do_exit = false, display = 0x563bd0708560, registry = 0x563bd07086e0, outputs = {prev = 0x563bd070e098, next = 0x563bd070e098}, seats = {prev = 0x563bd070df58, next = 0x563bd070df58}, cfg = {enable_auth = true, private_key_file = 0x563bd0709570 "/home/username/.config/wayvnc/key.pem", certificate_file = 0x563bd07095a0 "/home/username/.config/wayvnc/cert.pem", username = 0x563bd06f25e0 "username", password = 0x563bd06f2520 "GBm1000F#123", address = 0x563bd06f26a0 "0.0.0.0", port = 0, enable_pam = false, xkb_rules = 0x0, xkb_model = 0x0, xkb_layout = 0x0, xkb_variant = 0x0, xkb_options = 0x0}, keyboard_manager = 0x563bd070dc70, pointer_manager = 0x563bd070de00, data_control_manager = 0x563bd070da50, selected_output = 0x563bd070e080, selected_seat = 0x0, screencopy = {status = SCREENCOPY_STOPPED, pool = 0x563bd086c030, front = 0x0, back = 0x0, manager = 0x563bd070d790, frame = 0x0, userdata = 0x7ffe37391fd0, on_done = 0x563bd021f760 <on_capture_done>, last_time = 0, start_time = 0, timer = 0x563bd086d0c0, delay_smoother = {time_constant = 0.5, last_time = 0, last_result = 0}, delay = 0, is_immediate_copy = false, overlay_cursor = true, wl_output = 0x563bd070dce0, wl_shm_width = 0, wl_shm_height = 0, wl_shm_stride = 0, wl_shm_format = WL_SHM_FORMAT_ARGB8888, have_linux_dmabuf = false, enable_linux_dmabuf = true, dmabuf_width = 0, dmabuf_height = 0, fourcc = 0, rate_limit = 24}, wayland_handler = 0x0, signal_handler = 0x0, nvnc = 0x563bd086a3f0, nvnc_display = 0x563bd0855910, kb_layout = 0x7ffe373925c8 "de", kb_variant = 0x0, damage_area_sum = 0, n_frames_captured = 0, disable_input = false, nr_clients = 0, performance_ticker = 0x563bd08703c0, capture_retry_timer = 0x0, ctl = 0x563bd08745a0, is_initializing = false}
        cfg_file = <optimized out>
        enable_gpu_features = true
        address = <optimized out>
        port = <optimized out>
        use_unix_socket = false
        use_websocket = <optimized out>
        output_name = 0x7ffe373926d0 "HEADLESS-1"
        seat_name = <optimized out>
        socket_path = <optimized out>
        keyboard_options = <optimized out>
        overlay_cursor = true
        show_performance = true
        max_rate = 24
        disable_input = <optimized out>
        drm_fd = 4
        log_level = <optimized out>
        option_parser = {name = 0x563bd02278f8 "Options", options = 0x563bd022cf80 <opts>, n_opts = 18, values = {{option = 0x563bd022d300 <opts+896>, value = "debug", '\000' <repeats 250 times>}, {option = 0x563bd022d098 <opts+280>, value = "de", '\000' <repeats 253 times>}, {option = 0x563bd022d060 <opts+224>, value = "HEADLESS-1", '\000' <repeats 245 times>}, {option = 0x563bd022d178 <opts+504>, value = "24", '\000' <repeats 253 times>}, {option = 0x563bd022d1b0 <opts+560>, value = "1", '\000' <repeats 254 times>}, {option = 0x563bd022d140 <opts+448>, value = "1", '\000' <repeats 254 times>}, {option = 0x563bd022d028 <opts+168>, value = "1", '\000' <repeats 254 times>}, {option = 0x0, value = '\000' <repeats 255 times>} <repeats 121 times>}, n_values = 7, position = 0, remaining_argc = 0, remaining_argv = 0x0}
        port_str = <optimized out>
        cfg_rc = <optimized out>
        out = <optimized out>
        seat = <optimized out>
        aml = 0x563bd08642f0
        socket_type = <optimized out>
        keyboard_options = <optimized out>
        overlay_cursor = true
        show_performance = true
        max_rate = 24
        disable_input = <optimized out>
        drm_fd = 4
        log_level = <optimized out>
        option_parser = {name = 0x563bd02278f8 "Options", options = 0x563bd022cf80 <opts>, n_opts = 18, values = {{option = 0x563bd022d300 <opts+896>, value = "debug", '\000' <repeats 250 times>}, {option = 0x563bd022d098 <opts+280>, value = "de", '\000' <repeats 253 times>}, {option = 0x563bd022d060 <opts+224>, value = "HEADLESS-1", '\000' <repeats 245 times>}, {option = 0x563bd022d178 <opts+504>, value = "24", '\000' <repeats 253 times>}, {option = 0x563bd022d1b0 <opts+560>, value = "1", '\000' <repeats 254 times>}, {option = 0x563bd022d140 <opts+448>, value = "1", '\000' <repeats 254 times>}, {option = 0x563bd022d028 <opts+168>, value = "1", '\000' <repeats 254 times>}, {option = 0x0, value = '\000' <repeats 255 times>} <repeats 121 times>}, n_values = 7, position = 0, remaining_argc = 0, remaining_argv = 0x0}
        port_str = <optimized out>
        cfg_rc = <optimized out>
        out = <optimized out>
        seat = <optimized out>
        aml = 0x563bd08642f0
        socket_type = <optimized out>
        ctl_actions = {userdata = 0x7ffe37391fd0, on_output_cycle = 0x563bd02240c0 <on_output_cycle>, on_output_switch = 0x563bd0224350 <on_output_switch>, on_disconnect_client = 0x563bd02244a0 <on_disconnect_client>, on_wayvnc_exit = 0x563bd021dbc0 <on_wayvnc_exit>, client_next = 0x563bd021de10 <client_next>, client_info = 0x563bd021e2a0 <client_info>, get_output_list = 0x563bd021e2f0 <get_output_list>}
        opts = {{short_opt = 0 '\000', long_opt = 0x0, schema = 0x0, help = 0x563bd02295f0 "The IP address or unix socket path to listen on.", default_ = 0x563bd02278ee "127.0.0.1", positional = 0x563bd02279f8 "address", is_subcommand = false}, {short_opt = 0 '\000', long_opt = 0x0, schema = 0x0, help = 0x563bd0227f0e "The TCP port to listen on.", default_ = 0x563bd0227f29 "5900", positional = 0x563bd0227a00 "port", is_subcommand = false}, {short_opt = 67 'C', long_opt = 0x563bd0227a38 "config", schema = 0x563bd0227f2e "<path>", help = 0x563bd0227f35 "Select a config file.", default_ = 0x0, positional = 0x0, is_subcommand = false}, {short_opt = 103 'g', long_opt = 0x563bd0227985 "gpu", schema = 0x0, help = 0x563bd0229628 "Enable features that need GPU.", default_ = 0x0, positional = 0x0, is_subcommand = false}, {short_opt = 111 'o', long_opt = 0x563bd0227b85 "output", schema = 0x563bd0227e25 "<name>", help = 0x563bd0227f4b "Select output to capture.", default_ = 0x0, positional = 0x0, is_subcommand = false}, {short_opt = 107 'k', long_opt = 0x563bd0227494 "keyboard", schema = 0x563bd0227f65 "<layout>[-<variant>]", help = 0x563bd0229648 "Select keyboard layout with an optional variant.", default_ = 0x0, positional = 0x0, is_subcommand = false}, {short_opt = 115 's', long_opt = 0x563bd0227b78 "seat", schema = 0x563bd0227e25 "<name>", help = 0x563bd0227f7a "Select seat by name.", default_ = 0x0, positional = 0x0, is_subcommand = false}, {short_opt = 83 'S', long_opt = 0x563bd02279a8 "socket", schema = 0x563bd0227f2e "<path>", help = 0x563bd0227f8f "Control socket path.", default_ = 0x0, positional = 0x0, is_subcommand = false}, {short_opt = 114 'r', long_opt = 0x563bd0227989 "render-cursor", schema = 0x0, help = 0x563bd0229680 "Enable overlay cursor rendering.", default_ = 0x0, positional = 0x0, is_subcommand = false}, {short_opt = 102 'f', long_opt = 0x563bd02279f0 "max-fps", schema = 0x563bd0227fa4 "<fps>", help = 0x563bd0227faa "Set rate limit.", default_ = 0x563bd0227fba "30", positional = 0x0, is_subcommand = false}, {short_opt = 112 'p', long_opt = 0x563bd0227997 "performance", schema = 0x0, help = 0x563bd0227fbd "Show performance counters.", default_ = 0x0, positional = 0x0, is_subcommand = false}, {short_opt = 117 'u', long_opt = 0x563bd02279a3 "unix-socket", schema = 0x0, help = 0x563bd0227fd8 "Create unix domain socket.", default_ = 0x0, positional = 0x0, is_subcommand = false}, {short_opt = 100 'd', long_opt = 0x563bd02279b9 "disable-input", schema = 0x0, help = 0x563bd0227ff3 "Disable all remote input.", default_ = 0x0, positional = 0x0, is_subcommand = false}, {short_opt = 86 'V', long_opt = 0x563bd0227956 "version", schema = 0x0, help = 0x563bd022800d "Show version info.", default_ = 0x0, positional = 0x0, is_subcommand = false}, {short_opt = 118 'v', long_opt = 0x563bd0228020 "verbose", schema = 0x0, help = 0x563bd02296a8 "Be more verbose. Same as setting --log-level=info", default_ = 0x0, positional = 0x0, is_subcommand = false}, {short_opt = 119 'w', long_opt = 0x563bd02279af "websocket", schema = 0x0, help = 0x563bd0228028 "Create a websocket.", default_ = 0x0, positional = 0x0, is_subcommand = false}, {short_opt = 76 'L', long_opt = 0x563bd02279c7 "log-level", schema = 0x563bd022803c "<level>", help = 0x563bd02296e0 "Set log level. The levels are: error, warning, info, debug trace and quiet.", default_ = 0x563bd02279d7 "warning", positional = 0x0, is_subcommand = false}, {short_opt = 104 'h', long_opt = 0x563bd0227980 "help", schema = 0x0, help = 0x563bd0228044 "Get help (this text).", default_ = 0x0, positional = 0x0, is_subcommand = false}, {short_opt = 0 '\000', long_opt = 0x0, schema = 0x0, help = 0x0, default_ = 0x0, positional = 0x0, is_subcommand = false}}

TRACE:

TRACE: ../src/main.c: 224: Registering new xdg_output_manager
TRACE: ../src/main.c: 234: Registering new wlr_output_power_manager
TRACE: ../src/main.c: 205: Registering new output 46
TRACE: ../src/output.c: 222: Output 46 name: HEADLESS-1
TRACE: ../src/output.c: 231: Output 46 description: Headless output 1
TRACE: ../src/output.c: 274: Output HEADLESS-1 power state changed to ON
Info: Capturing output HEADLESS-1
Info: >> Headless output 1 1280x720+0x0 Power:ON
DEBUG: ../subprojects/neatvnc/src/server.c: 1341: Trying address: 0.0.0.0
DEBUG: ../subprojects/neatvnc/src/server.c: 1361: Successfully bound to address
Info: Listening for connections on 0.0.0.0:5900
DEBUG: ../src/ctl-server.c: 751: Initializing wayvncctl socket: /run/user/1001/wayvncctl
DEBUG: ../src/ctl-server.c: 720: Connecting to existing socket in case it's stale
DEBUG: ../src/ctl-server.c: 727: Connect failed: Connection refused
Info: New client connection from xxx.xxx.xxx.xxx: 0x56442fb044b0 (ref 1)
double free or corruption (out)
any1 commented 1 year ago

Does the latest commit fix the problem?

ppascher commented 1 year ago

Yes it does. Thank you for the quick patch.