mirror of
https://gitlab.nic.cz/knot/knot-dns.git
synced 2026-02-03 18:49:28 -05:00
DEBUG: test for bug in syscall handling in Valgrind/vgdb
- added test ctl/valgrind (it always succeeds) - valgrind output can be found in knot1/stderr in the test output directory (no knot1/valgrind file with this commit) - most of needed valgrind parameters have already been set
This commit is contained in:
parent
d6347d6dc7
commit
96b4fbc2c8
5 changed files with 43 additions and 4 deletions
|
|
@ -227,6 +227,7 @@ int fdset_poll(fdset_t *set, fdset_it_t *it, const unsigned offset, const int ti
|
|||
* `set->n < it->unprocessed`. */
|
||||
if (it->unprocessed > 0 && unlikely(it->unprocessed > set->n)) {
|
||||
assert(it->unprocessed == 232);
|
||||
assert(0);
|
||||
it->unprocessed = 0;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -258,6 +259,7 @@ int fdset_poll(fdset_t *set, fdset_it_t *it, const unsigned offset, const int ti
|
|||
* `set->n < it->unprocessed`. */
|
||||
if (it->unprocessed > 0 && unlikely(it->unprocessed > set->n - offset)) {
|
||||
assert(it->unprocessed == 7);
|
||||
assert(0);
|
||||
it->unprocessed = 0;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
20
tests-extra/tests/ctl/valgrind/data/existing.zone
Normal file
20
tests-extra/tests/ctl/valgrind/data/existing.zone
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
$ORIGIN existing.
|
||||
$TTL 3600
|
||||
|
||||
@ SOA dns1 hostmaster 2010111201 10800 3600 1209600 7200
|
||||
NS dns1
|
||||
NS dns2
|
||||
MX 10 mail
|
||||
|
||||
dns1 A 192.0.2.1
|
||||
AAAA 2001:DB8::1
|
||||
|
||||
dns2 A 192.0.2.2
|
||||
AAAA 2001:DB8::2
|
||||
|
||||
mail A 192.0.2.3
|
||||
AAAA 2001:DB8::3
|
||||
|
||||
onlymaster TXT text
|
||||
|
||||
onlyslave A 100.0.0.1
|
||||
19
tests-extra/tests/ctl/valgrind/test.py
Normal file
19
tests-extra/tests/ctl/valgrind/test.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
'''Test that tries to make Valgrind corrupt syscall return values'''
|
||||
|
||||
from dnstest.test import Test
|
||||
from dnstest.utils import *
|
||||
|
||||
t = Test()
|
||||
|
||||
master = t.server("knot")
|
||||
zone = t.zone("existing.", storage=".")
|
||||
t.link(zone, master, ixfr=True)
|
||||
|
||||
t.start()
|
||||
|
||||
for i in range(50):
|
||||
master.backtrace()
|
||||
|
||||
t.end()
|
||||
|
|
@ -49,7 +49,7 @@ xdp = False
|
|||
valgrind_bin = get_binary("KNOT_TEST_VALGRIND", "valgrind")
|
||||
# KNOT_TEST_VALGRIND_FLAGS - valgrind flags.
|
||||
valgrind_flags = get_param("KNOT_TEST_VALGRIND_FLAGS",
|
||||
"--leak-check=full --show-leak-kinds=all --track-origins=yes --vgdb=yes --verbose --num-callers=20 --trace-children=yes --trace-children-skip=/usr/*sh,/bin/*sh")
|
||||
"--vgdb=yes --verbose --num-callers=20 --trace-children=yes --trace-children-skip=/usr/*sh,/bin/*sh --tool=none -v -v -v -d -d -d --trace-syscalls=yes --trace-signals=yes --trace-sched=yes")
|
||||
# KNOT_TEST_GDB - gdb binary.
|
||||
gdb_bin = get_binary("KNOT_TEST_GDB", "gdb")
|
||||
# KNOT_TEST_VGDB - vgdb binary.
|
||||
|
|
|
|||
|
|
@ -210,9 +210,7 @@ class Test(object):
|
|||
if params.valgrind_bin and \
|
||||
(valgrind or (valgrind == None and server == "knot")):
|
||||
srv.valgrind = [params.valgrind_bin] + \
|
||||
params.valgrind_flags.split() + \
|
||||
["--log-file=%s" % srv.valgrind_log] + \
|
||||
(["--undef-value-errors=no"] if xdp_enable else [])
|
||||
params.valgrind_flags.split()
|
||||
suppressions_file = "%s/%s.supp" % (params.common_data_dir, server)
|
||||
if os.path.isfile(suppressions_file):
|
||||
srv.valgrind.append("--suppressions=%s" % suppressions_file)
|
||||
|
|
|
|||
Loading…
Reference in a new issue