Skip to content

Commit

Permalink
entry: Fix boot for !CONFIG_GENERIC_ENTRY
Browse files Browse the repository at this point in the history
A copy-pasta mistake tries to set SYSCALL_WORK flags instead of TIF
flags for !CONFIG_GENERIC_ENTRY.  Also, add safeguards to catch this at
compilation time.

Fixes: 3136b93 ("entry: Expose helpers to migrate TIF to SYSCALL_WORK flags")
Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Suggested-by: Jann Horn <jannh@google.com>
Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/87a6v8qd9p.fsf_-_@collabora.com
  • Loading branch information
Gabriel Krisman Bertazi authored and Thomas Gleixner committed Nov 25, 2020
1 parent d1f250e commit 5903f61
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions include/linux/thread_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ enum {
GOOD_STACK,
};

#ifdef CONFIG_GENERIC_ENTRY
enum syscall_work_bit {
SYSCALL_WORK_BIT_SECCOMP,
SYSCALL_WORK_BIT_SYSCALL_TRACEPOINT,
Expand All @@ -48,6 +49,7 @@ enum syscall_work_bit {
#define SYSCALL_WORK_SYSCALL_TRACE BIT(SYSCALL_WORK_BIT_SYSCALL_TRACE)
#define SYSCALL_WORK_SYSCALL_EMU BIT(SYSCALL_WORK_BIT_SYSCALL_EMU)
#define SYSCALL_WORK_SYSCALL_AUDIT BIT(SYSCALL_WORK_BIT_SYSCALL_AUDIT)
#endif

#include <asm/thread_info.h>

Expand Down Expand Up @@ -129,11 +131,11 @@ static inline int test_ti_thread_flag(struct thread_info *ti, int flag)
#else /* CONFIG_GENERIC_ENTRY */

#define set_syscall_work(fl) \
set_ti_thread_flag(current_thread_info(), SYSCALL_WORK_##fl)
set_ti_thread_flag(current_thread_info(), TIF_##fl)
#define test_syscall_work(fl) \
test_ti_thread_flag(current_thread_info(), SYSCALL_WORK_##fl)
test_ti_thread_flag(current_thread_info(), TIF_##fl)
#define clear_syscall_work(fl) \
clear_ti_thread_flag(current_thread_info(), SYSCALL_WORK_##fl)
clear_ti_thread_flag(current_thread_info(), TIF_##fl)

#define set_task_syscall_work(t, fl) \
set_ti_thread_flag(task_thread_info(t), TIF_##fl)
Expand Down

0 comments on commit 5903f61

Please sign in to comment.