[mythtv-commits] Ticket #10015: mythbackend segfaults (etc.) don't drop core if run with --user.

MythTV noreply at mythtv.org
Tue Aug 30 16:39:51 UTC 2011


#10015: mythbackend segfaults (etc.) don't drop core if run with --user.
--------------------------------------------+------------------------------
 Reporter:  Bill Meek <keemllib@…>          |           Type:  Patch - Bug
   Status:  new                             |  Fix
Milestone:  unknown                         |       Priority:  minor
  Version:  Trunk Head                      |      Component:  MythTV -
 Keywords:                                  |  General
                                            |       Severity:  medium
                                            |  Ticket locked:  0
--------------------------------------------+------------------------------
 When running mythbackend with the --user argument, setgid() and
 seteuid() functions are called.  They reset the dumpable flag
 and core files won't be created when, for example, a segfault
 is encountered.

 As before this suggested patch, ulimit -c 0 will disable the core dumps.

 References:
 {{{
 man prctl (PR_SET_DUMPABLE section)
 man proc (/proc/sys/fs/suid_dumpable section)
 }}}

 Tested under mythbuntu 10.10/MythTV v0.25pre-3155-g1067f8c.

 {{{
 diff --git a/mythtv/libs/libmythbase/mythcommandlineparser.cpp
 b/mythtv/libs/libmythbase/mythcommandlineparser.cpp
 index 7fc83eb..8fb514b 100644
 --- a/mythtv/libs/libmythbase/mythcommandlineparser.cpp
 +++ b/mythtv/libs/libmythbase/mythcommandlineparser.cpp
 @@ -9,6 +9,7 @@
  #ifndef _WIN32
  #include <pwd.h>
  #include <grp.h>
 +#include <sys/prctl.h>
  #endif

  using namespace std;
 @@ -1203,6 +1204,10 @@ bool setUser(const QString &username)
              cerr << "Error setting effective user." << endl;
              return false;
          }
 +        if (prctl(PR_SET_DUMPABLE, 1) == -1)
 +        {
 +            cerr << "Warning, unable to allow core file creation." <<
 endl;
 +        }
      }
      else
      {
 }}}

-- 
Ticket URL: <http://code.mythtv.org/trac/ticket/10015>
MythTV <http://code.mythtv.org/trac>
MythTV Media Center


More information about the mythtv-commits mailing list