[LV] [PATCH] Permit 2- and 3-argument calls to open(2)
Maciej W. Rozycki
macro at linux-mips.org
Mon May 18 01:57:01 CEST 2009
All the other Linux platforms as well traditional *nix systems define the
open(2) syscall as accepting either two or three arguments as needed.
Make the debug argument-count verification code accept the syscall with
either count as a special case.
Signed-off-by: Maciej W. Rozycki <macro at linux-mips.org>
---
Please apply.
Maciej
patch-mips-2.6.25-20080422-vax-open2-2
diff -up --recursive --new-file linux-mips-2.6.25-20080422.macro/arch/vax/kernel/syscall.c linux-mips-2.6.25-20080422/arch/vax/kernel/syscall.c
--- linux-mips-2.6.25-20080422.macro/arch/vax/kernel/syscall.c 2008-05-01 00:00:00.000000000 +0000
+++ linux-mips-2.6.25-20080422/arch/vax/kernel/syscall.c 2009-05-01 17:15:30.000000000 +0000
@@ -59,7 +59,7 @@ extern asmlinkage long sys_rt_sigaction(
static struct {
unsigned long *sc_func;
- unsigned int nr_args;
+ int nr_args;
} syscall[] = {
#define SC(num, func, args) \
[num] = { \
@@ -70,7 +70,7 @@ static struct {
SC (__NR_fork, sys_fork, 0),
SC (__NR_read, sys_read, 3),
SC (__NR_write, sys_write, 3),
- SC (__NR_open, sys_open, 3),
+ SC (__NR_open, sys_open, -1),
SC (__NR_close, sys_close, 1),
SC (__NR_waitpid, sys_waitpid, 3),
SC (__NR_creat, sys_creat, 2),
@@ -271,7 +271,8 @@ void syscall_handler(struct pt_regs *reg
{
unsigned int sc_number;
unsigned int *user_ap;
- unsigned int nr_args;
+ int sc_args;
+ int nr_args;
sc_number = *(unsigned int *)(excep_info);
@@ -331,17 +332,26 @@ void syscall_handler(struct pt_regs *reg
/*
* Check number of syscall arguments
*/
- if (unlikely (syscall[sc_number].nr_args != nr_args)) {
- printk (KERN_DEBUG "%s(%d): stack mismatch (should=%d, caller=%d) on syscall %d\n",
+ sc_args = syscall[sc_number].nr_args;
+ if (unlikely(sc_args != nr_args))
+ switch (sc_args) {
+ case -1:
+ /* open(2) is special and takes two or three args. */
+ if (sc_number == __NR_open && (nr_args & ~1) == 2)
+ break;
+ /* Fall through. */
+ default:
+ printk(KERN_DEBUG "%s(%d): stack mismatch "
+ "(should=%d, caller=%d) on syscall %d\n",
current->comm, current->pid,
- syscall[sc_number].nr_args, nr_args, sc_number);
- printk (KERN_DEBUG "Please report to "
+ sc_args, nr_args, sc_number);
+ printk(KERN_DEBUG "Please report to "
"<linux-vax at pergamentum.com>.\n");
#ifdef CONFIG_DEBUG_VAX_CHECK_CHMx_ARGS_ABORT
- regs->r0 = -EFAULT;
- return;
+ regs->r0 = -EFAULT;
+ return;
#endif /* CONFIG_DEBUG_VAX_CHECK_CHMx_ARGS_ABORT */
- }
+ }
#endif /* CONFIG_DEBUG_VAX_CHECK_CHMx_ARGS */
/*
_______________________________________________
Linux-Vax mailing list
Linux-Vax at mail.pergamentum.com
http://mail.pergamentum.com/mailman/listinfo/linux-vax
More information about the Vax-linux
mailing list