Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e4da89d0 authored by Will Drewry's avatar Will Drewry Committed by James Morris
Browse files

seccomp: ignore secure_computing return values

This change is inspired by
  https://lkml.org/lkml/2012/4/16/14


which fixes the build warnings for arches that don't support
CONFIG_HAVE_ARCH_SECCOMP_FILTER.

In particular, there is no requirement for the return value of
secure_computing() to be checked unless the architecture supports
seccomp filter.  Instead of silencing the warnings with (void)
a new static inline is added to encode the expected behavior
in a compiler and human friendly way.

v2: - cleans things up with a static inline
    - removes sfr's signed-off-by since it is a different approach
v1: - matches sfr's original change

Reported-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: default avatarWill Drewry <wad@chromium.org>
Acked-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarJames Morris <james.l.morris@oracle.com>
parent b1fa650c
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -136,7 +136,7 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
{
{
	long ret = 0;
	long ret = 0;


	secure_computing(regs->r12);
	secure_computing_strict(regs->r12);


	if (test_thread_flag(TIF_SYSCALL_TRACE) &&
	if (test_thread_flag(TIF_SYSCALL_TRACE) &&
	    tracehook_report_syscall_entry(regs))
	    tracehook_report_syscall_entry(regs))
+1 −1
Original line number Original line Diff line number Diff line
@@ -535,7 +535,7 @@ static inline int audit_arch(void)
asmlinkage void syscall_trace_enter(struct pt_regs *regs)
asmlinkage void syscall_trace_enter(struct pt_regs *regs)
{
{
	/* do the secure computing check first */
	/* do the secure computing check first */
	secure_computing(regs->regs[2]);
	secure_computing_strict(regs->regs[2]);


	if (!(current->ptrace & PT_PTRACED))
	if (!(current->ptrace & PT_PTRACED))
		goto out;
		goto out;
+1 −1
Original line number Original line Diff line number Diff line
@@ -1710,7 +1710,7 @@ long do_syscall_trace_enter(struct pt_regs *regs)
{
{
	long ret = 0;
	long ret = 0;


	secure_computing(regs->gpr[0]);
	secure_computing_strict(regs->gpr[0]);


	if (test_thread_flag(TIF_SYSCALL_TRACE) &&
	if (test_thread_flag(TIF_SYSCALL_TRACE) &&
	    tracehook_report_syscall_entry(regs))
	    tracehook_report_syscall_entry(regs))
+1 −1
Original line number Original line Diff line number Diff line
@@ -719,7 +719,7 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
	long ret = 0;
	long ret = 0;


	/* Do the secure computing check first. */
	/* Do the secure computing check first. */
	secure_computing(regs->gprs[2]);
	secure_computing_strict(regs->gprs[2]);


	/*
	/*
	 * The sysc_tracesys code in entry.S stored the system
	 * The sysc_tracesys code in entry.S stored the system
+1 −1
Original line number Original line Diff line number Diff line
@@ -503,7 +503,7 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
{
{
	long ret = 0;
	long ret = 0;


	secure_computing(regs->regs[0]);
	secure_computing_strict(regs->regs[0]);


	if (test_thread_flag(TIF_SYSCALL_TRACE) &&
	if (test_thread_flag(TIF_SYSCALL_TRACE) &&
	    tracehook_report_syscall_entry(regs))
	    tracehook_report_syscall_entry(regs))
Loading