Re: [Crash-catcher] [PATCH] introduce BlackListedPaths = shell_patterns to abrt.conf (fixes rhbz#582421)
by Karel Klic
(Forwarding to crash-catcher-list)
I tested the patch and it works well. Please see the comments below.
Reviewed by: Karel Klic <kklic(a)redhat.com>
On 05/06/2010 02:56 AM, Denys Vlasenko wrote:
> diff -x '*.po' -d -urpN abrt.4/src/Daemon/abrt.conf abrt.5/src/Daemon/abrt.conf
> --- abrt.4/src/Daemon/abrt.conf 2010-03-31 17:40:56.000000000 +0200
> +++ abrt.5/src/Daemon/abrt.conf 2010-05-06 02:01:15.327928666 +0200
> @@ -8,6 +8,8 @@ OpenGPGCheck = yes
> BlackList = nspluginwrapper, valgrind, strace, avant-window-navigator
> # Process crashes in executables which do not belong to any package?
> ProcessUnpackaged = no
> +# Blacklisted executable paths (shell patterns)
> +BlackListedPaths = /usr/share/doc/*, */example*
Should we mention this new item also in abrt.conf man page?
> diff -x '*.po' -d -urpN abrt.4/src/Daemon/MiddleWare.cpp abrt.5/src/Daemon/MiddleWare.cpp
> --- abrt.4/src/Daemon/MiddleWare.cpp 2010-05-06 01:53:04.836994653 +0200
> +++ abrt.5/src/Daemon/MiddleWare.cpp 2010-05-06 02:48:47.813218492 +0200
> @@ -739,6 +740,17 @@ static mw_result_t SavePackageDescriptio
> log("Blacklisted package '%s'", packageName.c_str());
> return MW_BLACKLISTED;
> }
> + set_string_t::iterator it = g_settings_setBlackListedPaths.begin();
> + while (it != g_settings_setBlackListedPaths.end())
> + {
> + if (fnmatch(it->c_str(), pExecutable, /*flags:*/ 0) == 0)
> + {
> + log("Blacklisted executable '%s'", pExecutable);
> + return MW_BLACKLISTED;
> + }
> + it++;
> + }
When the matching is placed here, BlackListedPaths does not work for
unpackaged binaries/scripts (enabled by ProcessUnpackaged = yes).
Is this behaviour intentional?
It might be the right thing to do, but this fact should IMHO be
documented in the man page (I was surprised by it).
> @@ -475,6 +481,7 @@ void SaveSettings()
> SaveBool("OpenGPGCheck", g_settings_bOpenGPGCheck, fOut);
> SaveSetString("OpenGPGPublicKeys", g_settings_setOpenGPGPublicKeys, fOut);
> SaveSetString("BlackList", g_settings_setBlackListedPkgs, fOut);
> + SaveSetString("BlackListedPaths", g_settings_setBlackListedPaths, fOut);
> fprintf(fOut, "Database = %s\n", g_settings_sDatabase.c_str());
> fprintf(fOut, "MaxCrashReportsSize = %u\n", g_settings_nMaxCrashReportsSize);
> SaveVectorPairStrings("ActionsAndReporters", g_settings_vectorActionsAndReporters, fOut);
SaveSettings() has been removed in recent git version.
Karel
14 years
[Crash-catcher] proposed fix for #580899: abrtd is dead, invalid number ''
by Karel Klic
Abrtd dies because it reads a file /var/cache/abrt/*/uid and this file
did not contain a number.
I propose to rewrite the UID loading to be more defensive, and report
MW_ERROR for the affected debug dump instead of killing whole daemon.
diff --git a/src/Daemon/MiddleWare.cpp b/src/Daemon/MiddleWare.cpp
index 667a36f..e6fba66 100644
--- a/src/Daemon/MiddleWare.cpp
+++ b/src/Daemon/MiddleWare.cpp
@@ -941,7 +941,22 @@ mw_result_t SaveDebugDump(const char *pDebugDumpDir,
return MW_ERROR;
}
- if (IsDebugDumpSaved(xatou(UID.c_str()), pDebugDumpDir))
+ /* Convert UID string to number uid_num. The UID string can be
modified by user or
+ wrongly saved (empty or non-numeric), so xatou() cannot be used
here,
+ because it would kill the daemon. */
+ char *endptr;
+ int old_errno = errno;
+ errno = 0;
+ unsigned long uid_num = strtoul(UID.c_str(), &endptr, 10);
+ if (errno || UID.c_str() == endptr || *endptr != '\0' || uid_num >
UINT_MAX)
+ {
+ error_msg("Invalid UID '%s' loaded from %s", UID.c_str(),
pDebugDumpDir);
+ errno = old_errno;
+ return MW_ERROR;
+ }
+ errno = old_errno;
+
+ if (IsDebugDumpSaved(uid_num, pDebugDumpDir))
{
return MW_IN_DB;
}
Better idea anyone?
Karel
14 years
[Crash-catcher] Es and hands white, the rest of the body black. The beautiful att
by Brondyke Volpa
{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\*\generator Msftedit 5.19.0.3534;}{\fonttbl{\f0\fnil\fcharset0 Calibri;}}
{\*\generator Msftedit 5.19.0.3534;}{\colortbl ;\red0\green0\blue255;\red192\green80\blue77;\red0\green176\blue80;\red204\green180\blue0;\red255\green0\blue0;\red223\green206\blue4;\red155\green0\blue211;\red79\green129\blue189;\red165\green165\blue165;\red128\green158\blue194;\red247\green150\blue70;\red0\green77\blue187;\red75\green172\blue198;\red221\green132\blue132;\red51\green51\blue51;\red158\green124\blue124;\red155\green187\blue89;}
{\*\generator Msftedit 5.19.0.3534;}\viewkind4\uc1\pard\sa200\sl276\slmult1\lang9\f0\fs32{\field{\*\fldinst{HYPERLINK "h{\*\dd 5.19.0.3534;}ttp://www.ca66.ru"}}{\fldrslt{\ul\cf1 http://www.ca66.ru}}}\f0\cf1\b\fs32 - Order the cheapest medications now!\par
Viagra \cf4 Cialis \cf3 Viagra Professional \cf5 Cialis Professional \cf6 Viagra Super Active+ \cf3 Cialis Super Active+ \cf7 Levitra\cf0 \cf8 Viagra Soft Tabs \cf9 Cialis Soft Tabs\cf10 \cf11 Levitra Professional \cf4 Female Viagra \cf12 Propecia \cf7 Acomplia \cf6 Xenical\cf0 \cf5 Brand Levitra \cf13 Female Cialis \cf14 Levitra Super Active+ \cf15 Tamiflu\cf0 \cf7 VPXL\cf0 \cf16 Viagra Soft Flavoured \cf5 Brand Viagra \cf17 Brand Cialis\cf0
{\*\generator Msftedit 5.19.0.3534;}}
14 years
[Crash-catcher] [PATCH] introduce BlackListedPaths = shell_patterns to abrt.conf (fixes rhbz#582421)
by Denys Vlasenko
diff -x '*.po' -d -urpN abrt.4/src/Daemon/abrt.conf abrt.5/src/Daemon/abrt.conf
--- abrt.4/src/Daemon/abrt.conf 2010-03-31 17:40:56.000000000 +0200
+++ abrt.5/src/Daemon/abrt.conf 2010-05-06 02:01:15.327928666 +0200
@@ -8,6 +8,8 @@ OpenGPGCheck = yes
BlackList = nspluginwrapper, valgrind, strace, avant-window-navigator
# Process crashes in executables which do not belong to any package?
ProcessUnpackaged = no
+# Blacklisted executable paths (shell patterns)
+BlackListedPaths = /usr/share/doc/*, */example*
# Which database plugin to use
Database = SQLite3
# Max size for crash storage [MiB]
diff -x '*.po' -d -urpN abrt.4/src/Daemon/MiddleWare.cpp abrt.5/src/Daemon/MiddleWare.cpp
--- abrt.4/src/Daemon/MiddleWare.cpp 2010-05-06 01:53:04.836994653 +0200
+++ abrt.5/src/Daemon/MiddleWare.cpp 2010-05-06 02:48:47.813218492 +0200
@@ -18,6 +18,8 @@
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include <fnmatch.h>
+#include <algorithm>
#include "abrtlib.h"
#include "abrt_types.h"
#include "Daemon.h"
@@ -27,7 +29,6 @@
#include "ABRTException.h"
#include "CommLayerInner.h"
#include "MiddleWare.h"
-#include <algorithm>
using namespace std;
@@ -739,6 +740,17 @@ static mw_result_t SavePackageDescriptio
log("Blacklisted package '%s'", packageName.c_str());
return MW_BLACKLISTED;
}
+ set_string_t::iterator it = g_settings_setBlackListedPaths.begin();
+ while (it != g_settings_setBlackListedPaths.end())
+ {
+ if (fnmatch(it->c_str(), pExecutable, /*flags:*/ 0) == 0)
+ {
+ log("Blacklisted executable '%s'", pExecutable);
+ return MW_BLACKLISTED;
+ }
+ it++;
+ }
+
if (g_settings_bOpenGPGCheck)
{
if (!s_RPM.CheckFingerprint(packageName.c_str()))
diff -x '*.po' -d -urpN abrt.4/src/Daemon/Settings.cpp abrt.5/src/Daemon/Settings.cpp
--- abrt.4/src/Daemon/Settings.cpp 2010-05-06 01:53:18.178928181 +0200
+++ abrt.5/src/Daemon/Settings.cpp 2010-05-06 02:10:19.261178497 +0200
@@ -54,6 +54,7 @@ bool g_settings_bOpenGPGCheck =
/* one line: "OpenGPGPublicKeys = value1,value2" */
set_string_t g_settings_setOpenGPGPublicKeys;
set_string_t g_settings_setBlackListedPkgs;
+set_string_t g_settings_setBlackListedPaths;
std::string g_settings_sDatabase;
unsigned int g_settings_nMaxCrashReportsSize = 1000;
bool g_settings_bProcessUnpackaged = false;
@@ -175,6 +176,11 @@ static void ParseCommon()
{
g_settings_setBlackListedPkgs = ParseList(it->second.c_str());
}
+ it = s_mapSectionCommon.find("BlackListedPaths");
+ if (it != end)
+ {
+ g_settings_setBlackListedPaths = ParseList(it->second.c_str());
+ }
it = s_mapSectionCommon.find("Database");
if (it != end)
{
@@ -475,6 +481,7 @@ void SaveSettings()
SaveBool("OpenGPGCheck", g_settings_bOpenGPGCheck, fOut);
SaveSetString("OpenGPGPublicKeys", g_settings_setOpenGPGPublicKeys, fOut);
SaveSetString("BlackList", g_settings_setBlackListedPkgs, fOut);
+ SaveSetString("BlackListedPaths", g_settings_setBlackListedPaths, fOut);
fprintf(fOut, "Database = %s\n", g_settings_sDatabase.c_str());
fprintf(fOut, "MaxCrashReportsSize = %u\n", g_settings_nMaxCrashReportsSize);
SaveVectorPairStrings("ActionsAndReporters", g_settings_vectorActionsAndReporters, fOut);
diff -x '*.po' -d -urpN abrt.4/src/Daemon/Settings.h abrt.5/src/Daemon/Settings.h
--- abrt.4/src/Daemon/Settings.h 2010-05-06 01:52:54.600178675 +0200
+++ abrt.5/src/Daemon/Settings.h 2010-05-06 02:01:26.076178548 +0200
@@ -27,6 +27,7 @@ typedef map_map_string_t map_abrt_settin
extern set_string_t g_settings_setOpenGPGPublicKeys;
extern set_string_t g_settings_setBlackListedPkgs;
+extern set_string_t g_settings_setBlackListedPaths;
extern unsigned int g_settings_nMaxCrashReportsSize;
extern bool g_settings_bOpenGPGCheck;
extern bool g_settings_bProcessUnpackaged;
14 years
[Crash-catcher] [PATCH] rid of rewriting config in /etc/abrt/abrt.conf
by Nikola Pajkovsky
Signed-off-by: Nikola Pajkovsky <npajkovs(a)redhat.com>
---
src/Daemon/Settings.cpp | 35 -----------------------------------
1 files changed, 0 insertions(+), 35 deletions(-)
diff --git a/src/Daemon/Settings.cpp b/src/Daemon/Settings.cpp
index 99a5c8d..4fe6276 100644
--- a/src/Daemon/Settings.cpp
+++ b/src/Daemon/Settings.cpp
@@ -464,38 +464,9 @@ static void SaveBool(const char* pKey, bool pBool, FILE* pFOut)
fprintf(pFOut, "%s = %s\n", pKey, (pBool ? "yes" : "no"));
}
-/* Rewrite .conf file */
-void SaveSettings()
-{
- FILE* fOut = fopen(CONF_DIR"/abrt.conf.NEW", "w");
-
- if (fOut)
- {
- SaveSectionHeader(SECTION_COMMON, fOut);
- SaveBool("OpenGPGCheck", g_settings_bOpenGPGCheck, fOut);
- SaveSetString("OpenGPGPublicKeys", g_settings_setOpenGPGPublicKeys, fOut);
- SaveSetString("BlackList", g_settings_mapBlackList, fOut);
- fprintf(fOut, "Database = %s\n", g_settings_sDatabase.c_str());
- fprintf(fOut, "MaxCrashReportsSize = %u\n", g_settings_nMaxCrashReportsSize);
- SaveVectorPairStrings("ActionsAndReporters", g_settings_vectorActionsAndReporters, fOut);
- SaveSectionHeader(SECTION_ANALYZER_ACTIONS_AND_REPORTERS, fOut);
- SaveMapVectorPairStrings(g_settings_mapAnalyzerActionsAndReporters, fOut);
- SaveSectionHeader(SECTION_CRON, fOut);
- SaveMapVectorPairStrings(g_settings_mapCron, fOut);
- if (fclose(fOut) == 0 && rename(CONF_DIR"/abrt.conf.NEW", CONF_DIR"/abrt.conf") == 0)
- {
- return; /* success */
- }
- }
- perror_msg("Error saving '%s'", CONF_DIR"/abrt.conf");
- if (fOut)
- unlink(CONF_DIR"/abrt.conf.NEW");
-}
-
/* dbus call to change some .conf file data */
void SetSettings(const map_abrt_settings_t& pSettings, const char *dbus_sender)
{
- bool dirty = false;
int polkit_result;
polkit_result = polkit_check_authorization(dbus_sender,
@@ -513,14 +484,12 @@ void SetSettings(const map_abrt_settings_t& pSettings, const char *dbus_sender)
{
s_mapSectionCommon = it->second;
ParseCommon();
- dirty = true;
}
it = pSettings.find(SECTION_ANALYZER_ACTIONS_AND_REPORTERS);
if (it != end)
{
s_mapSectionAnalyzerActionsAndReporters = it->second;
ParseAnalyzerActionsAndReporters();
- dirty = true;
}
it = pSettings.find(SECTION_CRON);
if (it != end)
@@ -529,8 +498,4 @@ void SetSettings(const map_abrt_settings_t& pSettings, const char *dbus_sender)
ParseCron();
dirty = true;
}
- if (dirty)
- {
- SaveSettings();
- }
}
--
1.6.5.2
14 years
[Crash-catcher] [PATCH] fix for 571411 and its many dupes: buggy filename comparison
by Denys Vlasenko
diff -x '*.po' -d -urpN abrt.2/src/Daemon/MiddleWare.cpp abrt.3/src/Daemon/MiddleWare.cpp
--- abrt.2/src/Daemon/MiddleWare.cpp 2010-04-30 11:50:37.000000000 +0200
+++ abrt.3/src/Daemon/MiddleWare.cpp 2010-05-05 15:26:57.169347321 +0200
@@ -86,10 +86,15 @@ static char* is_text_file(const char *na
}
/* Some files in our dump directories are known to always be textual */
- if (strcmp(name, FILENAME_BACKTRACE) == 0
- || strcmp(name, FILENAME_CMDLINE) == 0
- ) {
- return buf;
+ const char *base = strrchr(name, '/');
+ if (base)
+ {
+ base++;
+ if (strcmp(base, FILENAME_BACKTRACE) == 0
+ || strcmp(base, FILENAME_CMDLINE) == 0
+ ) {
+ return buf;
+ }
}
/* Every once in a while, even a text file contains a few garbled
14 years
[Crash-catcher] [PATCH] abrt-debuginfo-install: use --enablerepo=*-debug*
by Denys Vlasenko
Also adds --help and -v:
diff -x '*.po' -d -urpN abrt.1/src/Daemon/abrt-debuginfo-install abrt.2/src/Daemon/abrt-debuginfo-install
--- abrt.1/src/Daemon/abrt-debuginfo-install 2010-05-04 16:50:38.000000000 +0200
+++ abrt.2/src/Daemon/abrt-debuginfo-install 2010-05-05 13:22:58.244352385 +0200
@@ -47,18 +47,48 @@
# ("serious problem").
+debug=false
+# Useful if you need to see saved rpms, command outputs etc
+keep_tmp=false
+
+
+# Handle options
+if test x"$1" = x"--"; then
+ shift
+else
+ if test x"$1" = x"-v"; then
+ debug=true
+ shift
+ fi
+ if test $# -lt 2 || test x"$1" = x"--help"; then
+ echo "Usage:"
+ echo
+ echo "abrt-debuginfo-install [-v] CORE TEMPDIR [CACHEDIR[:DEBUGINFODIR...]]"
+ echo
+ echo "TEMPDIR must be a name of a new temporary directory. It must not exist."
+ echo "If CACHEDIR is specified, debuginfos are installed in CACHEDIR,"
+ echo "and TEMPDIR is deleted on exit."
+ echo "Otherwise, debuginfos are installed into TEMPDIR, which is not deleted."
+ echo
+ echo "Options:"
+ echo " -v Verbose (for debugging)"
+ echo
+ exit
+ fi
+fi
+
+
+# Parse params
core="$1"
tempdir="$2"
debuginfodirs="${3//:/ }"
cachedir="${3%%:*}"
-debug=false
-# Useful if you need to see saved rpms, command outputs etc
-keep_tmp=false
# stderr may be used for status messages too
exec 2>&1
+
error_msg_and_die() {
echo "$*"
exit 2
@@ -302,11 +332,14 @@ $debug && echo "build_ids:$build_ids"
# Prepare list of repos to use.
# When we look for debuginfo we need only -debuginfo* repos, we can disable the rest
# and thus make it faster.
-# (Without -C, yum for some reason wants to talk to repos! If one is down, it becomes S..L..O..W)
yum_repo_opts="'--disablerepo=*'"
-for enabled_repo in `LANG=C yum -C repolist all | grep 'enabled:' | cut -f1 -d' ' | grep -v -- '-debuginfo'`; do
- yum_repo_opts="$yum_repo_opts '--enablerepo=${enabled_repo}-debuginfo*'"
-done
+#// Disabled. Too often, debuginfo repos have names which do not conform to "foo-debuginfo" scheme,
+#// and users get bad backtraces.
+#// # (Without -C, yum for some reason wants to talk to repos! If one is down, it becomes S..L..O..W)
+#// for enabled_repo in `LANG=C yum -C repolist all | grep 'enabled:' | cut -f1 -d' ' | grep -v -- '-debuginfo'`; do
+#// yum_repo_opts="$yum_repo_opts '--enablerepo=${enabled_repo}-debuginfo*'"
+#// done
+yum_repo_opts="$yum_repo_opts '--enablerepo=*-debug*'"
# We try to not run yum without -C unless absolutely necessary.
14 years