[PATCH 3/3] sched/wait: avoid double initialization in ___wait_event()
glider at google.com
glider at google.com
Mon Feb 24 15:35:01 UTC 2020
With CONFIG_INIT_STACK_ALL enabled, the local __wq_entry is initialized
twice. Because Clang is currently unable to optimize the automatic
initialization away (init_wait_entry() is defined in another translation
unit), remove it with the __do_not_initialize annotation.
Cc: Kees Cook <keescook at chromium.org>
Cc: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
Signed-off-by: Alexander Potapenko <glider at google.com>
---
include/linux/wait.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 3283c8d021377..03b831ee9b64a 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -262,7 +262,8 @@ extern void init_wait_entry(struct wait_queue_entry *wq_entry, int flags);
#define ___wait_event(wq_head, condition, state, exclusive, ret, cmd) \
({ \
__label__ __out; \
- struct wait_queue_entry __wq_entry; \
+ /* Unconditionally initialized by init_wait_entry(). */ \
+ struct wait_queue_entry __wq_entry __do_not_initialize; \
long __ret = ret; /* explicit shadow */ \
\
init_wait_entry(&__wq_entry, exclusive ? WQ_FLAG_EXCLUSIVE : 0); \
--
2.25.0.265.gbab2e86ba0-goog
More information about the devel
mailing list