From c1e6657f49bba51b4787478ca1716c46374f04b4 Mon Sep 17 00:00:00 2001 From: Stefan Kalkowski Date: Fri, 23 Mar 2012 12:39:20 +0100 Subject: [PATCH] Rewrite cap_integrity test for Fiasco.OC (fix #161) By commit d287b9d89387d8d307c11594413d7ab47429827f the Native_capability class changed fundamentally in the Fiasco.OC platform code of Genode. Thereby the cap_integrity test got incompatible with it. This commit introduces a separate test implementation for Fiasco.OC that does semantically the same like the old test. Please refer to issue #161. --- base/src/test/cap_integrity/foc/main.cc | 48 +++++++++++++++++++++++ base/src/test/cap_integrity/foc/target.mk | 4 ++ 2 files changed, 52 insertions(+) create mode 100644 base/src/test/cap_integrity/foc/main.cc create mode 100644 base/src/test/cap_integrity/foc/target.mk diff --git a/base/src/test/cap_integrity/foc/main.cc b/base/src/test/cap_integrity/foc/main.cc new file mode 100644 index 000000000..95eaaf57c --- /dev/null +++ b/base/src/test/cap_integrity/foc/main.cc @@ -0,0 +1,48 @@ +/* + * \brief Testing capability integrity + * \author Christian Prochaska + * \author Stefan Kalkowski + * \date 2012-02-10 + * + */ + +/* + * Copyright (C) 2008-2012 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +#include +#include + +using namespace Genode; +using namespace Fiasco; + +int main(int argc, char **argv) +{ + printf("--- capability integrity test ---\n"); + + enum { COUNT = 1000 }; + + Cap_index* idx = cap_idx_alloc()->alloc(COUNT); + Native_thread_id tid = env()->ram_session_cap().dst(); + + /* try the first 1000 local name IDs */ + for (int local_name = 0; local_name < COUNT; local_name++, idx++) { + idx->id(local_name); + l4_task_map(L4_BASE_TASK_CAP, L4_BASE_TASK_CAP, + l4_obj_fpage(tid, 0, L4_FPAGE_RWX), + idx->kcap() | L4_ITEM_MAP); + + Log_session_capability log_session_cap = + reinterpret_cap_cast(Native_capability(idx)); + Log_session_client log_session_client(log_session_cap); + try { + log_session_client.write("test message"); + } catch(...) { } + } + + printf("--- finished capability integrity test ---\n"); + return 0; +} diff --git a/base/src/test/cap_integrity/foc/target.mk b/base/src/test/cap_integrity/foc/target.mk new file mode 100644 index 000000000..792c02df2 --- /dev/null +++ b/base/src/test/cap_integrity/foc/target.mk @@ -0,0 +1,4 @@ +REQUIRES = foc +TARGET = test-cap_integrity +SRC_CC = main.cc +LIBS = env