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 684339 - shm: use O_CLOEXEC where appropriate in shmpipe
shm: use O_CLOEXEC where appropriate in shmpipe
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
0.10.22
Other Linux
: Normal normal
: 1.1.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-09-19 01:32 UTC by blake tregre
Modified: 2013-02-28 17:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch to add CLOEXEC in sp_client_open (1.02 KB, patch)
2012-09-19 01:32 UTC, blake tregre
none Details | Review
patch to add SOCK_CLOEXEC in sp_writer_create (1.78 KB, patch)
2012-09-19 01:33 UTC, blake tregre
none Details | Review
patch to add CLOEXEC in sp_writer_create and sp_client_open (2.93 KB, patch)
2012-11-08 21:30 UTC, Aleix Conchillo Flaqué
none Details | Review

Description blake tregre 2012-09-19 01:32:50 UTC
Created attachment 224682 [details] [review]
patch to add CLOEXEC in sp_client_open

shmpipe.c provides two functions which open sockets, one for shmsrc, a reader, and one for shmsink, a writer.  sp_client_open opens a socket but doesn't set CLOEXEC, so i've provided an '#if defined' version which uses SOCK_CLOEXEC if it's defined and otherwise uses fnctl and O_CLOEXEC.  sp_writer_create opens the socket for the writer and sets CLOEXEC, but it doesn't make use of SOCK_CLOEXEC, which can lead to a race condition.
Comment 1 blake tregre 2012-09-19 01:33:18 UTC
Created attachment 224683 [details] [review]
patch to add SOCK_CLOEXEC in sp_writer_create
Comment 2 Aleix Conchillo Flaqué 2012-11-08 21:30:56 UTC
Created attachment 228512 [details] [review]
patch to add CLOEXEC in sp_writer_create and sp_client_open

Patch updated. sp_client_open socket does need to be blocking (non-blocking flag was added by accident in the previous patches).
Comment 3 Olivier Crête 2013-02-28 17:44:44 UTC
I pushed the patch for O_CLOEXEC, but I'm not convinced about the usefulness of SOCK_CLOEXEC, because

1. you have to build against recent linux
2. you have to test at runtime if you're running against a recent enough kernel (and fallback to fcntl anyway).
3. fcntl isn't that expensive at all

commit c175c6b3d083f6bf3798cd172b38c4979b067c73
Author: Blake Tregre <blake@oblong.com>
Date:   Thu Nov 8 13:22:41 2012 -0800

    shm: use O_CLOEXEC where appropriate in shmpipe
    
    https://bugzilla.gnome.org/show_bug.cgi?id=684339