Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API to offload io operations to external implementation #6324

Open
wants to merge 29 commits into
base: master
Choose a base branch
from

Conversation

sss123next
Copy link
Contributor

No description provided.

@freerdp-bot
Copy link

Can one of the admins verify this patch?

libfreerdp/core/update.c Outdated Show resolved Hide resolved
@hardening
Copy link
Contributor

A general comment: I'd rather like that there would be no difference between the current transport and the external one from the core freerdp point of view. All these ExternalIo tests look like one more hack in FreeRDP, I'd really prefer that we make a step aside and completely rework that part.

@sss123next
Copy link
Contributor Author

probably i am lacking knowledge of libfreerdp internals, more detailed suggestions are welcome.
from my point of view my current approach is reasonable: simple enough, readable enough, achieving goal, but of course i can try implement it another way, but i do not really understand your point, what wrong with ExternalIo tests ?

@hardening
Copy link
Contributor

probably i am lacking knowledge of libfreerdp internals, more detailed suggestions are welcome.
from my point of view my current approach is reasonable: simple enough, readable enough, achieving goal, but of course i can try implement it another way, but i do not really understand your point, what wrong with ExternalIo tests ?

Well it would be much more elegant, if FreeRDP core would just use a "transport", without knowing if it's the one that is set by default by FreeRDP, or one that has been set externally. So the code in FreeRDP core would be clean and nice without if(settings->externalIo) all over the place. IMHO we already have too many of this quick hacks in the code, that do the job, but make the code hard to maintain on the long term.

@sss123next
Copy link
Contributor Author

to achieve this, design must be changed.

current behaviour is :
(external) polling > rdp_check_fds > transport_check_fds > transport_read_pdu > transport_read_layer_bytes
which is must be something like:
(external) polling > read (via io backend) > data handler (changed transport_read_pdu)
where polling can be done internally or externally, and read is switchable.

correct me if i wrong.

@sss123next
Copy link
Contributor Author

as for write, it is more simple, write can just be switchable and i guess no significant design/logic changes required.

@hardening
Copy link
Contributor

as for write, it is more simple, write can just be switchable and i guess no significant design/logic changes required.

Write polling is also needed especially for server-side.

@sss123next
Copy link
Contributor Author

in current implementation it is not used, i am not able to find any polling implementation for write in current code, if it is already used, can you please tell me where it is ?

@sss123next sss123next changed the title WIP: API to offload io operations to external implementation API to offload io operations to external implementation Jul 8, 2020
Copy link
Member

@akallabeth akallabeth left a comment

Choose a reason for hiding this comment

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

I´d suggest changing the API the following way:

  1. Add a functon registration function freerdp_set_transport_callbacks or similar that allows setting read and write functions for the transport layer
  2. Initialize these with the currently implemented read/write functions (or wrap them so that this is possible) at creation time
  3. Applications that want to use a different layer can then implement their own read/write functions externally and simply call freerdp_set_transport_callbacks right after context creation

This way the changes to FreeRDP should stay minimal and for your use case you should have all degrees of freedom required to do what ever you like

include/freerdp/settings.h Outdated Show resolved Hide resolved
libfreerdp/core/freerdp.c Outdated Show resolved Hide resolved
@@ -811,6 +811,7 @@ BOOL freerdp_peer_context_new(freerdp_peer* client)
client->autodetect->context = context;
update_register_server_callbacks(client->update);
autodetect_register_server_callbacks(client->autodetect);
update_register_io_callbacks(rdp->update);
Copy link
Member

Choose a reason for hiding this comment

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

This should not be necessary with the new API

Copy link
Contributor Author

Choose a reason for hiding this comment

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

why ?, is it not same initialization sequence as for client ?

libfreerdp/core/transport.h Outdated Show resolved Hide resolved
@sss123next
Copy link
Contributor Author

i have one more question.
which purpose of using transport->rereadEvent with createevent, resetevent, setevent, i have tested with my changes for transport_check_fds on linux x11 client, working just fine without it, is it strict requirement on windows builds ?

@sss123next
Copy link
Contributor Author

ah, looks like i also need to make switchable rdp_client_connect, rdp_client_disconnect.

Copy link
Member

@akallabeth akallabeth left a comment

Choose a reason for hiding this comment

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

API wise this looks good now.

I´d suggest rebasing to current master, squashing the commits (and removing changed blank lines, ...) and then fixing the remaining issues (most notably the timeout you just removed)

libfreerdp/core/transport.c Outdated Show resolved Hide resolved
libfreerdp/core/transport.c Outdated Show resolved Hide resolved
libfreerdp/core/transport.c Outdated Show resolved Hide resolved
libfreerdp/core/transport.c Outdated Show resolved Hide resolved
libfreerdp/core/transport.c Outdated Show resolved Hide resolved
libfreerdp/core/update.c Outdated Show resolved Hide resolved
@sss123next sss123next force-pushed the external_io branch 2 times, most recently from 71c8be4 to eab26b6 Compare July 10, 2020 21:52
@sss123next
Copy link
Contributor Author

rebased on master, squashed

@sss123next
Copy link
Contributor Author

ah, looks like i also need to make switchable rdp_client_connect, rdp_client_disconnect.

or maybe just completely avoid usage of this, but i guess i need at least to handle disconnect initiated by freerdp somehow...

@sss123next
Copy link
Contributor Author

looks like my changes does not work properly with some servers, investigating...

crashing like this:

thread apply all bt

Thread 37 (Thread 0x7fffdf7de700 (LWP 47608)):
#0  0x00007ffff77786ef in poll () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#1  0x00007ffff78986ce in waitOnFd (fd=53, mode=1, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:198
#2  0x00007ffff78989db in WaitForSingleObject (hHandle=0x7ffff0f6f750, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:297
#3  0x00007ffff78bfc5e in MessageQueue_Wait (queue=0x7ffff0f6f090) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/utils/collections/MessageQueue.c:64
#4  0x00007ffff7d47eab in cliprdr_virtual_channel_client_thread (arg=0x7ffff00012c0) at /home/sss/install/git/work/FreeRDP/channels/cliprdr/client/cliprdr_main.c:923
#5  0x00007ffff78e928d in thread_launcher (arg=0x7ffff0f6f780) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/thread/thread.c:327
#6  0x00007ffff760c53f in start_thread () from /usr/x86_64-pc-linux-gnu/lib/libpthread.so.0
#7  0x00007ffff77833b3 in clone () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6

Thread 36 (Thread 0x7fffdffdf700 (LWP 47607)):
#0  0x00007ffff77786ef in poll () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#1  0x00007ffff78986ce in waitOnFd (fd=51, mode=1, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:198
#2  0x00007ffff78989db in WaitForSingleObject (hHandle=0x7ffff0f6c490, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:297
#3  0x00007ffff78bfc5e in MessageQueue_Wait (queue=0x7ffff0f6c410) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/utils/collections/MessageQueue.c:64
#4  0x00007ffff7d328cc in rdpdr_virtual_channel_client_thread (arg=0x7ffff0000cb0) at /home/sss/install/git/work/FreeRDP/channels/rdpdr/client/rdpdr_main.c:1581
#5  0x00007ffff78e928d in thread_launcher (arg=0x7ffff0f6c4c0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/thread/thread.c:327
#6  0x00007ffff760c53f in start_thread () from /usr/x86_64-pc-linux-gnu/lib/libpthread.so.0
#7  0x00007ffff77833b3 in clone () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6

Thread 35 (Thread 0x7fffe07e0700 (LWP 47440)):
#0  0x00007ffff77786ef in poll () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#1  0x00007ffff7898fb6 in WaitForMultipleObjects (nCount=2, lpHandles=0x7fffe07dfcc0, bWaitAll=0, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:442
#2  0x00007ffff78e7594 in thread_pool_work_func (arg=0x7ffff00026a0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/pool/pool.c:77
#3  0x00007ffff78e928d in thread_launcher (arg=0x7ffff0023f60) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/thread/thread.c:327
#4  0x00007ffff760c53f in start_thread () from /usr/x86_64-pc-linux-gnu/lib/libpthread.so.0
#5  0x00007ffff77833b3 in clone () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6

Thread 34 (Thread 0x7fffe0fe1700 (LWP 47439)):
#0  0x00007ffff77786ef in poll () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#1  0x00007ffff7898fb6 in WaitForMultipleObjects (nCount=2, lpHandles=0x7fffe0fe0cc0, bWaitAll=0, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:442
#2  0x00007ffff78e7594 in thread_pool_work_func (arg=0x7ffff00026a0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/pool/pool.c:77
#3  0x00007ffff78e928d in thread_launcher (arg=0x7ffff0023cc0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/thread/thread.c:327
#4  0x00007ffff760c53f in start_thread () from /usr/x86_64-pc-linux-gnu/lib/libpthread.so.0
#5  0x00007ffff77833b3 in clone () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6

Thread 33 (Thread 0x7fffe17e2700 (LWP 47438)):
#0  0x00007ffff77786ef in poll () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#1  0x00007ffff7898fb6 in WaitForMultipleObjects (nCount=2, lpHandles=0x7fffe17e1cc0, bWaitAll=0, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:442
#2  0x00007ffff78e7594 in thread_pool_work_func (arg=0x7ffff00026a0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/pool/pool.c:77
#3  0x00007ffff78e928d in thread_launcher (arg=0x7ffff0023a20) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/thread/thread.c:327
#4  0x00007ffff760c53f in start_thread () from /usr/x86_64-pc-linux-gnu/lib/libpthread.so.0
#5  0x00007ffff77833b3 in clone () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6

Thread 32 (Thread 0x7fffe1fe3700 (LWP 47437)):
#0  0x00007ffff77786ef in poll () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#1  0x00007ffff7898fb6 in WaitForMultipleObjects (nCount=2, lpHandles=0x7fffe1fe2cc0, bWaitAll=0, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:442
#2  0x00007ffff78e7594 in thread_pool_work_func (arg=0x7ffff00026a0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/pool/pool.c:77
#3  0x00007ffff78e928d in thread_launcher (arg=0x7ffff0023780) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/thread/thread.c:327
#4  0x00007ffff760c53f in start_thread () from /usr/x86_64-pc-linux-gnu/lib/libpthread.so.0
#5  0x00007ffff77833b3 in clone () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6

Thread 31 (Thread 0x7fffe27e4700 (LWP 47436)):
--Type <RET> for more, q to quit, c to continue without paging--
#0  0x00007ffff77786ef in poll () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#1  0x00007ffff7898fb6 in WaitForMultipleObjects (nCount=2, lpHandles=0x7fffe27e3cc0, bWaitAll=0, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:442
#2  0x00007ffff78e7594 in thread_pool_work_func (arg=0x7ffff00026a0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/pool/pool.c:77
#3  0x00007ffff78e928d in thread_launcher (arg=0x7ffff00234e0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/thread/thread.c:327
#4  0x00007ffff760c53f in start_thread () from /usr/x86_64-pc-linux-gnu/lib/libpthread.so.0
#5  0x00007ffff77833b3 in clone () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6

Thread 30 (Thread 0x7fffe2fe5700 (LWP 47435)):
#0  0x00007ffff77786ef in poll () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#1  0x00007ffff7898fb6 in WaitForMultipleObjects (nCount=2, lpHandles=0x7fffe2fe4cc0, bWaitAll=0, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:442
#2  0x00007ffff78e7594 in thread_pool_work_func (arg=0x7ffff00026a0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/pool/pool.c:77
#3  0x00007ffff78e928d in thread_launcher (arg=0x7ffff0023240) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/thread/thread.c:327
#4  0x00007ffff760c53f in start_thread () from /usr/x86_64-pc-linux-gnu/lib/libpthread.so.0
#5  0x00007ffff77833b3 in clone () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6

Thread 29 (Thread 0x7fffe37e6700 (LWP 47434)):
#0  0x00007ffff77786ef in poll () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#1  0x00007ffff7898fb6 in WaitForMultipleObjects (nCount=2, lpHandles=0x7fffe37e5cc0, bWaitAll=0, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:442
#2  0x00007ffff78e7594 in thread_pool_work_func (arg=0x7ffff00026a0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/pool/pool.c:77
#3  0x00007ffff78e928d in thread_launcher (arg=0x7ffff0022fa0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/thread/thread.c:327
#4  0x00007ffff760c53f in start_thread () from /usr/x86_64-pc-linux-gnu/lib/libpthread.so.0
#5  0x00007ffff77833b3 in clone () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6

Thread 28 (Thread 0x7fffe3fe7700 (LWP 47433)):
#0  0x00007ffff77786ef in poll () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#1  0x00007ffff7898fb6 in WaitForMultipleObjects (nCount=2, lpHandles=0x7fffe3fe6cc0, bWaitAll=0, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:442
#2  0x00007ffff78e7594 in thread_pool_work_func (arg=0x7ffff00026a0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/pool/pool.c:77
#3  0x00007ffff78e928d in thread_launcher (arg=0x7ffff0022d00) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/thread/thread.c:327
#4  0x00007ffff760c53f in start_thread () from /usr/x86_64-pc-linux-gnu/lib/libpthread.so.0
#5  0x00007ffff77833b3 in clone () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6

Thread 27 (Thread 0x7fffe47e8700 (LWP 47432)):
#0  0x00007ffff77786ef in poll () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#1  0x00007ffff7898fb6 in WaitForMultipleObjects (nCount=2, lpHandles=0x7fffe47e7cc0, bWaitAll=0, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:442
#2  0x00007ffff78e7594 in thread_pool_work_func (arg=0x7ffff00026a0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/pool/pool.c:77
#3  0x00007ffff78e928d in thread_launcher (arg=0x7ffff0022a60) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/thread/thread.c:327
#4  0x00007ffff760c53f in start_thread () from /usr/x86_64-pc-linux-gnu/lib/libpthread.so.0
#5  0x00007ffff77833b3 in clone () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6

Thread 26 (Thread 0x7fffe4fe9700 (LWP 47431)):
#0  0x00007ffff77786ef in poll () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#1  0x00007ffff7898fb6 in WaitForMultipleObjects (nCount=2, lpHandles=0x7fffe4fe8cc0, bWaitAll=0, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:442
#2  0x00007ffff78e7594 in thread_pool_work_func (arg=0x7ffff00026a0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/pool/pool.c:77
#3  0x00007ffff78e928d in thread_launcher (arg=0x7ffff00227c0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/thread/thread.c:327
#4  0x00007ffff760c53f in start_thread () from /usr/x86_64-pc-linux-gnu/lib/libpthread.so.0
#5  0x00007ffff77833b3 in clone () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6

Thread 25 (Thread 0x7fffe57ea700 (LWP 47430)):
#0  0x00007ffff77786ef in poll () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#1  0x00007ffff7898fb6 in WaitForMultipleObjects (nCount=2, lpHandles=0x7fffe57e9cc0, bWaitAll=0, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:442
#2  0x00007ffff78e7594 in thread_pool_work_func (arg=0x7ffff00026a0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/pool/pool.c:77
#3  0x00007ffff78e928d in thread_launcher (arg=0x7ffff0022520) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/thread/thread.c:327
#4  0x00007ffff760c53f in start_thread () from /usr/x86_64-pc-linux-gnu/lib/libpthread.so.0
#5  0x00007ffff77833b3 in clone () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
--Type <RET> for more, q to quit, c to continue without paging--

Thread 24 (Thread 0x7fffe5feb700 (LWP 47429)):
#0  0x00007ffff77786ef in poll () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#1  0x00007ffff7898fb6 in WaitForMultipleObjects (nCount=2, lpHandles=0x7fffe5feacc0, bWaitAll=0, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:442
#2  0x00007ffff78e7594 in thread_pool_work_func (arg=0x7ffff00026a0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/pool/pool.c:77
#3  0x00007ffff78e928d in thread_launcher (arg=0x7ffff0022280) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/thread/thread.c:327
#4  0x00007ffff760c53f in start_thread () from /usr/x86_64-pc-linux-gnu/lib/libpthread.so.0
#5  0x00007ffff77833b3 in clone () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6

Thread 23 (Thread 0x7fffe67ec700 (LWP 47428)):
#0  0x00007ffff77786ef in poll () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#1  0x00007ffff7898fb6 in WaitForMultipleObjects (nCount=2, lpHandles=0x7fffe67ebcc0, bWaitAll=0, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:442
#2  0x00007ffff78e7594 in thread_pool_work_func (arg=0x7ffff00026a0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/pool/pool.c:77
#3  0x00007ffff78e928d in thread_launcher (arg=0x7ffff0021fe0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/thread/thread.c:327
#4  0x00007ffff760c53f in start_thread () from /usr/x86_64-pc-linux-gnu/lib/libpthread.so.0
#5  0x00007ffff77833b3 in clone () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6

Thread 22 (Thread 0x7fffe6fed700 (LWP 47427)):
#0  0x00007ffff77786ef in poll () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#1  0x00007ffff7898fb6 in WaitForMultipleObjects (nCount=2, lpHandles=0x7fffe6feccc0, bWaitAll=0, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:442
#2  0x00007ffff78e7594 in thread_pool_work_func (arg=0x7ffff00026a0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/pool/pool.c:77
#3  0x00007ffff78e928d in thread_launcher (arg=0x7ffff0021d40) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/thread/thread.c:327
#4  0x00007ffff760c53f in start_thread () from /usr/x86_64-pc-linux-gnu/lib/libpthread.so.0
#5  0x00007ffff77833b3 in clone () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6

Thread 21 (Thread 0x7fffe77ee700 (LWP 47426)):
#0  0x00007ffff77786ef in poll () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#1  0x00007ffff7898fb6 in WaitForMultipleObjects (nCount=2, lpHandles=0x7fffe77edcc0, bWaitAll=0, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:442
#2  0x00007ffff78e7594 in thread_pool_work_func (arg=0x7ffff00026a0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/pool/pool.c:77
#3  0x00007ffff78e928d in thread_launcher (arg=0x7ffff0021aa0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/thread/thread.c:327
#4  0x00007ffff760c53f in start_thread () from /usr/x86_64-pc-linux-gnu/lib/libpthread.so.0
#5  0x00007ffff77833b3 in clone () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6

Thread 20 (Thread 0x7fffe7fef700 (LWP 47425)):
#0  0x00007ffff77786ef in poll () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#1  0x00007ffff7898fb6 in WaitForMultipleObjects (nCount=2, lpHandles=0x7fffe7feecc0, bWaitAll=0, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:442
#2  0x00007ffff78e7594 in thread_pool_work_func (arg=0x7ffff00026a0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/pool/pool.c:77
#3  0x00007ffff78e928d in thread_launcher (arg=0x7ffff0021800) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/thread/thread.c:327
#4  0x00007ffff760c53f in start_thread () from /usr/x86_64-pc-linux-gnu/lib/libpthread.so.0
#5  0x00007ffff77833b3 in clone () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6

Thread 19 (Thread 0x7fffe87f0700 (LWP 47424)):
#0  0x00007ffff77786ef in poll () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#1  0x00007ffff7898fb6 in WaitForMultipleObjects (nCount=2, lpHandles=0x7fffe87efcc0, bWaitAll=0, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:442
#2  0x00007ffff78e7594 in thread_pool_work_func (arg=0x7ffff00026a0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/pool/pool.c:77
#3  0x00007ffff78e928d in thread_launcher (arg=0x7ffff0021560) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/thread/thread.c:327
#4  0x00007ffff760c53f in start_thread () from /usr/x86_64-pc-linux-gnu/lib/libpthread.so.0
#5  0x00007ffff77833b3 in clone () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6

Thread 18 (Thread 0x7fffe8ff1700 (LWP 47423)):
#0  0x00007ffff77786ef in poll () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#1  0x00007ffff7898fb6 in WaitForMultipleObjects (nCount=2, lpHandles=0x7fffe8ff0cc0, bWaitAll=0, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:442
#2  0x00007ffff78e7594 in thread_pool_work_func (arg=0x7ffff00026a0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/pool/pool.c:77
#3  0x00007ffff78e928d in thread_launcher (arg=0x7ffff00212c0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/thread/thread.c:327
--Type <RET> for more, q to quit, c to continue without paging--
#4  0x00007ffff760c53f in start_thread () from /usr/x86_64-pc-linux-gnu/lib/libpthread.so.0
#5  0x00007ffff77833b3 in clone () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6

Thread 17 (Thread 0x7fffe97f2700 (LWP 47422)):
#0  0x00007ffff77786ef in poll () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#1  0x00007ffff7898fb6 in WaitForMultipleObjects (nCount=2, lpHandles=0x7fffe97f1cc0, bWaitAll=0, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:442
#2  0x00007ffff78e7594 in thread_pool_work_func (arg=0x7ffff00026a0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/pool/pool.c:77
#3  0x00007ffff78e928d in thread_launcher (arg=0x7ffff0021020) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/thread/thread.c:327
#4  0x00007ffff760c53f in start_thread () from /usr/x86_64-pc-linux-gnu/lib/libpthread.so.0
#5  0x00007ffff77833b3 in clone () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6

Thread 16 (Thread 0x7fffe9ff3700 (LWP 47421)):
#0  0x00007ffff77786ef in poll () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#1  0x00007ffff7898fb6 in WaitForMultipleObjects (nCount=2, lpHandles=0x7fffe9ff2cc0, bWaitAll=0, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:442
#2  0x00007ffff78e7594 in thread_pool_work_func (arg=0x7ffff00026a0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/pool/pool.c:77
#3  0x00007ffff78e928d in thread_launcher (arg=0x7ffff0020d80) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/thread/thread.c:327
#4  0x00007ffff760c53f in start_thread () from /usr/x86_64-pc-linux-gnu/lib/libpthread.so.0
#5  0x00007ffff77833b3 in clone () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6

Thread 15 (Thread 0x7fffea7f4700 (LWP 47420)):
#0  0x00007ffff77786ef in poll () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#1  0x00007ffff7898fb6 in WaitForMultipleObjects (nCount=2, lpHandles=0x7fffea7f3cc0, bWaitAll=0, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:442
#2  0x00007ffff78e7594 in thread_pool_work_func (arg=0x7ffff00026a0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/pool/pool.c:77
#3  0x00007ffff78e928d in thread_launcher (arg=0x7ffff0020ae0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/thread/thread.c:327
#4  0x00007ffff760c53f in start_thread () from /usr/x86_64-pc-linux-gnu/lib/libpthread.so.0
#5  0x00007ffff77833b3 in clone () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6

Thread 14 (Thread 0x7fffeaff5700 (LWP 47419)):
#0  0x00007ffff77786ef in poll () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#1  0x00007ffff7898fb6 in WaitForMultipleObjects (nCount=2, lpHandles=0x7fffeaff4cc0, bWaitAll=0, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:442
#2  0x00007ffff78e7594 in thread_pool_work_func (arg=0x7ffff00026a0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/pool/pool.c:77
#3  0x00007ffff78e928d in thread_launcher (arg=0x7ffff0020840) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/thread/thread.c:327
#4  0x00007ffff760c53f in start_thread () from /usr/x86_64-pc-linux-gnu/lib/libpthread.so.0
#5  0x00007ffff77833b3 in clone () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6

Thread 13 (Thread 0x7fffeb7f6700 (LWP 47418)):
#0  0x00007ffff77786ef in poll () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#1  0x00007ffff7898fb6 in WaitForMultipleObjects (nCount=2, lpHandles=0x7fffeb7f5cc0, bWaitAll=0, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:442
#2  0x00007ffff78e7594 in thread_pool_work_func (arg=0x7ffff00026a0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/pool/pool.c:77
#3  0x00007ffff78e928d in thread_launcher (arg=0x7ffff00205a0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/thread/thread.c:327
#4  0x00007ffff760c53f in start_thread () from /usr/x86_64-pc-linux-gnu/lib/libpthread.so.0
#5  0x00007ffff77833b3 in clone () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6

Thread 12 (Thread 0x7fffebff7700 (LWP 47417)):
#0  0x00007ffff77786ef in poll () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#1  0x00007ffff7898fb6 in WaitForMultipleObjects (nCount=2, lpHandles=0x7fffebff6cc0, bWaitAll=0, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:442
#2  0x00007ffff78e7594 in thread_pool_work_func (arg=0x7ffff00026a0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/pool/pool.c:77
#3  0x00007ffff78e928d in thread_launcher (arg=0x7ffff0020300) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/thread/thread.c:327
#4  0x00007ffff760c53f in start_thread () from /usr/x86_64-pc-linux-gnu/lib/libpthread.so.0
#5  0x00007ffff77833b3 in clone () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6

Thread 11 (Thread 0x7fffec7f8700 (LWP 47416)):
#0  0x00007ffff77786ef in poll () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#1  0x00007ffff7898fb6 in WaitForMultipleObjects (nCount=2, lpHandles=0x7fffec7f7cc0, bWaitAll=0, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:442
--Type <RET> for more, q to quit, c to continue without paging--
#2  0x00007ffff78e7594 in thread_pool_work_func (arg=0x7ffff00026a0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/pool/pool.c:77
#3  0x00007ffff78e928d in thread_launcher (arg=0x7ffff0020060) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/thread/thread.c:327
#4  0x00007ffff760c53f in start_thread () from /usr/x86_64-pc-linux-gnu/lib/libpthread.so.0
#5  0x00007ffff77833b3 in clone () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6

Thread 10 (Thread 0x7fffecff9700 (LWP 47415)):
#0  0x00007ffff77786ef in poll () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#1  0x00007ffff7898fb6 in WaitForMultipleObjects (nCount=2, lpHandles=0x7fffecff8cc0, bWaitAll=0, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:442
#2  0x00007ffff78e7594 in thread_pool_work_func (arg=0x7ffff00026a0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/pool/pool.c:77
#3  0x00007ffff78e928d in thread_launcher (arg=0x7ffff001fde0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/thread/thread.c:327
#4  0x00007ffff760c53f in start_thread () from /usr/x86_64-pc-linux-gnu/lib/libpthread.so.0
#5  0x00007ffff77833b3 in clone () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6

Thread 9 (Thread 0x7fffed7fa700 (LWP 47414)):
#0  0x00007ffff77786ef in poll () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#1  0x00007ffff7898fb6 in WaitForMultipleObjects (nCount=2, lpHandles=0x7fffed7f9cc0, bWaitAll=0, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:442
#2  0x00007ffff78e7594 in thread_pool_work_func (arg=0x7ffff00026a0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/pool/pool.c:77
#3  0x00007ffff78e928d in thread_launcher (arg=0x7ffff001fb60) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/thread/thread.c:327
#4  0x00007ffff760c53f in start_thread () from /usr/x86_64-pc-linux-gnu/lib/libpthread.so.0
#5  0x00007ffff77833b3 in clone () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6

Thread 8 (Thread 0x7fffedffb700 (LWP 47413)):
#0  0x00007ffff77786ef in poll () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#1  0x00007ffff7898fb6 in WaitForMultipleObjects (nCount=2, lpHandles=0x7fffedffacc0, bWaitAll=0, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:442
#2  0x00007ffff78e7594 in thread_pool_work_func (arg=0x7ffff00026a0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/pool/pool.c:77
#3  0x00007ffff78e928d in thread_launcher (arg=0x7ffff0016a50) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/thread/thread.c:327
#4  0x00007ffff760c53f in start_thread () from /usr/x86_64-pc-linux-gnu/lib/libpthread.so.0
#5  0x00007ffff77833b3 in clone () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6

Thread 7 (Thread 0x7fffee7fc700 (LWP 47412)):
#0  0x00007ffff77786ef in poll () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#1  0x00007ffff7898fb6 in WaitForMultipleObjects (nCount=2, lpHandles=0x7fffee7fbcc0, bWaitAll=0, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:442
#2  0x00007ffff78e7594 in thread_pool_work_func (arg=0x7ffff00026a0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/pool/pool.c:77
#3  0x00007ffff78e928d in thread_launcher (arg=0x7ffff00167b0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/thread/thread.c:327
#4  0x00007ffff760c53f in start_thread () from /usr/x86_64-pc-linux-gnu/lib/libpthread.so.0
#5  0x00007ffff77833b3 in clone () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6

Thread 6 (Thread 0x7fffeeffd700 (LWP 47411)):
#0  0x00007ffff77786ef in poll () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#1  0x00007ffff7898fb6 in WaitForMultipleObjects (nCount=2, lpHandles=0x7fffeeffccc0, bWaitAll=0, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:442
#2  0x00007ffff78e7594 in thread_pool_work_func (arg=0x7ffff00026a0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/pool/pool.c:77
#3  0x00007ffff78e928d in thread_launcher (arg=0x7ffff0016510) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/thread/thread.c:327
#4  0x00007ffff760c53f in start_thread () from /usr/x86_64-pc-linux-gnu/lib/libpthread.so.0
#5  0x00007ffff77833b3 in clone () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6

Thread 5 (Thread 0x7fffef7fe700 (LWP 47410)):
#0  0x00007ffff77786ef in poll () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#1  0x00007ffff7898fb6 in WaitForMultipleObjects (nCount=2, lpHandles=0x7fffef7fdcc0, bWaitAll=0, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:442
#2  0x00007ffff78e7594 in thread_pool_work_func (arg=0x7ffff00026a0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/pool/pool.c:77
#3  0x00007ffff78e928d in thread_launcher (arg=0x7ffff0016270) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/thread/thread.c:327
#4  0x00007ffff760c53f in start_thread () from /usr/x86_64-pc-linux-gnu/lib/libpthread.so.0
#5  0x00007ffff77833b3 in clone () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6

Thread 4 (Thread 0x7fffeffff700 (LWP 47409)):
--Type <RET> for more, q to quit, c to continue without paging--
#0  0x00007ffff77786ef in poll () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#1  0x00007ffff7898fb6 in WaitForMultipleObjects (nCount=2, lpHandles=0x7fffefffecc0, bWaitAll=0, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:442
#2  0x00007ffff78e7594 in thread_pool_work_func (arg=0x7ffff00026a0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/pool/pool.c:77
#3  0x00007ffff78e928d in thread_launcher (arg=0x7ffff0015fd0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/thread/thread.c:327
#4  0x00007ffff760c53f in start_thread () from /usr/x86_64-pc-linux-gnu/lib/libpthread.so.0
#5  0x00007ffff77833b3 in clone () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6

Thread 3 (Thread 0x7ffff4e82700 (LWP 47406)):
#0  0x00007ffff77786ef in poll () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#1  0x00007ffff78986ce in waitOnFd (fd=12, mode=1, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:198
#2  0x00007ffff78989db in WaitForSingleObject (hHandle=0x7ffff0003380, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:297
#3  0x00007ffff7d2e093 in play_thread (arg=0x7ffff0000f70) at /home/sss/install/git/work/FreeRDP/channels/rdpsnd/client/rdpsnd_main.c:1250
#4  0x00007ffff78e928d in thread_launcher (arg=0x7ffff00033b0) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/thread/thread.c:327
#5  0x00007ffff760c53f in start_thread () from /usr/x86_64-pc-linux-gnu/lib/libpthread.so.0
#6  0x00007ffff77833b3 in clone () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6

Thread 2 (Thread 0x7ffff5683700 (LWP 47405)):
#0  0x00007ffff76bbed5 in raise () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#1  0x00007ffff76a5857 in abort () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#2  0x00007ffff7700a67 in __libc_message () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#3  0x00007ffff770841a in malloc_printerr () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#4  0x00007ffff770c63c in _int_realloc () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#5  0x00007ffff770d836 in realloc () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#6  0x00007ffff78b6740 in Stream_EnsureCapacity (s=0x55555563d940, size=91383) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/utils/stream.c:56
#7  0x00007ffff7bd03fc in transport_handle_pdu (transport=0x55555563d410, s=0x55555563d940, left_to_read=0x55555563d460) at /home/sss/install/git/work/FreeRDP/libfreerdp/core/transport.c:798
#8  0x00007ffff7bd1392 in transport_check_fds (transport=0x55555563d410) at /home/sss/install/git/work/FreeRDP/libfreerdp/core/transport.c:1187
#9  0x00007ffff7bc3c1e in rdp_check_fds (rdp=0x555555630d30) at /home/sss/install/git/work/FreeRDP/libfreerdp/core/rdp.c:1707
#10 0x00007ffff7ba24cc in freerdp_check_fds (instance=0x55555562b5e0) at /home/sss/install/git/work/FreeRDP/libfreerdp/core/freerdp.c:333
#11 0x00007ffff7ba272a in freerdp_check_event_handles (context=0x55555562b8c0) at /home/sss/install/git/work/FreeRDP/libfreerdp/core/freerdp.c:381
#12 0x000055555557fd44 in xf_client_thread (param=0x55555562b5e0) at /home/sss/install/git/work/FreeRDP/client/X11/xf_client.c:1634
#13 0x00007ffff78e928d in thread_launcher (arg=0x5555556b7b70) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/thread/thread.c:327
#14 0x00007ffff760c53f in start_thread () from /usr/x86_64-pc-linux-gnu/lib/libpthread.so.0
#15 0x00007ffff77833b3 in clone () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6

Thread 1 (Thread 0x7ffff6419900 (LWP 47401)):
#0  0x00007ffff77786ef in poll () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#1  0x00007ffff78986ce in waitOnFd (fd=11, mode=1, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:198
#2  0x00007ffff78989db in WaitForSingleObject (hHandle=0x5555556b7b70, dwMilliseconds=4294967295) at /home/sss/install/git/work/FreeRDP/winpr/libwinpr/synch/wait.c:297
#3  0x0000555555581800 in main (argc=5, argv=0x7fffffffe078) at /home/sss/install/git/work/FreeRDP/client/X11/cli/xfreerdp.c:78

@sss123next
Copy link
Contributor Author

let's look at it with little asan )

[05:45:50:370] [93509:93555] [DEBUG][com.freerdp.channels.cliprdr.client] - ServerFormatListResponse
=================================================================
==93509==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7f3c9fdbe800 at pc 0x000000443b87 bp 0x7f3c9e64af00 sp 0x7f3c9e64a6b0
WRITE of size 8199 at 0x7f3c9fdbe800 thread T1
    #0 0x443b86 in __interceptor_memcpy.part.0 /var/tmp/paludis/build/dev-libs-compiler-rt-10.0.0-r1/work/llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:811:5
    #1 0x7f3ca6cf22cc  (/usr/x86_64-pc-linux-gnu/lib/libssl.so.48+0x302cc)
    #2 0x7f3ca6ce0a4b  (/usr/x86_64-pc-linux-gnu/lib/libssl.so.48+0x1ea4b)
    #3 0x7f3ca78d080c in bio_rdp_tls_read /home/sss/install/git/work/FreeRDP/libfreerdp/crypto/tls.c:152:11
    #4 0x7f3ca6b6ce2c in BIO_read (/usr/x86_64-pc-linux-gnu/lib/libcrypto.so.46+0xaee2c)
    #5 0x7f3ca7a2a360 in transport_read_layer /home/sss/install/git/work/FreeRDP/libfreerdp/core/transport.c:567:16
    #6 0x7f3ca7a26c78 in transport_io_data_read /home/sss/install/git/work/FreeRDP/libfreerdp/core/transport.c:887:11
    #7 0x7f3ca7a263c8 in transport_read_layer_bytes /home/sss/install/git/work/FreeRDP/libfreerdp/core/transport.c:635:11
    #8 0x7f3ca7a289fd in transport_check_fds /home/sss/install/git/work/FreeRDP/libfreerdp/core/transport.c:1178:17
    #9 0x7f3ca7a01c2c in rdp_check_fds /home/sss/install/git/work/FreeRDP/libfreerdp/core/rdp.c:1707:11
    #10 0x7f3ca799dd2c in freerdp_check_fds /home/sss/install/git/work/FreeRDP/libfreerdp/core/freerdp.c:333:11
    #11 0x7f3ca799e4dc in freerdp_check_event_handles /home/sss/install/git/work/FreeRDP/libfreerdp/core/freerdp.c:381:11
    #12 0x593967 in xf_client_thread /home/sss/install/git/work/FreeRDP/client/X11/xf_client.c:1634:9
    #13 0x7f3ca73b893b in thread_launcher /home/sss/install/git/work/FreeRDP/winpr/libwinpr/thread/thread.c:327:7
    #14 0x7f3ca716353e  (/usr/x86_64-pc-linux-gnu/lib/libpthread.so.0+0x953e)
    #15 0x7f3ca708b3b2 in clone (/usr/x86_64-pc-linux-gnu/lib/libc.so.6+0x1033b2)

0x7f3c9fdbe800 is located 0 bytes to the right of 163840-byte region [0x7f3c9fd96800,0x7f3c9fdbe800)
allocated by thread T0 here:
    #0 0x4cc357 in malloc /var/tmp/paludis/build/dev-libs-compiler-rt-10.0.0-r1/work/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:145:384
    #1 0x7f3ca72fec4a in Stream_New /home/sss/install/git/work/FreeRDP/winpr/libwinpr/utils/stream.c:92:22
    #2 0x7f3ca731be5c in StreamPool_Take /home/sss/install/git/work/FreeRDP/winpr/libwinpr/utils/collections/StreamPool.c:190:7
    #3 0x7f3ca7a29817 in transport_new /home/sss/install/git/work/FreeRDP/libfreerdp/core/transport.c:1311:29
    #4 0x7f3ca7a0255e in rdp_new /home/sss/install/git/work/FreeRDP/libfreerdp/core/rdp.c:1785:19
    #5 0x7f3ca799f60a in freerdp_context_new /home/sss/install/git/work/FreeRDP/libfreerdp/core/freerdp.c:666:8
    #6 0x7f3ca7e41e8b in freerdp_client_context_new /home/sss/install/git/work/FreeRDP/client/common/client.c:78:7
    #7 0x594b1c in main /home/sss/install/git/work/FreeRDP/client/X11/cli/xfreerdp.c:51:12
    #8 0x7f3ca6faf032 in __libc_start_main (/usr/x86_64-pc-linux-gnu/lib/libc.so.6+0x27032)

Thread T1 created by T0 here:
    #0 0x446242 in pthread_create /var/tmp/paludis/build/dev-libs-compiler-rt-10.0.0-r1/work/llvm-project/compiler-rt/lib/asan/asan_interceptors.cpp:214:3
    #1 0x7f3ca73b5d18 in winpr_StartThread /home/sss/install/git/work/FreeRDP/winpr/libwinpr/thread/thread.c:356:6
    #2 0x7f3ca73b570e in CreateThread /home/sss/install/git/work/FreeRDP/winpr/libwinpr/thread/thread.c:469:8
    #3 0x5878aa in xfreerdp_client_start /home/sss/install/git/work/FreeRDP/client/X11/xf_client.c:1788:22
    #4 0x7f3ca7e424ff in freerdp_client_start /home/sss/install/git/work/FreeRDP/client/common/client.c:127:9
    #5 0x594ce2 in main /home/sss/install/git/work/FreeRDP/client/X11/cli/xfreerdp.c:74:2
    #6 0x7f3ca6faf032 in __libc_start_main (/usr/x86_64-pc-linux-gnu/lib/libc.so.6+0x27032)

SUMMARY: AddressSanitizer: heap-buffer-overflow /var/tmp/paludis/build/dev-libs-compiler-rt-10.0.0-r1/work/llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:811:5 in __interceptor_memcpy.part.0
Shadow bytes around the buggy address:
  0x0fe813fafcb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0fe813fafcc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0fe813fafcd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0fe813fafce0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0fe813fafcf0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0fe813fafd00:[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0fe813fafd10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0fe813fafd20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0fe813fafd30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0fe813fafd40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0fe813fafd50: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==93509==ABORTING

@sss123next
Copy link
Contributor Author

it was my logic error, fixed.

Copy link
Member

@akallabeth akallabeth left a comment

Choose a reason for hiding this comment

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

Looks good overall.
Some details (marked below) must be resolved before we can continue here.

libfreerdp/core/update.c Outdated Show resolved Hide resolved
libfreerdp/core/update.c Outdated Show resolved Hide resolved
libfreerdp/core/update.c Outdated Show resolved Hide resolved
libfreerdp/core/update.c Outdated Show resolved Hide resolved
libfreerdp/core/transport.c Outdated Show resolved Hide resolved
libfreerdp/core/transport.c Outdated Show resolved Hide resolved
libfreerdp/core/transport.c Outdated Show resolved Hide resolved
@akallabeth
Copy link
Member

@freerdp-bot test

@freerdp-bot
Copy link

Refer to this link for build results (access rights to CI server needed):
https://ci.freerdp.com//job/PullRequestTester/5151/

@akallabeth
Copy link
Member

@freerdp-bot test

@freerdp-bot
Copy link

Refer to this link for build results (access rights to CI server needed):
https://ci.freerdp.com//job/PullRequestTester/5183/

@sss123next
Copy link
Contributor Author

if i properly understand, server side api already switchable and defined in listener.h ?

akallabeth
akallabeth previously approved these changes Aug 10, 2020
Copy link
Member

@akallabeth akallabeth left a comment

Choose a reason for hiding this comment

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

Overall LGTM. Still need to test a bit more though.

libfreerdp/core/transport.c Outdated Show resolved Hide resolved
libfreerdp/core/transport.c Show resolved Hide resolved
include/freerdp/io.h Outdated Show resolved Hide resolved
include/freerdp/io.h Outdated Show resolved Hide resolved
include/freerdp/io.h Outdated Show resolved Hide resolved
@akallabeth
Copy link
Member

@freerdp-bot test

@freerdp-bot
Copy link

Refer to this link for build results (access rights to CI server needed):
https://ci.freerdp.com//job/PullRequestTester/5184/

@sss123next
Copy link
Contributor Author

i am still not sure what this is enough to implement everything we need,
checking.

@akallabeth
Copy link
Member

@freerdp-bot test

@freerdp-bot
Copy link

Refer to this link for build results (access rights to CI server needed):
https://ci.freerdp.com//job/PullRequestTester/5186/

@akallabeth
Copy link
Member

@freerdp-bot test

@freerdp-bot
Copy link

Refer to this link for build results (access rights to CI server needed):
https://ci.freerdp.com//job/PullRequestTester/5197/

@akallabeth
Copy link
Member

@freerdp-bot test
@sss123next sorry, took some time, just back from vacation ;)

@freerdp-bot
Copy link

Refer to this link for build results (access rights to CI server needed):
https://ci.freerdp.com//job/PullRequestTester/5218/

@akallabeth
Copy link
Member

@sss123next ok, did some connection testing and in depth review.

  1. the callbacks should be part of rdpTransport and not rdpUpdate
  2. You changed the event handling (therefore your change in sample server) and do not create events for read

so, long story short it is currently unusable as most connections abort due to invalid data (size) read

@sss123next
Copy link
Contributor Author

sss123next commented Aug 24, 2020

can you provide more details about events ?
it looks like i missed something in this part.

@akallabeth
Copy link
Member

@sss123next have not found the source yet. Problem is that the data decoded does not start/end where it is supposed to and the connection aborts quite fast (client wise) with a protocol error (parsing something invalid)
I also do not get why you need the proxy callback, as that is just a wrapper to start a client and server instance (so should already be handled by the low level stuff)

@sss123next
Copy link
Contributor Author

sss123next commented Aug 24, 2020

@sss123next have not found the source yet. Problem is that the data decoded does not start/end where it is supposed to and the connection aborts quite fast (client wise) with a protocol error (parsing something invalid)

still not get it, sorry, but i will appreciate if you provide even more details...

existence of this event handles look strange for me, still do not get this part of design...

I also do not get why you need the proxy callback, as that is just a wrapper to start a client and server instance (so should already be handled by the low level stuff)

yes it is implemented just to be able to completely disable freerdp internal related code.

@akallabeth
Copy link
Member

@sss123next is this pr still relevant?

@sss123next
Copy link
Contributor Author

we still missing few features from this, but you said you do not want to alter internal logic this much, also i have not finished my implementation in our project yet (new api from master still not completely tested), api from master looks ok, i just not tested it yet (

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.

None yet

5 participants