Skip to contentSkip to conversation

misc fixes

PATCH New Tommi Rantala 1 participant 3 messages Jul 27, 2013

lore
Share & tools
lore
#0 lore raw

cover misc fixes

Greetings, two small trinity fixes this time.

Tommi Rantala (2):
Fix child crash when disabling some syscalls on biarch Do not busy loop child processes on startup

 main.c    |  3 ++-
 syscall.c | 10 ++++++----
 2 files changed, 8 insertions(+), 5 deletions(-)
Signature · 1 line
1.8.1.2
#1 lore raw

PATCH 1/2 Fix child crash when disabling some syscalls on biarch

Check if search_syscall_table() fails and returns -1. This avoids crashing the child processes, that I was seeing on x86-64 with the msgrcv() syscall.

---
 syscall.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
syscall.c +6 -4
index dc93b64..866ac71 100644
@@ -112,8 +112,8 @@ long mkcall(int childno)
 {
 	unsigned long olda1, olda2, olda3, olda4, olda5, olda6;
 	unsigned int call = shm->syscallno[childno];
-	unsigned int call32, call64;
 	unsigned long ret = 0;
+	int call32, call64;
 	int errno_saved;
 	char string[512], *sptr;
 
@@ -292,10 +292,12 @@ args_done:
 			syscalls[call].entry->flags &= ~ACTIVE;
 		} else {
 			call32 = search_syscall_table(syscalls_32bit, max_nr_32bit_syscalls, syscalls[call].entry->name);
-			syscalls_32bit[call32].entry->flags &= ~ACTIVE;
+			if (call32 != -1)
+				syscalls_32bit[call32].entry->flags &= ~ACTIVE;
+
 			call64 = search_syscall_table(syscalls_64bit, max_nr_64bit_syscalls, syscalls[call].entry->name);
-			syscalls_64bit[call64].entry->flags &= ~ACTIVE;
-			output(1, "Disabled syscalls 32bit:%d 64bit:%d\n", call32, call64);
+			if (call64 != -1)
+				syscalls_64bit[call64].entry->flags &= ~ACTIVE;
 		}
 	}
 
Signature · 1 line
1.8.1.2
#2 lore raw

PATCH 2/2 Do not busy loop child processes on startup

In reply to Tommi Rantala

Stop busy looping the child processes on trinity startup, so that they do not compete with the main process for CPU time.

---
 main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
main.c +2 -1
index 1401de7..fefc4bf 100644
@@ -143,7 +143,8 @@ static void fork_children(void)
 			}
 
 			/* Wait for all the children to start up. */
-			while (shm->ready == FALSE);
+			while (shm->ready == FALSE)
+				sleep(1);
 
 			init_child(pidslot);
 
Signature · 1 line
1.8.1.2