提交 46138329 编写于 作者: K Kees Cook

selftests/seccomp: powerpc: Fix seccomp return value testing

On powerpc, the errno is not inverted, and depends on ccr.so being
set. Add this to a powerpc definition of SYSCALL_RET_SET().
Co-developed-by: NThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: NThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Link: https://lore.kernel.org/linux-kselftest/20200911181012.171027-1-cascardo@canonical.com/
Fixes: 5d83c2b3 ("selftests/seccomp: Add powerpc support")
Signed-off-by: NKees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/lkml/20200912110820.597135-13-keescook@chromium.orgReviewed-by: NMichael Ellerman <mpe@ellerman.id.au>
上级 f04cf78b
......@@ -1750,6 +1750,21 @@ TEST_F(TRACE_poke, getpid_runs_normally)
# define ARCH_REGS struct pt_regs
# define SYSCALL_NUM(_regs) (_regs).gpr[0]
# define SYSCALL_RET(_regs) (_regs).gpr[3]
# define SYSCALL_RET_SET(_regs, _val) \
do { \
typeof(_val) _result = (_val); \
/* \
* A syscall error is signaled by CR0 SO bit \
* and the code is stored as a positive value. \
*/ \
if (_result < 0) { \
SYSCALL_RET(_regs) = -result; \
(_regs).ccr |= 0x10000000; \
} else { \
SYSCALL_RET(_regs) = result; \
(_regs).ccr &= ~0x10000000; \
} \
} while (0)
#elif defined(__s390__)
# define ARCH_REGS s390_regs
# define SYSCALL_NUM(_regs) (_regs).gprs[2]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册