diff options
author | Emese Revfy <re.emese@gmail.com> | 2016-07-26 22:41:43 +0200 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2017-02-16 16:22:22 -0800 |
commit | 6bbaac1165529625b0f87dfab34240062121299a (patch) | |
tree | a99f9a49bd5babe7724adb436c6efc9f46f22c8e /include/asm-generic | |
parent | 81488a6e07a4791ffc414ecfa9fdfc52099e5d94 (diff) |
initify: Mark functions with the __nocapture attribute
The nocapture gcc attribute can be on functions only. The attribute
takes zero or more signed integer constants as parameters that specify
the function parameters to initify when the passed arguments are of const
char* type.
A negative attribute parameter value means that the corresponding function
parameter is returned by the function and the passed argument will only
be initified if the data flow of the returned value is not captured in
the caller.
If no values are passed to the attribute then all function parameters are
treated as nocapture.
If the marked parameter is a vararg then the plugin initifies all vararg
arguments.
Signed-off-by: Emese Revfy <re.emese@gmail.com>
[kees: updated markings, thanks to Arnd]
Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'include/asm-generic')
-rw-r--r-- | include/asm-generic/asm-prototypes.h | 8 | ||||
-rw-r--r-- | include/asm-generic/bug.h | 7 |
2 files changed, 8 insertions, 7 deletions
diff --git a/include/asm-generic/asm-prototypes.h b/include/asm-generic/asm-prototypes.h index df13637e4017..ea784e02b28e 100644 --- a/include/asm-generic/asm-prototypes.h +++ b/include/asm-generic/asm-prototypes.h @@ -1,7 +1,7 @@ #include <linux/bitops.h> extern void *__memset(void *, int, __kernel_size_t); -extern void *__memcpy(void *, const void *, __kernel_size_t); -extern void *__memmove(void *, const void *, __kernel_size_t); +extern void *__memcpy(void *, const void *, __kernel_size_t) __nocapture(2); +extern void *__memmove(void *, const void *, __kernel_size_t) __nocapture(2); extern void *memset(void *, int, __kernel_size_t); -extern void *memcpy(void *, const void *, __kernel_size_t); -extern void *memmove(void *, const void *, __kernel_size_t); +extern void *memcpy(void *, const void *, __kernel_size_t) __nocapture(2); +extern void *memmove(void *, const void *, __kernel_size_t) __nocapture(2); diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h index 6f96247226a4..f6ae0d76f2e7 100644 --- a/include/asm-generic/bug.h +++ b/include/asm-generic/bug.h @@ -62,13 +62,13 @@ struct bug_entry { * to provide better diagnostics. */ #ifndef __WARN_TAINT -extern __printf(3, 4) +extern __printf(3, 4) __nocapture(1) void warn_slowpath_fmt(const char *file, const int line, const char *fmt, ...); -extern __printf(4, 5) +extern __printf(4, 5) __nocapture(1) void warn_slowpath_fmt_taint(const char *file, const int line, unsigned taint, const char *fmt, ...); -extern void warn_slowpath_null(const char *file, const int line); +extern __nocapture(1) void warn_slowpath_null(const char *file, const int line); #define WANT_WARN_ON_SLOWPATH #define __WARN() warn_slowpath_null(__FILE__, __LINE__) #define __WARN_printf(arg...) warn_slowpath_fmt(__FILE__, __LINE__, arg) @@ -84,6 +84,7 @@ extern void warn_slowpath_null(const char *file, const int line); /* used internally by panic.c */ struct warn_args; +__nocapture(1, 0) void __warn(const char *file, int line, void *caller, unsigned taint, struct pt_regs *regs, struct warn_args *args); |