Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp22807pxb; Tue, 12 Apr 2022 15:42:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXOEDRZ8i2GL9J90eVea0nPI3eAi55asL4phrUUy9Pl6O8yhTT6k3mdmECEDXmq9XxWcQW X-Received: by 2002:a05:6a00:14ca:b0:4fb:5d3e:5f77 with SMTP id w10-20020a056a0014ca00b004fb5d3e5f77mr40160816pfu.34.1649803322691; Tue, 12 Apr 2022 15:42:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649803322; cv=none; d=google.com; s=arc-20160816; b=nzK5DZAnt22ZaHWaQArIJ5/pAz76HjrYhR0SijjXCmS7w4jR0J024jDFnTM2KPv5R/ VIkd6xwlQxHIVbfJDTcEVMek4NMbdpJRNdGPEkW9prYD7eFY8K/EE0EJ8RDT2WwztjBZ ZK/RKIde1hyPCcGBtGFzomZMi2xBuxSRX/dmxQiGjyCwuipzDhIZcKFn0TNDNAbhIF8D DIJKCtkOaSwl9q4xjDr/XLDhVl9HNLaQemKi62aH9iaxpcMEGeaultSP/LeeeBu5rqDI O+nxfch1Y1p0s606dHQXoCbdnhdJ45khGvtq6yOVOrRGyeZhaTGLFk9h60QxKGuyBlJT A2bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id; bh=HBQ27tShggX4A9cvHmTG+cruMNJXQLAfcdtYjy/Aqos=; b=BCv8lqyIN0C+X655oVFS3xBFV4ADT6MY+yDGioE69dC4F6eonduHP/1Iw9OfL3LYWZ b3A0xD/cu5/aXxPxfzWgCkrhvAwYNhDILuIQugyOpEc02PjNaCYwy5HNK5y6q9wqt7l+ wXdmXMiFW/0Iv7VEYYgV3BoOKtJ2urTx9dqUu7mvLfzJKtka0NxX/L5uiTg3ZKIACgdd M9K2L3IhUfTqy8gia6D8Rmy7Jl6Sg/gGt3sYonc86gG0Q3sInI0rXozub7Iw2k+NooZR Wm6LdGk/yj8or/XnbqCLeF80Kd3XkEIufuCLROiyGTWKESa746lRafhjFFV9las6d8CX cSAw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id w10-20020a63d74a000000b0039d3f493fb0si3805606pgi.851.2022.04.12.15.42.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 15:42:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 900F010E06D; Tue, 12 Apr 2022 14:21:00 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355770AbiDLRUV (ORCPT + 99 others); Tue, 12 Apr 2022 13:20:21 -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 X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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.