Skip to contentSkip to conversation

s390/seccomp: fix error return for filtered system calls

PATCH In review Michael Holzheu 2 participants 2 messages Jul 25, 2016 – Oct 8, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s390/seccomp: fix error return for filtered system calls

commit dc295880c6752076f8b94ba3885d0bfff09e3e82 upstream

The syscall_set_return_value function of s390 negates the error argument before storing the value to the return register gpr2. This is incorrect, the seccomp code already passes the negative error value. Store the unmodified error value to gpr2.

---
* Requested versions for stable: v2.6.28 - v3.16
* Justification: Patch is needed e.g. for Docker seccomp support on kernels with version < 3.17.
* Bug was introduced by commit: 753c4dd6a2fa2af "[S390] ptrace changes"

---
 arch/s390/include/asm/syscall.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/arch/s390/include/asm/syscall.h index abad78d..5bc1259 100644

arch/s390/include/asm/syscall.h +0 -0
@@ -54,7 +54,7 @@ static inline void syscall_set_return_value(struct

task_struct *task, struct pt_regs *regs,
int error, long val)
{
- regs->gprs[2] = error ? -error : val;
+ regs->gprs[2] = error ? error : val;
}

static inline void syscall_get_arguments(struct task_struct *task,

Signature · 1 line
2.6.6
#1 lore raw
Quoted 11 lines · Michael Holzheu

commit dc295880c6752076f8b94ba3885d0bfff09e3e82 upstream

The syscall_set_return_value function of s390 negates the error argument before storing the value to the return register gpr2. This is incorrect, the seccomp code already passes the negative error value. Store the unmodified error value to gpr2.

---
* Requested versions for stable: v2.6.28 - v3.16

Belatedly queued this up for 3.16.

Ben.

Quoted 20 lines

* Justification: Patch is needed e.g. for Docker seccomp support on kernels with version < 3.17.
* Bug was introduced by commit: 753c4dd6a2fa2af "[S390] ptrace changes"

---
 arch/s390/include/asm/syscall.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/arch/s390/include/asm/syscall.h index abad78d..5bc1259 100644

arch/s390/include/asm/syscall.h +1 -1
@@ -54,7 +54,7 @@ static inline void syscall_set_return_value(struct
 task_struct *task, struct pt_regs *regs,
 					    int error, long val)
 {
-	regs->gprs[2] = error ? -error : val;
+	regs->gprs[2] = error ? error : val;
 }
 
 static inline void syscall_get_arguments(struct task_struct *task,
Signature · 2 lines
Ben Hutchings
compatible: Gracefully accepts erroneous data from any source