From 5a2d4c34370f106f0c3824092ec51b3a34191892 Mon Sep 17 00:00:00 2001
From: Christian Prochaska <christian.prochaska@genode-labs.com>
Date: Wed, 28 Jun 2023 13:29:18 +0200
Subject: [PATCH] monitor: apply 'wx' policy

Fixes #4943
---
 repos/os/src/monitor/inferior_pd.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/repos/os/src/monitor/inferior_pd.h b/repos/os/src/monitor/inferior_pd.h
index c02cfbe499..fcd840053a 100644
--- a/repos/os/src/monitor/inferior_pd.h
+++ b/repos/os/src/monitor/inferior_pd.h
@@ -128,8 +128,10 @@ struct Monitor::Inferior_pd : Monitored_pd_session
 			[&] (Xml_node const policy) { _policy = Policy::from_xml(policy); },
 			[&]                         { _policy = Policy::default_policy(); });
 
-		_address_space.writeable_text_segments(_alloc, _wx_ram, _local_rm);
-		_linker_area  .writeable_text_segments(_alloc, _wx_ram, _local_rm);
+		if (_policy.wx) {
+			_address_space.writeable_text_segments(_alloc, _wx_ram, _local_rm);
+			_linker_area  .writeable_text_segments(_alloc, _wx_ram, _local_rm);
+		}
 	}
 
 	long unsigned id() const { return _inferiors_elem.id().value; }