[PATCH] cobalt: x86: Use ipipe_root_nr_syscalls

Jan Kiszka jan.kiszka at siemens.com
Thu Jan 31 18:09:53 CET 2019


From: Jan Kiszka <jan.kiszka at siemens.com>

Required to handle compat syscalls correctly.

Signed-off-by: Jan Kiszka <jan.kiszka at siemens.com>
---

This is against next. The stable patch needs to touch kernel/cobalt
/posix/syscall.c instead.

Testing all these would be very appreciated!

 kernel/cobalt/arch/x86/include/asm/xenomai/syscall.h | 2 +-
 kernel/cobalt/include/linux/xenomai/wrappers.h       | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall.h b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall.h
index 992f1cd9c4..ea0e6fcb16 100644
--- a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall.h
+++ b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall.h
@@ -62,7 +62,7 @@
 #define __xn_rootcall_p(__regs, __code)			\
 	({						\
 		*(__code) = __xn_reg_sys(__regs);	\
-		*(__code) < NR_syscalls;		\
+		*(__code) < ipipe_root_nr_syscalls(current_thread_info()); \
 	})
 
 static inline void __xn_error_return(struct pt_regs *regs, int v)
diff --git a/kernel/cobalt/include/linux/xenomai/wrappers.h b/kernel/cobalt/include/linux/xenomai/wrappers.h
index 1d16db4218..7d00aa9d40 100644
--- a/kernel/cobalt/include/linux/xenomai/wrappers.h
+++ b/kernel/cobalt/include/linux/xenomai/wrappers.h
@@ -43,4 +43,10 @@
 		smp_store_mb((tsk)->state, (state_value))
 #endif
 
+#include <linux/ipipe.h>
+
+#ifndef ipipe_root_nr_syscalls
+#define ipipe_root_nr_syscalls(ti)	NR_syscalls
+#endif
+
 #endif /* !_COBALT_LINUX_WRAPPERS_H */
-- 
2.16.4



More information about the Xenomai mailing list