Skip to content

GUACAMOLE-2341: Correct disconnect race vs. RDP channel cleanup. - #726

Open
mike-jumper wants to merge 1 commit into
apache:staging/1.6.1from
mike-jumper:fix-disconnect-segfault
Open

mike-jumper wants to merge 1 commit into
apache:staging/1.6.1from
mike-jumper:fix-disconnect-segfault

Conversation

@mike-jumper

Copy link
Copy Markdown
Contributor

This change corrects cases where handling of RDP channels might race with resource cleanup at disconnect, leading to segfaults. Prior to the addition of the watchdog, a segfault during cleanup could lead to failure to reap the connection process (one of the possible causes of GUACAMOLE-2118).

Comment on lines +316 to +317
size_t length = audio_buffer->packet_size;
if (length > packet_buffer_size) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any conditions under which length/packet_size here could be zero that aren't caught prior to this? Any reason to check that?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope - packet_size can't be zero here since that would mean guac_rdp_audio_buffer_may_flush() would have returned false earlier in the loop and skipped this section via continue.

Comment thread src/protocols/rdp/rdp.c
Comment on lines -972 to -983
/* Stop render loop */
guac_display_render_thread_destroy(rdp_client->render_thread);
rdp_client->render_thread = NULL;

/* Ensure all background rendering processes are stopped before freeing
* underlying memory */
guac_display_stop(rdp_client->display);

/* Clean up FreeRDP internal GDI implementation (this must be done BEFORE
* freeing the guac_display, as freeing the GDI will free objects like
* rdpPointer that will attempt to free associated guac_display_layer
* instances during cleanup) */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did this get moved somewhere else? Or is it, for some reason, no longer required?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the display and render thread cleanup moved to guac_rdp_client_free_handler().

@necouchman

Copy link
Copy Markdown
Contributor

@mike-jumper Any feedback on my comments above?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants