public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: Gabriel Krisman Bertazi <krisman@collabora•com>
To: Jann Horn <jannh@google•com>
Cc: Sumit Semwal <sumit.semwal@linaro•org>,
	Arnd Bergmann <arnd@kernel•org>, Song Liu <songliubraving@fb•com>,
	Kees Cook <keescook@chromium•org>,
	Daniel Borkmann <daniel@iogearbox•net>,
	YiFei Zhu <yifeifz2@illinois•edu>,
	Netdev <netdev@vger•kernel.org>,
	Naresh Kamboju <naresh.kamboju@linaro•org>,
	open list <linux-kernel@vger•kernel.org>,
	lkft-triage@lists•linaro.org,
	Andy Lutomirski <luto@amacapital•net>,
	Arnd Bergmann <arnd@arndb•de>, Andy Lutomirski <luto@kernel•org>,
	Yonghong Song <yhs@fb•com>, Thomas Gleixner <tglx@linutronix•de>,
	Andrii Nakryiko <andriin@fb•com>, bpf <bpf@vger•kernel.org>,
	Linux ARM <linux-arm-kernel@lists•infradead.org>
Subject: [PATCH] entry: Fix boot for !CONFIG_GENERIC_ENTRY
Date: Mon, 23 Nov 2020 10:54:58 -0500	[thread overview]
Message-ID: <87a6v8qd9p.fsf_-_@collabora.com> (raw)
In-Reply-To: <87h7pgqhdf.fsf@collabora.com> (Gabriel Krisman Bertazi's message of "Mon, 23 Nov 2020 09:26:20 -0500")

Gabriel Krisman Bertazi <krisman@collabora•com> writes:

> Jann Horn <jannh@google•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@linaro•org>
Suggested-by: Jann Horn <jannh@google•com>
Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora•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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists•infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-11-23 15:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-23 11:15 [arm64] kernel BUG at kernel/seccomp.c:1309! Naresh Kamboju
2020-11-23 13:45 ` Arnd Bergmann
2020-11-23 14:02   ` Jann Horn
2020-11-23 14:26     ` Gabriel Krisman Bertazi
2020-11-23 15:54       ` Gabriel Krisman Bertazi [this message]
2020-11-24 21:45         ` [PATCH] entry: Fix boot for !CONFIG_GENERIC_ENTRY Kees Cook
2020-11-25  3:36           ` Naresh Kamboju

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a6v8qd9p.fsf_-_@collabora.com \
    --to=krisman@collabora$(echo .)com \
    --cc=andriin@fb$(echo .)com \
    --cc=arnd@arndb$(echo .)de \
    --cc=arnd@kernel$(echo .)org \
    --cc=bpf@vger$(echo .)kernel.org \
    --cc=daniel@iogearbox$(echo .)net \
    --cc=jannh@google$(echo .)com \
    --cc=keescook@chromium$(echo .)org \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=lkft-triage@lists$(echo .)linaro.org \
    --cc=luto@amacapital$(echo .)net \
    --cc=luto@kernel$(echo .)org \
    --cc=naresh.kamboju@linaro$(echo .)org \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=songliubraving@fb$(echo .)com \
    --cc=sumit.semwal@linaro$(echo .)org \
    --cc=tglx@linutronix$(echo .)de \
    --cc=yhs@fb$(echo .)com \
    --cc=yifeifz2@illinois$(echo .)edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox