Module: xenomai-jki
Branch: for-forge
Commit: 92fadda472ad755db2d7b9443d3b2108a35e5d14
URL:    
http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=92fadda472ad755db2d7b9443d3b2108a35e5d14

Author: Jan Kiszka <jan.kis...@siemens.com>
Date:   Mon Jul 24 14:22:29 2017 +0200

cobalt/syscall: Filter out invalid Linux syscalls

Suggested by Philippe Gerum: Instead of propagating them down the
pipeline, triggering a XENO_BUG_ON in ipipe_fastcall_hook, catch invalid
Linux syscalls early and terminate them immediately.

Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>

---

 kernel/cobalt/posix/syscall.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index 0f905bf..8edba1f 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -26,6 +26,7 @@
 #include <cobalt/kernel/vdso.h>
 #include <cobalt/kernel/init.h>
 #include <asm-generic/xenomai/mayday.h>
+#include <asm/syscall.h>
 #include "internal.h"
 #include "thread.h"
 #include "sched.h"
@@ -656,6 +657,8 @@ linux_syscall:
                 */
                return KEVENT_PROPAGATE;
 
+       if (__xn_reg_sys(regs) >= NR_syscalls)
+               goto bad_syscall;
        /*
         * From now on, we know that we have a valid shadow thread
         * pointer.


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git

Reply via email to