From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id EDDA5C433F5 for ; Tue, 12 Apr 2022 17:18:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4411E6B0072; Tue, 12 Apr 2022 13:18:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3CA386B0073; Tue, 12 Apr 2022 13:18:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 243C46B0074; Tue, 12 Apr 2022 13:18:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.28]) by kanga.kvack.org (Postfix) with ESMTP id 137706B0072 for ; Tue, 12 Apr 2022 13:18:03 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id D665582160 for ; Tue, 12 Apr 2022 17:18:02 +0000 (UTC) X-FDA: 79348884804.10.6D8519B Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf17.hostedemail.com (Postfix) with ESMTP id 5592140003 for ; Tue, 12 Apr 2022 17:18:02 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9EBE71424; Tue, 12 Apr 2022 10:18:01 -0700 (PDT) Received: from [10.1.196.40] (e121345-lin.cambridge.arm.com [10.1.196.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 86DC33F5A1; Tue, 12 Apr 2022 10:17:59 -0700 (PDT) Message-ID: <306b1b09-487a-9ccd-4a63-8c78889492c6@arm.com> Date: Tue, 12 Apr 2022 18:17:58 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [RFC PATCH -next V3 4/6] arm64: add copy_{to, from}_user to machine check safe Content-Language: en-GB From: Robin Murphy To: Tong Tiangen , Mark Rutland , James Morse , Andrew Morton , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Catalin Marinas , Will Deacon , Alexander Viro , x86@kernel.org, "H . Peter Anvin" Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Kefeng Wang , Xie XiuQi References: <20220412072552.2526871-1-tongtiangen@huawei.com> <20220412072552.2526871-5-tongtiangen@huawei.com> <38c6d4b5-a3db-5c3e-02e7-39875edb3476@arm.com> In-Reply-To: <38c6d4b5-a3db-5c3e-02e7-39875edb3476@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 5592140003 X-Stat-Signature: fbdjh1q5pngzc3omm9xr5ufjiqx8cs4m X-Rspam-User: Authentication-Results: imf17.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf17.hostedemail.com: domain of robin.murphy@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=robin.murphy@arm.com X-HE-Tag: 1649783882-100685 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 12/04/2022 6:08 pm, Robin Murphy wrote: [...] >> @@ -62,7 +63,11 @@ SYM_FUNC_START(__arch_copy_from_user) >>       ret >>       // Exception fixups >> -9997:    cmp    dst, dstin >> +9997:    mrs esr, esr_el1            // Check exception first >> +    and esr, esr, #ESR_ELx_FSC >> +    cmp esr, #ESR_ELx_FSC_EXTABT > > Should we be checking EC to make sure it's a data abort - and thus FSC > is valid - in the first place? I'm a little fuzzy on all the possible > paths into fixup_exception(), and it's not entirely obvious whether this > is actually safe or not. In fact, thinking some more about that, I don't think there should be any need for this sort of logic in these handlers at all. The fixup_exception() machinery should already know enough about the exception that's happened and the extable entry to figure this out and not bother calling the handler at all. Thanks, Robin.