From 48580e44c721e7a4cf37bf0828676368a1b63d56 Mon Sep 17 00:00:00 2001
From: Markus Ostermayer <markus.ostermayer@student.tugraz.at>
Date: Sun, 1 Jan 2023 00:54:55 +0100
Subject: [PATCH] added support for userspace ssps

---
 setup.cfg          | 2 +-
 swet/_testutils.py | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/setup.cfg b/setup.cfg
index 47647b1..49387d0 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,6 +1,6 @@
 [metadata]
 name = swet
-version = 0.0.6
+version = 0.0.7
 description = SWET (Schon wieder ein Testsystem) is a minimal Testsystem for SWEB (Schon wieder ein Betriebssystem)
 long_description = file: README.md
 long_description_content_type = text/markdown
diff --git a/swet/_testutils.py b/swet/_testutils.py
index b338fb1..0c14864 100644
--- a/swet/_testutils.py
+++ b/swet/_testutils.py
@@ -18,6 +18,7 @@ class Result(Enum):
     failed = 'FAILED'
     skipped = 'SKIPPED'
     vfs_error = 'VFS-ERROR'
+    userspace_ssp = 'Userspace Stack Smashing Protector'
 
 
 class Colors(Enum):
@@ -32,6 +33,7 @@ TEST_RESULT_COLORS = {
     Result.failed: Colors.red,
     Result.skipped: Colors.yellow,
     Result.vfs_error: Colors.yellow,
+    Result.userspace_ssp: Colors.yellow,
 }
 
 QEMU_EXECUTE_COMMAND = [
@@ -167,6 +169,9 @@ def execute_test(
                 elif 'KERNEL PANIC' in logline:
                     test_result = Result.failed
 
+                elif 'Bufferoverflow detected!' in logline:
+                    test_result = Result.userspace_ssp
+
         qemu_prozess.terminate()
 
         _print_testresult(
@@ -182,6 +187,8 @@ def execute_test(
         for line in test_log:
             print(line)
         return -1
+    elif test_result == Result.userspace_ssp:
+        return -1
     else:
         return 0
 
-- 
GitLab