Skip to contentSkip to conversation

Opteron support for mqueues-4.00 +bug fixes

PATCH RESEND Andi Kleen 2 participants 2 messages Nov 20, 2003 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Andi Kleen

author
#1 lore raw

Review

Quoted 3 lines · [email protected] (Joe Korty) writes:

__SYSCALL(__NR_vserver, sys_ni_syscall)

(quoted diff) +2 -0
+#define __NR_mq_open			274
+__SYSCALL(__NR_mq_open, sys_mq_open)

The patch is buggy. You cannot add any unmapped holes into the x86-64 system call table, it adds an oopsable hole to the entry.

In general you cannot add any system calls without coordinating with Linus and the architecture maintainers first. And the list is not sparse.

-Andi

#2 lore raw
Quoted 7 lines

Review

Quoted 3 lines · [email protected] (Joe Korty) writes:

__SYSCALL(__NR_vserver, sys_ni_syscall)

(quoted diff) +2 -0
+#define __NR_mq_open			274
+__SYSCALL(__NR_mq_open, sys_mq_open)

The patch is buggy. You cannot add any unmapped holes into the x86-64 system call table, it adds an oopsable hole to the entry.

Indeed. Thanks for looking this over. Repaired patch attached.

Quoted 2 lines

In general you cannot add any system calls without coordinating with Linus and the architecture maintainers first. And the list is not sparse.

When Linus et all assign numbers I am sure Michal & Krzysztof will use them. Until then these are informal patches for people to play with and tweak as they please.

Joe

Patchname: mqueues-4.00-kernel-a1.patch

arch/x86_64/ia32/ia32entry.S +10 -0
diff -ura 4.00/arch/x86_64/ia32/ia32entry.S new/arch/x86_64/ia32/ia32entry.S
@@ -476,6 +476,16 @@
 	.quad sys_tgkill
 	.quad compat_sys_utimes
 	.quad sys32_fadvise64_64
+	.quad ni_syscall
+
+	.quad compat_sys_mq_open
+	.quad sys_mq_unlink
+	.quad compat_sys_mq_timedsend
+	.quad compat_sys_mq_timedreceive
+	.quad compat_sys_mq_notify
+	.quad compat_sys_mq_getattr
+	.quad compat_sys_mq_setattr
+
 	/* don't forget to change IA32_NR_syscalls */
 ia32_syscall_end:		
 	.rept IA32_NR_syscalls-(ia32_syscall_end-ia32_sys_call_table)/8
include/asm-x86_64/ia32_unistd.h +9 -1
diff -ura 4.00/include/asm-x86_64/ia32_unistd.h new/include/asm-x86_64/ia32_unistd.h
@@ -279,6 +279,14 @@
 #define __NR_ia32_utimes		271
 #define __NR_ia32_fadvise64_64		272
 
-#define IA32_NR_syscalls 275	/* must be > than biggest syscall! */	
+#define __NR_ia32_mq_open 		274
+#define __NR_ia32_mq_unlink		(__NR_ia32_mqopen+1)
+#define __NR_ia32_mq_timedsend		(__NR_ia32_mqopen+2)
+#define __NR_ia32_mq_timedreceive	(__NR_ia32_mqopen+3)
+#define __NR_ia32_mq_notify		(__NR_ia32_mqopen+4)
+#define __NR_ia32_mq_getattr		(__NR_ia32_mqopen+5)
+#define __NR_ia32_mq_setattr		(__NR_ia32_mqopen+6)
+
+#define IA32_NR_syscalls 281	/* must be > than biggest syscall! */	
 
 #endif /* _ASM_X86_64_IA32_UNISTD_H_ */
include/asm-x86_64/unistd.h +16 -1
diff -ura 4.00/include/asm-x86_64/unistd.h new/include/asm-x86_64/unistd.h
@@ -532,8 +532,23 @@
 __SYSCALL(__NR_utimes, sys_utimes)
 #define __NR_vserver		236
 __SYSCALL(__NR_vserver, sys_ni_syscall)
+#define __NR_mq_open		237
+__SYSCALL(__NR_mq_open, sys_mq_open)
+#define __NR_mq_unlink		238
+__SYSCALL(__NR_mq_unlink, sys_mq_unlink)
+#define __NR_mq_timedsend	239
+__SYSCALL(__NR_mq_timedsend, sys_mq_timedsend)
+#define __NR_mq_timedreceive	240
+__SYSCALL(__NR_mq_timedreceive, sys_mq_timedreceive)
+#define __NR_mq_notify		241
+__SYSCALL(__NR_mq_notify, sys_mq_notify)
+#define __NR_mq_getattr		242
+__SYSCALL(__NR_mq_getattr, sys_mq_getattr)
+#define __NR_mq_setattr		243
+__SYSCALL(__NR_mq_setattr, sys_mq_setattr)
 
-#define __NR_syscall_max __NR_vserver
+#undef __NR_syscall_max
+#define __NR_syscall_max __NR_mq_setattr
 #ifndef __NO_STUBS
 
 /* user-visible error numbers are in the range -1 - -4095 */
include/linux/compat.h +2 -2
diff -ura 4.00/include/linux/compat.h new/include/linux/compat.h
@@ -44,8 +44,8 @@
 } compat_sigset_t;
 
 extern int cp_compat_stat(struct kstat *, struct compat_stat *);
-extern int get_compat_timespec(struct timespec *, struct compat_timespec *);
-extern int put_compat_timespec(struct timespec *, struct compat_timespec *);
+extern int get_compat_timespec(struct timespec *, const struct compat_timespec *);
+extern int put_compat_timespec(struct timespec *, const struct compat_timespec *);
 
 struct compat_iovec {
 	compat_uptr_t	iov_base;
include/linux/mqueue.h +8 -6
diff -ura 4.00/include/linux/mqueue.h new/include/linux/mqueue.h
@@ -21,12 +21,14 @@
 	long mq_curmsgs;	/* number of messages currently queued */
 };
 
-asmlinkage mqd_t sys_mq_open(const char __user *name, int oflag, mode_t mode, struct mq_attr __user *attr);
-asmlinkage int sys_mq_unlink(const char __user *name);
-asmlinkage int mq_timedsend(mqd_t mqdes, const char __user *msg_ptr, size_t msg_len, unsigned int msg_prio, const struct timespec __user *abs_timeout);
+#ifdef __KERNEL__
+asmlinkage long sys_mq_open(const char __user *name, int oflag, mode_t mode, struct mq_attr __user *attr);
+asmlinkage long sys_mq_unlink(const char __user *name);
+asmlinkage long mq_timedsend(mqd_t mqdes, const char __user *msg_ptr, size_t msg_len, unsigned int msg_prio, const struct timespec __user *abs_timeout);
 asmlinkage ssize_t mq_timedreceive(mqd_t mqdes, char __user *msg_ptr, size_t msg_len, unsigned int __user *msg_prio, const struct timespec __user *abs_timeout);
-asmlinkage int mq_notify(mqd_t mqdes, const struct sigevent __user *notification);
-asmlinkage int mq_getattr(mqd_t mqdes, struct mq_attr __user *mqstat);
-asmlinkage int mq_setattr(mqd_t mqdes, const struct mq_attr __user *mqstat, struct mq_attr __user *omqstat);
+asmlinkage long mq_notify(mqd_t mqdes, const struct sigevent __user *notification);
+asmlinkage long mq_getattr(mqd_t mqdes, struct mq_attr __user *mqstat);
+asmlinkage long mq_setattr(mqd_t mqdes, const struct mq_attr __user *mqstat, struct mq_attr __user *omqstat);
+#endif
 
 #endif
ipc/mqueue.c +251 -17

351 lines not on this page · raw message

kernel/compat.c +2 -2
diff -ura 4.00/kernel/compat.c new/kernel/compat.c
@@ -22,14 +22,14 @@
 
 #include <asm/uaccess.h>
 
-int get_compat_timespec(struct timespec *ts, struct compat_timespec *cts)
+int get_compat_timespec(struct timespec *ts, const struct compat_timespec *cts)
 {
 	return (verify_area(VERIFY_READ, cts, sizeof(*cts)) ||
 			__get_user(ts->tv_sec, &cts->tv_sec) ||
 			__get_user(ts->tv_nsec, &cts->tv_nsec)) ? -EFAULT : 0;
 }
 
-int put_compat_timespec(struct timespec *ts, struct compat_timespec *cts)
+int put_compat_timespec(struct timespec *ts, const struct compat_timespec *cts)
 {
 	return (verify_area(VERIFY_WRITE, cts, sizeof(*cts)) ||
 			__put_user(ts->tv_sec, &cts->tv_sec) ||