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 682775 - shmsink shmsrc permission problems
shmsink shmsrc permission problems
Status: RESOLVED INCOMPLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
0.10.x
Other Linux
: Normal normal
: NONE
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-08-27 09:10 UTC by Levente Farkas
Modified: 2016-12-28 11:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Control socket permission patch (1.36 KB, patch)
2013-01-05 02:18 UTC, Roland Elek
none Details | Review
shmsrc segfault stack trace (2.81 KB, text/plain)
2013-01-05 02:53 UTC, Roland Elek
  Details
socket permission patch v2 (1.19 KB, patch)
2013-01-07 14:49 UTC, Roland Elek
committed Details | Review

Description Levente Farkas 2012-08-27 09:10:37 UTC
when we try to use shmsink and shmsrc from 2 different users eg. user1 and user2. in this case currently gstreamer apps segfault eg from gstreamer-java we simple got a segfault. the reason for this (may be) comes from 2 reason:
the shmsink has a perms flag, but it's only used for the shm area:
shm_open (path, flags, perms);
but do not applied to the control socket and in this case the two different user are not able to communicate each other since the shmsrc has no permission (by default) to the socket.

another strange thing we got in the log:
shm_open failed on /shmpipe. 2910.    0 (13): Permission denied
but we do give a socket path to the shmsrc so why use the generated file in the above message?
Comment 1 Levente Farkas 2012-08-27 09:33:27 UTC
not to mention that it shouldn't segfault in any case.

anyway why the shmsrc create a pipe? according to the docs only the shmsink create socket....
Comment 2 Tim-Philipp Müller 2013-01-04 21:10:55 UTC
Please provide a stack trace for the segfault.
Comment 3 Roland Elek 2013-01-05 02:18:58 UTC
Created attachment 232804 [details] [review]
Control socket permission patch

With this patch, shm area permissions are also applied to the control socket.

As for the segfault and log message, it is reproducible with at least 0.10.23, on the shmsrc side, if the user has write, but not read permission as set in the shmsink perms property (with the patch applied). I'll attach the stack trace as the next attachment. AFAICT, the /shmpipe. 2910.    0 in the log message is a shared memory object name (man 3 shm_open is my source) always auto-generated on the shmsink side, and sent to the shmsrc side as a control packet. Thus, it is unrelated to the socket path.
Comment 4 Roland Elek 2013-01-05 02:53:46 UTC
Created attachment 232806 [details]
shmsrc segfault stack trace

Rebuilt with CFLAGS='-O0 -ggdb', shmsrc side run in gdb.
Comment 5 Roland Elek 2013-01-07 14:49:59 UTC
Created attachment 232906 [details] [review]
socket permission patch v2

Corrected previous patch.
Comment 6 Olivier Crête 2013-01-18 00:25:49 UTC
Comment on attachment 232906 [details] [review]
socket permission patch v2

committed

commit 2cacfa293214a2c840cfe422ae7a6f3c0c77e69b
Author: Roland Elek <relek.f2@gmail.com>
Date:   Mon Jan 7 13:32:06 2013 +0100

    shm: apply shm area permissions to shmpipe control socket
    
    Apply shared memory area permissions to the control socket (more
    precisely, the path it is bound to) as well.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=682775
Comment 7 Levente Farkas 2013-01-18 00:31:15 UTC
please apply to 0.10 too.
Comment 8 Olivier Crête 2013-01-18 00:32:39 UTC
The shmsrc doesn't create a socket, it opens the shared memory area so it can read from it. I don't see how your crash is related to the patch your provided.

Can you try with G_SLICE=debug-blocks and see if you get something different? It sounds like there is corruption somewhere in your application.
Comment 9 Levente Farkas 2013-01-18 00:35:54 UTC
(In reply to comment #8)
> The shmsrc doesn't create a socket, it opens the shared memory area so it can
> read from it. I don't see how your crash is related to the patch your provided.
> 
> Can you try with G_SLICE=debug-blocks and see if you get something different?
> It sounds like there is corruption somewhere in your application.

see #3
Comment 10 Olivier Crête 2013-02-28 18:42:05 UTC
Is it still reproducible ?
Comment 11 Levente Farkas 2013-02-28 23:03:01 UTC
i'm just apply all of the shm patches (i find some more differences in the 0.10 and our version). we'll check it in the next days..
Comment 12 Nicolas Dufresne (ndufresne) 2014-05-20 21:44:57 UTC
Ping.
Comment 13 Tim-Philipp Müller 2016-12-28 11:58:32 UTC
Closing this bug report as no further information has been provided. Please feel free to reopen this bug report if you can provide the information that was asked for in a previous comment.
Thanks!