Modify ↓
Ticket #10015 (closed Patch - Bug Fix: fixed)
Opened 21 months ago
Last modified 21 months ago
mythbackend segfaults (etc.) don't drop core if run with --user.
| Reported by: | Bill Meek <keemllib@…> | Owned by: | mdean |
|---|---|---|---|
| Priority: | minor | Milestone: | 0.25 |
| Component: | MythTV - General | Version: | Master Head |
| Severity: | medium | Keywords: | |
| Cc: | Ticket locked: | no |
Description
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
{
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

Re-enable core file creation after setuid()
Re-enables core file creation on Linux-based systems after the call to setuid() for users who start mythtv daemon applications using the --user command-line argument.
Fixes #10015 with a slightly-modified version of the patch from Bill Meek.