diff options
author | Will Drewry <wad@chromium.org> | 2012-04-17 15:48:57 -0400 |
---|---|---|
committer | James Morris <james.l.morris@oracle.com> | 2012-04-17 22:24:50 -0400 |
commit | e4da89d02f369450996cfd04f64b1cce4d8afaea (patch) | |
tree | 93d5e48347bb6c47ef10741d225969cacd57f77e /include/linux/seccomp.h | |
parent | b1fa650c7e6e81ca788fef52b1659295eb82ffdd (diff) |
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: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Will Drewry <wad@chromium.org>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: James Morris <james.l.morris@oracle.com>
Diffstat (limited to 'include/linux/seccomp.h')
-rw-r--r-- | include/linux/seccomp.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/seccomp.h b/include/linux/seccomp.h index 60f2b350ead7..84f6320da50f 100644 --- a/include/linux/seccomp.h +++ b/include/linux/seccomp.h | |||
@@ -75,6 +75,12 @@ static inline int secure_computing(int this_syscall) | |||
75 | return 0; | 75 | return 0; |
76 | } | 76 | } |
77 | 77 | ||
78 | /* A wrapper for architectures supporting only SECCOMP_MODE_STRICT. */ | ||
79 | static inline void secure_computing_strict(int this_syscall) | ||
80 | { | ||
81 | BUG_ON(secure_computing(this_syscall) != 0); | ||
82 | } | ||
83 | |||
78 | extern long prctl_get_seccomp(void); | 84 | extern long prctl_get_seccomp(void); |
79 | extern long prctl_set_seccomp(unsigned long, char __user *); | 85 | extern long prctl_set_seccomp(unsigned long, char __user *); |
80 | 86 | ||
@@ -91,6 +97,7 @@ struct seccomp { }; | |||
91 | struct seccomp_filter { }; | 97 | struct seccomp_filter { }; |
92 | 98 | ||
93 | static inline int secure_computing(int this_syscall) { return 0; } | 99 | static inline int secure_computing(int this_syscall) { return 0; } |
100 | static inline void secure_computing_strict(int this_syscall) { return; } | ||
94 | 101 | ||
95 | static inline long prctl_get_seccomp(void) | 102 | static inline long prctl_get_seccomp(void) |
96 | { | 103 | { |