[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87a6v8qd9p.fsf_-_@collabora.com>
Date: Mon, 23 Nov 2020 10:54:58 -0500
From: Gabriel Krisman Bertazi <krisman@...labora.com>
To: Jann Horn <jannh@...gle.com>
Cc: Arnd Bergmann <arnd@...nel.org>, Andy Lutomirski <luto@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Naresh Kamboju <naresh.kamboju@...aro.org>,
open list <linux-kernel@...r.kernel.org>,
Netdev <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
lkft-triage@...ts.linaro.org,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
Daniel Borkmann <daniel@...earbox.net>,
Kees Cook <keescook@...omium.org>,
Andrii Nakryiko <andriin@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
Andy Lutomirski <luto@...capital.net>,
Sumit Semwal <sumit.semwal@...aro.org>,
Arnd Bergmann <arnd@...db.de>,
YiFei Zhu <yifeifz2@...inois.edu>
Subject: [PATCH] entry: Fix boot for !CONFIG_GENERIC_ENTRY
Gabriel Krisman Bertazi <krisman@...labora.com> writes:
> Jann Horn <jannh@...gle.com> writes:
>> As part of fixing this, it might be a good idea to put "enum
>> syscall_work_bit" behind a "#ifdef CONFIG_GENERIC_ENTRY" to avoid
>> future accidents like this?
>
> Hi Jan, Arnd,
>
> That is correct. This is a copy pasta mistake. My apologies. I didn't
> have a !GENERIC_ENTRY device to test, but just the ifdef would have
> caught it.
I have patched it as suggested. Tested on qemu for arm32 and on bare
metal for x86-64.
Once again, my apologies for the mistake.
-- >8 --
Subject: [PATCH] entry: Fix boot for !CONFIG_GENERIC_ENTRY
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.
Reported-by: Naresh Kamboju <naresh.kamboju@...aro.org>
Suggested-by: Jann Horn <jannh@...gle.com>
Signed-off-by: Gabriel Krisman Bertazi <krisman@...labora.com>
---
include/linux/thread_info.h | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
index 6a597fd5d351..45ad3176e2fa 100644
--- a/include/linux/thread_info.h
+++ b/include/linux/thread_info.h
@@ -35,6 +35,7 @@ enum {
GOOD_STACK,
};
+#ifdef CONFIG_GENERIC_ENTRY
enum syscall_work_bit {
SYSCALL_WORK_BIT_SECCOMP,
SYSCALL_WORK_BIT_SYSCALL_TRACEPOINT,
@@ -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>
@@ -127,11 +129,11 @@ static inline int test_ti_thread_flag(struct thread_info *ti, int flag)
clear_bit(SYSCALL_WORK_BIT_##fl, &task_thread_info(t)->syscall_work)
#else
#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)
--
2.29.2
Powered by blists - more mailing lists