[PATCH] arm: syscall.h: fix up syscall_set/get_arguments

From: Will Drewry
Date: Wed May 23 2012 - 11:54:28 EST


syscall_{get,set}_arguments currently allow up to 7 arguments and make
the system call number a virtual argument. This breaks the internal
asm/syscall.h ABI and makes the implementation incompatible with
existing implementations.

This change converts those functions to behave as they do on other
arches: 6 arguments and leave the syscall to syscall_get_nr and
syscall_rollback.

Signed-off-by: Will Drewry <wad@xxxxxxxxxxxx>
---
arch/arm/include/asm/syscall.h | 33 +++------------------------------
1 file changed, 3 insertions(+), 30 deletions(-)

diff --git a/arch/arm/include/asm/syscall.h b/arch/arm/include/asm/syscall.h
index c334a23..c30035a 100644
--- a/arch/arm/include/asm/syscall.h
+++ b/arch/arm/include/asm/syscall.h
@@ -43,29 +43,14 @@ static inline void syscall_set_return_value(struct
task_struct *task,
regs->ARM_r0 = (long) error ? error : val;
}

-#define SYSCALL_MAX_ARGS 7
+#define SYSCALL_MAX_ARGS 6

static inline void syscall_get_arguments(struct task_struct *task,
struct pt_regs *regs,
unsigned int i, unsigned int n,
unsigned long *args)
{
- if (i + n > SYSCALL_MAX_ARGS) {
- unsigned long *args_bad = args + SYSCALL_MAX_ARGS - i;
- unsigned int n_bad = n + i - SYSCALL_MAX_ARGS;
- pr_warning("%s called with max args %d, handling only %d\n",
- __func__, i + n, SYSCALL_MAX_ARGS);
- memset(args_bad, 0, n_bad * sizeof(args[0]));
- n = SYSCALL_MAX_ARGS - i;
- }
-
- if (i == 0) {
- args[0] = regs->ARM_ORIG_r0;
- args++;
- i++;
- n--;
- }
-
+ BUG_ON(i + n > SYSCALL_MAX_ARGS);
memcpy(args, &regs->ARM_r0 + i, n * sizeof(args[0]));
}

@@ -74,19 +59,7 @@ static inline void syscall_set_arguments(struct
task_struct *task,
unsigned int i, unsigned int n,
const unsigned long *args)
{
- if (i + n > SYSCALL_MAX_ARGS) {
- pr_warning("%s called with max args %d, handling only %d\n",
- __func__, i + n, SYSCALL_MAX_ARGS);
- n = SYSCALL_MAX_ARGS - i;
- }
-
- if (i == 0) {
- regs->ARM_ORIG_r0 = args[0];
- args++;
- i++;
- n--;
- }
-
+ BUG_ON(i + n > SYSCALL_MAX_ARGS);
memcpy(&regs->ARM_r0 + i, args, n * sizeof(args[0]));
}

--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/