Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp945375pxu; Mon, 23 Nov 2020 07:59:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJzXW6FHLuPjLVchzmc8SS55UPH/qQUyrNmK762Db+5KQ0Em909XPLK0pjOzeTHBUc2gokRl X-Received: by 2002:a05:6402:2031:: with SMTP id ay17mr28941001edb.358.1606147193679; Mon, 23 Nov 2020 07:59:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606147193; cv=none; d=google.com; s=arc-20160816; b=dJwxp5dsVm2n/vUtLiz5ELnU1b7Np7a9oZVCS5EJAUYO5ad5jG5+selGd5ygteuNpZ ndiB+FehXbJuLfHHQZaQEkleM1XYNX2j6RxTwt/b4opb4UdvmYocUzMuVHTe5wRjmlry gFncuQMaVfkws9lSOQBuKojO7iLMb6xBTTh9qFJhyw4AysIFtiq0gkpoJo6MEPjhK8wq GTvJC7aJTgTkXqOs1H97kgcyWX0NcuWbFtgehPsxWRLvozb7hVXNoTzcnlCfWz0jxATg gt723oTZLy/ISvQO0ssRfyDn2Vuf68rZgmaIM9b6CMVPLyX+jXy91CRXKPveIiRd2Tlv aPxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:organization:subject:cc:to:from; bh=KSGgisstDZrnJl8tdaaoYnipQQsLFlzSUNH9aP363g4=; b=BV/H9gMnpBGZCGd0BzYRz9NEMyXcow611ZDjEmkjHhs2ipmZdXszwc9dbPLjOi9rnS V1yQ8cmKkgTatlodFRORTc64wOtD/sNHuoBqH7hTdKUG/sK9szWqK2sjUzDXWHGsaT3Y /2nKMKtkyAeQT+WMMUTMEvuubtAtaPW2cnszc6fGJjyPL/evcLN44sBK1xAM6p+4unay hxBfU8ob3b7DeNwG5JgTczzNO+yRxLV1mgN2WIlVxYUaG72pk0b1p6D0nNsiGnDoIxr+ C+kH2zHKE2CSwfNCdDVnEHtXpDLCccf5oa6TmlFwzFeOasq8dZQsNNWbJjVRrKtOZgIW l1nw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j20si5661664ejv.371.2020.11.23.07.59.30; Mon, 23 Nov 2020 07:59:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389692AbgKWPzV (ORCPT + 99 others); Mon, 23 Nov 2020 10:55:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389680AbgKWPzD (ORCPT ); Mon, 23 Nov 2020 10:55:03 -0500 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE22EC0613CF; Mon, 23 Nov 2020 07:55:03 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: krisman) with ESMTPSA id 05D891F44CF8 From: Gabriel Krisman Bertazi To: Jann Horn Cc: Arnd Bergmann , Andy Lutomirski , Thomas Gleixner , Naresh Kamboju , open list , Netdev , bpf , lkft-triage@lists.linaro.org, Linux ARM , Daniel Borkmann , Kees Cook , Andrii Nakryiko , Song Liu , Yonghong Song , Andy Lutomirski , Sumit Semwal , Arnd Bergmann , YiFei Zhu Subject: [PATCH] entry: Fix boot for !CONFIG_GENERIC_ENTRY Organization: Collabora References: <87h7pgqhdf.fsf@collabora.com> Date: Mon, 23 Nov 2020 10:54:58 -0500 In-Reply-To: <87h7pgqhdf.fsf@collabora.com> (Gabriel Krisman Bertazi's message of "Mon, 23 Nov 2020 09:26:20 -0500") Message-ID: <87a6v8qd9p.fsf_-_@collabora.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Gabriel Krisman Bertazi writes: > Jann Horn 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 Suggested-by: Jann Horn Signed-off-by: Gabriel Krisman Bertazi --- 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 @@ -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