[libdvdnav-devel] [Git][videolan/libdvdread][master] use reentrant getmntent_r

Jean-Baptiste Kempf gitlab at videolan.org
Fri Jul 19 17:24:01 CEST 2019



Jean-Baptiste Kempf pushed to branch master at VideoLAN / libdvdread


Commits:
143d06a8 by Thomas Guillem at 2019-07-19T08:31:56Z
use reentrant getmntent_r

This fixes the following data-race on VLC when 2 different inputs are opening
at the same time:

WARNING: ThreadSanitizer: data race (pid=15659)
  Write of size 8 at 0x7f79148d3140 by thread T5:
    #0 getmntent ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:3850 (libtsan.so.0+0x3d84c)
    #1 DVDOpenCommon ../src/dvd_reader.c:548 (libdvdread.so.4+0x38b6)
    #2 generic_start ../../src/modules/modules.c:258 (libvlccore.so.9+0x3bed5)
    #3 module_load ../../src/modules/modules.c:122 (libvlccore.so.9+0x3be7e)
    #4 vlc_module_load ../../src/modules/modules.c:194 (libvlccore.so.9+0x3c358)
    #5 module_need ../../src/modules/modules.c:277 (libvlccore.so.9+0x3c60c)
    #6 access_New ../../src/input/access.c:149 (libvlccore.so.9+0x5464c)
    #7 stream_AccessNew ../../src/input/access.c:294 (libvlccore.so.9+0x549c1)
    #8 InputDemuxNew ../../src/input/input.c:2413 (libvlccore.so.9+0x7528b)
    #9 InputSourceNew ../../src/input/input.c:2556 (libvlccore.so.9+0x76c1c)
    #10 Init ../../src/input/input.c:1257 (libvlccore.so.9+0x7b145)
    #11 Run ../../src/input/input.c:449 (libvlccore.so.9+0x7c3fe)

  Previous write of size 8 at 0x7f79148d3140 by thread T4:
    #0 getmntent ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:3850 (libtsan.so.0+0x3d84c)
    #1 DVDOpenCommon ../src/dvd_reader.c:548 (libdvdread.so.4+0x38b6)
    #2 generic_start ../../src/modules/modules.c:258 (libvlccore.so.9+0x3bed5)
    #3 module_load ../../src/modules/modules.c:122 (libvlccore.so.9+0x3be7e)
    #4 vlc_module_load ../../src/modules/modules.c:194 (libvlccore.so.9+0x3c358)
    #5 module_need ../../src/modules/modules.c:277 (libvlccore.so.9+0x3c60c)
    #6 access_New ../../src/input/access.c:149 (libvlccore.so.9+0x5464c)
    #7 stream_AccessNew ../../src/input/access.c:294 (libvlccore.so.9+0x549c1)
    #8 InputDemuxNew ../../src/input/input.c:2413 (libvlccore.so.9+0x7528b)
    #9 InputSourceNew ../../src/input/input.c:2556 (libvlccore.so.9+0x76c1c)
    #10 Init ../../src/input/input.c:1257 (libvlccore.so.9+0x7b145)
    #11 Preparse ../../src/input/input.c:475 (libvlccore.so.9+0x7c2b6)

- - - - -


1 changed file:

- src/dvd_reader.c


Changes:

=====================================
src/dvd_reader.c
=====================================
@@ -543,9 +543,10 @@ static dvd_reader_t *DVDOpenCommon( const char *ppath,
 #elif defined(__linux__)
     mntfile = fopen( _PATH_MOUNTED, "r" );
     if( mntfile ) {
-      struct mntent *me;
+      struct mntent *me, mbuf;
+      char buf [8192];
 
-      while( ( me = getmntent( mntfile ) ) ) {
+      while( ( me = getmntent_r( mntfile, &mbuf, buf, sizeof(buf) ) ) ) {
         if( !strcmp( me->mnt_dir, path_copy ) ) {
           fprintf( stderr,
                    "libdvdread: Attempting to use device %s"



View it on GitLab: https://code.videolan.org/videolan/libdvdread/commit/143d06a8770477b0e77ced898e39099883885103

-- 
View it on GitLab: https://code.videolan.org/videolan/libdvdread/commit/143d06a8770477b0e77ced898e39099883885103
You're receiving this email because of your account on code.videolan.org.




More information about the libdvdnav-devel mailing list