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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 785D3C433EF for ; Tue, 12 Apr 2022 17:18:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358066AbiDLRUW (ORCPT ); Tue, 12 Apr 2022 13:20:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243106AbiDLRUU (ORCPT ); Tue, 12 Apr 2022 13:20:20 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0598051E70 for ; Tue, 12 Apr 2022 10:18:01 -0700 (PDT) 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.