mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-29 13:38:26 +00:00
Assert if statistics counter underflows in the developer mode
There are reported occurences where the statitic counters underflows and starts reporting non-sense. Add a check for the underflow, when ``named`` is compiled in the developer mode.
This commit is contained in:
parent
89935864e9
commit
0893b5fb79
@ -148,7 +148,7 @@ AC_ARG_ENABLE([developer],
|
||||
|
||||
AS_IF([test "$enable_developer" = "yes"],
|
||||
[DEVELOPER_MODE=yes
|
||||
STD_CPPFLAGS="$STD_CPPFLAGS -DISC_MEM_DEFAULTFILL=1 -DISC_MEM_TRACKLINES=1 -DISC_LIST_CHECKINIT=1"
|
||||
STD_CPPFLAGS="$STD_CPPFLAGS -DISC_MEM_DEFAULTFILL=1 -DISC_MEM_TRACKLINES=1 -DISC_LIST_CHECKINIT=1 -DISC_STATS_CHECKUNDERFLOW=1"
|
||||
test "${enable_fixed_rrset+set}" = set || enable_fixed_rrset=yes
|
||||
test "${enable_querytrace+set}" = set || enable_querytrace=yes
|
||||
test "${with_cmocka+set}" = set || with_cmocka=yes
|
||||
|
@ -114,7 +114,11 @@ void
|
||||
isc_stats_decrement(isc_stats_t *stats, isc_statscounter_t counter) {
|
||||
REQUIRE(ISC_STATS_VALID(stats));
|
||||
REQUIRE(counter < stats->ncounters);
|
||||
#if ISC_STATS_CHECKUNDERFLOW
|
||||
REQUIRE(atomic_fetch_sub_release(&stats->counters[counter], 1) > 0);
|
||||
#else
|
||||
atomic_fetch_sub_release(&stats->counters[counter], 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
x
Reference in New Issue
Block a user