After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 774520 - GSocket allocates and processes control messages even if not requested
GSocket allocates and processes control messages even if not requested
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gio
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2016-11-16 11:13 UTC by Petr Kulhavy
Modified: 2016-11-20 16:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to completely bypass the control message processing (2.38 KB, patch)
2016-11-16 12:29 UTC, Petr Kulhavy
none Details | Review

Description Petr Kulhavy 2016-11-16 11:13:16 UTC
If g_socket_receive_message_with_timeout() is called with messages == NULL a 2048 byte buffer for control messages is still allocated in input_message_to_msghdr() and the control messages are de-serialized and disposed in input_message_from_msghdr().

This is redundant and causes extra load at high packet rate. 

Unfortunately the manpage of recvmsg isn't very specific about the minimum size of msg_control and if msg_control can be NULL. But I think we could set msg_controllen to 0 and the whole above mentioned processing would be bypassed.
Comment 1 Petr Kulhavy 2016-11-16 12:29:59 UTC
Created attachment 340012 [details] [review]
Patch to completely bypass the control message processing
Comment 2 Dan Winship 2016-11-20 16:11:12 UTC
(In reply to Petr Kulhavy from comment #0)
> Unfortunately the manpage of recvmsg isn't very specific about the minimum
> size of msg_control and if msg_control can be NULL. But I think we could set
> msg_controllen to 0 and the whole above mentioned processing would be
> bypassed.

Actually, I think it is pretty clear: if msg_controllen isn't large enough, then the control messages are discarded and MSG_CTRUNC is set in msg->msg_flags. So this is fine.

Pushed with indentation fixes. Thanks for the patch.