[PATCH 04/13] kselftest: arm64: mangle_pc_invalid

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Added a simple mangle testcase which messes with the ucontext_t
from within the sig_handler, trying to badly modify the PC to point
toward Kernel land.
Expects SIGSEGV on test PASS.

Signed-off-by: Cristian Marussi <cristian.marussi@xxxxxxx>
---
 .../arm64/signal/testcases/.gitignore         |  1 +
 .../signal/testcases/mangle_pc_invalid.c      | 24 +++++++++++++++++++
 2 files changed, 25 insertions(+)
 create mode 100644 tools/testing/selftests/arm64/signal/testcases/mangle_pc_invalid.c

diff --git a/tools/testing/selftests/arm64/signal/testcases/.gitignore b/tools/testing/selftests/arm64/signal/testcases/.gitignore
index 7f7414d241f2..a87fb0f0d2cf 100644
--- a/tools/testing/selftests/arm64/signal/testcases/.gitignore
+++ b/tools/testing/selftests/arm64/signal/testcases/.gitignore
@@ -1 +1,2 @@
 mangle_sp_misaligned
+mangle_pc_invalid
diff --git a/tools/testing/selftests/arm64/signal/testcases/mangle_pc_invalid.c b/tools/testing/selftests/arm64/signal/testcases/mangle_pc_invalid.c
new file mode 100644
index 000000000000..0024032528bc
--- /dev/null
+++ b/tools/testing/selftests/arm64/signal/testcases/mangle_pc_invalid.c
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/* Copyright (C) 2019 ARM Limited */
+
+#include "test_signals_utils.h"
+#include "testcases.h"
+
+static int mangle_invalid_pc_run(struct tdescr *td, siginfo_t *si,
+				 ucontext_t *uc)
+{
+	ASSERT_GOOD_CONTEXT(uc);
+
+	uc->uc_mcontext.pc = 0xffffffffcccccccc;
+
+	return 1;
+}
+
+struct tdescr tde = {
+		.sanity_disabled = true,
+		.name = "MANGLE_PC_INVALID",
+		.descr = "Mangling uc_mcontext with INVALID PC",
+		.sig_trig = SIGUSR1,
+		.sig_ok = SIGSEGV,
+		.run = mangle_invalid_pc_run,
+};
-- 
2.17.1




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux