Browse Source

Genodelabs/init: always route "ld.lib.so" ROM to parent

routes
Emery Hemingway 5 months ago
parent
commit
ae135e118d
2 changed files with 58 additions and 0 deletions
  1. 56
    0
      packages/genodelabs/sandbox.patch
  2. 2
    0
      packages/genodelabs/targets.nix

+ 56
- 0
packages/genodelabs/sandbox.patch View File

@@ -0,0 +1,56 @@
1
+commit 20abcefd185d72ecc55e87ff78f8f784d927653d
2
+Author: Emery Hemingway <ehmry@posteo.net>
3
+Date:   Sat Apr 25 16:08:45 2020 +0530
4
+
5
+    Init/sandbox: always route "ld.lib.so" ROM to parent
6
+    
7
+    A livelock may occur if init router the "ld.lib.so" ROM request of a
8
+    child to another child, and the child providing the ROM interacts with
9
+    Init during the creation of the session.
10
+
11
+diff --git a/repos/os/src/lib/sandbox/child.cc b/repos/os/src/lib/sandbox/child.cc
12
+index 5361665eac..fa09cca31a 100644
13
+--- a/repos/os/src/lib/sandbox/child.cc
14
++++ b/repos/os/src/lib/sandbox/child.cc
15
+@@ -448,6 +448,8 @@ Sandbox::Child::Route
16
+ Sandbox::Child::resolve_session_request(Service::Name const &service_name,
17
+                                         Session_label const &label)
18
+ {
19
++	auto no_filter = [] (Service &) -> bool { return false; };
20
++
21
+ 	/* check for "config" ROM request */
22
+ 	if (service_name == Rom_session::service_name() &&
23
+ 	    label.last_element() == "config") {
24
+@@ -498,9 +500,20 @@ Sandbox::Child::resolve_session_request(Service::Name const &service_name,
25
+ 	    label == _unique_name && _unique_name != _binary_name)
26
+ 		return resolve_session_request(service_name, _binary_name);
27
+ 
28
+-	/* supply binary as dynamic linker if '<start ld="no">' */
29
+-	if (!_use_ld && service_name == Rom_session::service_name() && label == "ld.lib.so")
30
+-		return resolve_session_request(service_name, _binary_name);
31
++	/*
32
++	 * Check for the "ld.lib.so" ROM request
33
++	 */
34
++	if (service_name == Rom_session::service_name() && label == "ld.lib.so") {
35
++		if (_use_ld) {
36
++			/* forward request to parent */
37
++			return Route {
38
++				find_service(_parent_services, Rom_session::service_name(), no_filter),
39
++				Session_label("ld.lib.so"), Session::Diag { false} };
40
++		} else {
41
++			/* supply binary as dynamic linker if '<start ld="no">' */
42
++			return resolve_session_request(service_name, _binary_name);
43
++		}
44
++	}
45
+ 
46
+ 	/* check for "session_requests" ROM request */
47
+ 	if (service_name == Rom_session::service_name()
48
+@@ -541,8 +554,6 @@ Sandbox::Child::resolve_session_request(Service::Name const &service_name,
49
+ 				Session::Diag const
50
+ 					target_diag { target.attribute_value("diag", false) };
51
+ 
52
+-				auto no_filter = [] (Service &) -> bool { return false; };
53
+-
54
+ 				if (target.has_type("parent")) {
55
+ 
56
+ 					try {

+ 2
- 0
packages/genodelabs/targets.nix View File

@@ -3,6 +3,8 @@ with ports; {
3 3
 
4 4
   gpt_write.portInputs = [ jitterentropy ];
5 5
 
6
+  init.patches = [ ./sandbox.patch ];
7
+
6 8
   intel_fb_drv = {
7 9
     BOARD = "pc";
8 10
     portInputs = [ dde_linux ];

Loading…
Cancel
Save