From c81b3d4757905498f1dcdbca59184410666da248 Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Fri, 24 Jun 2022 11:14:26 +0200 Subject: [PATCH] base: add check whether stack belongs to ep Add method to check whether a given pointer are part of the primary stack of the rpc entrypoint. Issue #4540 --- repos/base/include/base/rpc_server.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/repos/base/include/base/rpc_server.h b/repos/base/include/base/rpc_server.h index 6749849d22..66998550eb 100644 --- a/repos/base/include/base/rpc_server.h +++ b/repos/base/include/base/rpc_server.h @@ -481,6 +481,17 @@ class Genode::Rpc_entrypoint : Thread, public Object_pool * This method is solely needed on Linux. */ bool is_myself() const; + + /** + * Check whether given stack info matches stack of the entrypoint. + * + * \noapi + * + */ + bool myself(addr_t const ptr) const + { + return addr_t(stack_base()) <= ptr && ptr <= addr_t(stack_top()); + } };