Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20120406141936.25d68860.akpm@linux-foundation.org>
Date: Fri, 6 Apr 2012 14:19:36 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Will Drewry <wad@...omium.org>
Cc: linux-kernel@...r.kernel.org, linux-security-module@...r.kernel.org,
 linux-arch@...r.kernel.org, linux-doc@...r.kernel.org,
 kernel-hardening@...ts.openwall.com, netdev@...r.kernel.org,
 x86@...nel.org, arnd@...db.de, davem@...emloft.net, hpa@...or.com,
 mingo@...hat.com, oleg@...hat.com, peterz@...radead.org,
 rdunlap@...otime.net, mcgrathr@...omium.org, tglx@...utronix.de,
 luto@....edu, eparis@...hat.com, serge.hallyn@...onical.com,
 djm@...drot.org, scarybeasts@...il.com, indan@....nu, pmoore@...hat.com,
 corbet@....net, eric.dumazet@...il.com, markus@...omium.org,
 coreyb@...ux.vnet.ibm.com, keescook@...omium.org, jmorris@...ei.org
Subject: Re: [PATCH v17 10/15] seccomp: add SECCOMP_RET_ERRNO

On Thu, 29 Mar 2012 15:01:55 -0500
Will Drewry <wad@...omium.org> wrote:

> This change adds the SECCOMP_RET_ERRNO as a valid return value from a
> seccomp filter.  Additionally, it makes the first use of the lower
> 16-bits for storing a filter-supplied errno.  16-bits is more than
> enough for the errno-base.h calls.
> 
> Returning errors instead of immediately terminating processes that
> violate seccomp policy allow for broader use of this functionality
> for kernel attack surface reduction.  For example, a linux container
> could maintain a whitelist of pre-existing system calls but drop
> all new ones with errnos.  This would keep a logically static attack
> surface while providing errnos that may allow for graceful failure
> without the downside of do_exit() on a bad call.
> 
>
> ...
>
> @@ -64,11 +65,17 @@ struct seccomp {
>  	struct seccomp_filter *filter;
>  };
>  
> -extern void __secure_computing(int);
> -static inline void secure_computing(int this_syscall)
> +/*
> + * Direct callers to __secure_computing should be updated as
> + * CONFIG_HAVE_ARCH_SECCOMP_FILTER propagates.

Are there any such callers?  There's one I see in arm, but it's called
from assembly code.

> + */
> +extern void __secure_computing(int) __deprecated;
> +extern int __secure_computing_int(int);
> +static inline int secure_computing(int this_syscall)
>  {
>  	if (unlikely(test_thread_flag(TIF_SECCOMP)))
> -		__secure_computing(this_syscall);
> +		return  __secure_computing_int(this_syscall);
> +	return 0;
>  }
>  
> ...
>
>  void __secure_computing(int this_syscall)
>  {
> +	/* Filter calls should never use this function. */
> +	BUG_ON(current->seccomp.mode == SECCOMP_MODE_FILTER);
> +	__secure_computing_int(this_syscall);
> +}
> +
> +int __secure_computing_int(int this_syscall)

What the heck does "_int" mean here?  I read it as "integer" but
perhaps it's shorthand for "internal".  Give us a better name, please. 
Or a code comment.

> +{
>  	int mode = current->seccomp.mode;
>  	int exit_sig = 0;
>  	int *syscall;
> +	u32 ret = SECCOMP_RET_KILL;
> +	int data;
>  
>  	switch (mode) {
>  	case SECCOMP_MODE_STRICT:

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.