diff options
author | Alexei Starovoitov <ast@kernel.org> | 2020-08-27 15:01:10 -0700 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2020-08-28 21:20:32 +0200 |
commit | 76cd61739fd107a7f7ec4c24a045e98d8ee150f0 (patch) | |
tree | 62d8464d469978b7a64b29164b877194075fd68e /mm/page_alloc.c | |
parent | d557ea39a5f894630c403b78703ac92b08b7dd62 (diff) | |
download | linux-stable-76cd61739fd107a7f7ec4c24a045e98d8ee150f0.tar.gz linux-stable-76cd61739fd107a7f7ec4c24a045e98d8ee150f0.tar.bz2 linux-stable-76cd61739fd107a7f7ec4c24a045e98d8ee150f0.zip |
mm/error_inject: Fix allow_error_inject function signatures.
'static' and 'static noinline' function attributes make no guarantees that
gcc/clang won't optimize them. The compiler may decide to inline 'static'
function and in such case ALLOW_ERROR_INJECT becomes meaningless. The compiler
could have inlined __add_to_page_cache_locked() in one callsite and didn't
inline in another. In such case injecting errors into it would cause
unpredictable behavior. It's worse with 'static noinline' which won't be
inlined, but it still can be optimized. Like the compiler may decide to remove
one argument or constant propagate the value depending on the callsite.
To avoid such issues make sure that these functions are global noinline.
Fixes: af3b854492f3 ("mm/page_alloc.c: allow error injection")
Fixes: cfcbfb1382db ("mm/filemap.c: enable error injection at add_to_page_cache()")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Link: https://lore.kernel.org/bpf/20200827220114.69225-2-alexei.starovoitov@gmail.com
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r-- | mm/page_alloc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 0e2bab486fea..cd8d8f0326fc 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3477,7 +3477,7 @@ static inline bool __should_fail_alloc_page(gfp_t gfp_mask, unsigned int order) #endif /* CONFIG_FAIL_PAGE_ALLOC */ -static noinline bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order) +noinline bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order) { return __should_fail_alloc_page(gfp_mask, order); } |