public inbox for trinity@vger.kernel.org
 help / color / mirror / Atom feed
From: Tommi Rantala <tt.rantala@gmail.com>
To: davej@redhat.com
Cc: trinity@vger.kernel.org, Tommi Rantala <tt.rantala@gmail.com>
Subject: [PATCH 1/2] Fix child crash when disabling some syscalls on biarch
Date: Sat, 27 Jul 2013 17:35:15 +0300	[thread overview]
Message-ID: <1374935716-26961-2-git-send-email-tt.rantala@gmail.com> (raw)
In-Reply-To: <1374935716-26961-1-git-send-email-tt.rantala@gmail.com>

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(-)

diff --git a/syscall.c b/syscall.c
index dc93b64..866ac71 100644
--- a/syscall.c
+++ b/syscall.c
@@ -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;
 		}
 	}
 
-- 
1.8.1.2

  reply	other threads:[~2013-07-27 14:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-27 14:35 [PATCH 0/2] misc fixes Tommi Rantala
2013-07-27 14:35 ` Tommi Rantala [this message]
2013-07-27 14:35 ` [PATCH 2/2] Do not busy loop child processes on startup Tommi Rantala

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1374935716-26961-2-git-send-email-tt.rantala@gmail.com \
    --to=tt.rantala@gmail.com \
    --cc=davej@redhat.com \
    --cc=trinity@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox