From 64d10c4f21d9e94e7d73fb3abeaf9e4ad4ecc5cb Mon Sep 17 00:00:00 2001 From: Marius Muench Date: Mon, 4 Nov 2019 13:43:43 +0100 Subject: [PATCH] Ci fixes (#39) * add ptrace caps to ci-docker * seccomp opt to allow gdbserver to enable aslr * increase sleeptime in test_gdbprotocol * execute gdbs target.run() as blocking=True * Fix ci-ubuntu version of gdb to 8.1-0ubuntu3 The most modern version of gdb, 8.1-0ubuntu3.1, introduces a bug when it comes to 32bit binaries on 64bit systems. This affects our CI, hence, let's use the slightly older 8.1-0ubuntu3 instead. Thanks for bringing this bug to our attention goes to @reyammer. * disabled temporary logging on testcase --- .travis.yml | 6 +++--- avatar2/targets/gdb_target.py | 2 +- tests/smoke/target_wait.py | 1 + tests/test_gdbprotocol.py | 13 ++++++++----- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index fb4cf509ee..7c94bb1699 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ services: before_install: - docker pull ubuntu:18.04 - - docker run -v /home/travis/build/$TRAVIS_REPO_SLUG:/avatar2 --name ubuntu -dit ubuntu:18.04 + - docker run -v /home/travis/build/$TRAVIS_REPO_SLUG:/avatar2 --name ubuntu --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -dit ubuntu:18.04 - docker exec ubuntu apt-get update - docker exec ubuntu apt-get install -y sudo @@ -20,9 +20,9 @@ install: - docker exec ubuntu apt-get install -y python python-pip - docker exec ubuntu apt-get install -y python3 python3-pip - docker exec ubuntu apt-get install -y libc6-i386 - - docker exec ubuntu apt-get install -y gdb + - docker exec ubuntu apt-get install -y gdb=8.1-0ubuntu3 - docker exec ubuntu apt-get install -y pkg-config - - docker exec ubuntu apt-get install -y gdb-multiarch + - docker exec ubuntu apt-get install -y gdb-multiarch=8.1-0ubuntu3 - docker exec ubuntu apt-get install -y libcapstone3 - docker exec ubuntu apt-get install -y libcapstone-dev - docker exec ubuntu pip2 install --upgrade pip diff --git a/avatar2/targets/gdb_target.py b/avatar2/targets/gdb_target.py index 603c6f5c42..3b8887909e 100644 --- a/avatar2/targets/gdb_target.py +++ b/avatar2/targets/gdb_target.py @@ -74,7 +74,7 @@ def init(self): @watch('TargetCont') @action_valid_decorator_factory(TargetStates.INITIALIZED, 'execution') @synchronize_state(TargetStates.RUNNING) - def run(self): + def run(self, blocking=True): return self.protocols.execution.run() def cont(self, blocking=True): diff --git a/tests/smoke/target_wait.py b/tests/smoke/target_wait.py index 54d7f9eb94..2bddde790b 100644 --- a/tests/smoke/target_wait.py +++ b/tests/smoke/target_wait.py @@ -4,6 +4,7 @@ import avatar2 import os import logging +import sys from time import sleep from nose.tools import * diff --git a/tests/test_gdbprotocol.py b/tests/test_gdbprotocol.py index e3f13ecf66..ca7e9abe20 100644 --- a/tests/test_gdbprotocol.py +++ b/tests/test_gdbprotocol.py @@ -7,6 +7,7 @@ from nose.tools import * +SLEEP_TIME = 1 port = 4444 p = None @@ -60,7 +61,8 @@ def test_break_run_and_read_write_mem(): ret = g.cont() assert_equal(ret, True) # todo: enable waiting - time.sleep(.2) + + time.sleep(SLEEP_TIME) ret = g.read_memory(0x08048000, 4) assert_equal(ret, 0x464c457f) @@ -81,15 +83,15 @@ def test_continue_stopping_stepping(): ret = g.stop() assert_equal(ret, True) - time.sleep(.2) + time.sleep(SLEEP_TIME) ret = g.step() assert_equal(ret, True) - time.sleep(.2) + time.sleep(SLEEP_TIME) @with_setup(setup_helloworld, teardown_func) -def test_wacthpoint(): +def test_watchpoint(): ret = g.set_watchpoint(0x080484c0, read=True, write=False) assert_equal(ret, True) @@ -97,7 +99,8 @@ def test_wacthpoint(): ret = g.cont() assert_equal(ret, True) - time.sleep(.2) + + time.sleep(SLEEP_TIME) ret = g.read_memory(0x08048000, 4) assert_equal(ret, 0x464c457f)