Received: by 2002:a05:6a10:144:0:0:0:0 with SMTP id 4csp741728pxw; Fri, 8 Apr 2022 22:02:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxo3p5TXJGk9xJsBqGngb76mrfcMs6NhRMRuVdjnrDBWxGNOF7bu0hsB0R9XW/a3Tm7GBQr X-Received: by 2002:a17:907:9803:b0:6db:ab21:738e with SMTP id ji3-20020a170907980300b006dbab21738emr20573963ejc.112.1649480577951; Fri, 08 Apr 2022 22:02:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649480577; cv=none; d=google.com; s=arc-20160816; b=vNQ+y/r9sw9yd30VXQq8y6AuACktQ+/Fu/aog2gtpBDZirDW8+CAa9PC+wxGD3rNGi vCi317+VdMxiOH/dT54UwEeiNQbqv/NLBXB+sVCeKavk8McgfU1Jb3loaxdkBYzPi3mb ThwZzrCLuUyXCgGK7inQWbsYlRd430TApzuz1HkyrErVM14z2fsjglsyNRdKoWyY2wkP ngmZajee8oxyZuFuLOQza307/TZqjXM8VH7yHfoaM7hNzzeXJDJeHwY0AnpHL6d1o9hw Y9ad5zQ8iQC5jvggFGh0cs7LsU9AbIV+fjTN0pRnX0P+W2D4ZvIaWuz00jxLtzoIxPYb LRCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Cd4Er4QGOnlgfl0T1NdE8qO/474wF04oxmZyjkj+38U=; b=KVFacV6PlEiu1qdI9kUd/r4keV8Gu/fld/v3O7meUOpTar0UsCXuXokIEjErma+9X3 I/C68FVO2XOXijcZNGB8zg0XXeDixc+6wLCAfd2wle/mAeuX2QBLAnaGUn00WOGjdP/d AL3ofzZkaZroEWLqazzTvp5hdW2CPmx6IwnxpVOjGQlX7YzrnUdkcdi4TtFxorvQzto8 6mS3rtFpWznClVbY+pL6NbIXoLIuUPSf6G2wqf5ad8GcfTVJmFSNEHhLl6r+RbWSDUqS R/eU6piovAuEjFWq/DDX58IKvZ6LGVfS+75N6bJuN30PcGiNlupMOmnn1v8oRSx+qLF6 g9ww== 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:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w9-20020a056402070900b00418ea88c05asi2019118edx.380.2022.04.08.22.02.33; Fri, 08 Apr 2022 22:02:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237507AbiDHPYd (ORCPT + 99 others); Fri, 8 Apr 2022 11:24:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229993AbiDHPYa (ORCPT ); Fri, 8 Apr 2022 11:24:30 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0335F108753 for ; Fri, 8 Apr 2022 08:22:26 -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 9D875113E; Fri, 8 Apr 2022 08:22:26 -0700 (PDT) Received: from lakrids (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D62393F73B; Fri, 8 Apr 2022 08:22:24 -0700 (PDT) Date: Fri, 8 Apr 2022 16:22:22 +0100 From: Mark Rutland To: Tong Tiangen Cc: Andrew Morton , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Catalin Marinas , Will Deacon , Alexander Viro , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [RFC PATCH -next V2 5/7] arm64: add get_user to machine check safe Message-ID: References: <20220406091311.3354723-1-tongtiangen@huawei.com> <20220406091311.3354723-6-tongtiangen@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Thu, Apr 07, 2022 at 10:38:04PM +0800, Tong Tiangen wrote: > 在 2022/4/6 19:22, Mark Rutland 写道: > > On Wed, Apr 06, 2022 at 09:13:09AM +0000, Tong Tiangen wrote: > > > Add scenarios get_user to machine check safe. The processing of > > > EX_TYPE_UACCESS_ERR_ZERO and EX_TYPE_UACCESS_ERR_ZERO_UCE_RECOVERY is same > > > and both return -EFAULT. > > > > Which uaccess cases do we expect to *not* be recoverable? > > > > Naively I would assume that if we're going to treat a memory error on a uaccess > > as fatal to userspace we should be able to do that for *any* uacesses. > > > > The commit message should explain why we need the distinction between a > > recoverable uaccess and a non-recoverable uaccess. > > > > Thanks, > > Mark. > > Currently, any memory error consumed in kernel mode will lead to panic > (do_sea()). > > My idea is that not all memory errors consumed in kernel mode are fatal, > such as copy_ from_ user/get_ user is a memory error consumed when > reading user data in the process context. In this case, we can not let the > kernel panic, just kill the process without affecting the operation > of the system. I understood this part. > However, not all uaccess can be recovered without affecting the normal > operation of the system. The key is not whether it is uaccess, but whether > there are key data affecting the normal operation of the system in the read > page. Ok. Can you give an example of such a case where the a uaccess that hits a memory error must be fatal? I think you might be trying to say that for copy_{to,from}_user() we can make that judgement, but those are combined user+kernel access primitives, and the *uaccess* part should never be reading from a page with "key data affecting the normal operation of the system", since that's userspace memory. Is there any *userspace access* (e.g. where we use LDTR/STTR today) where we must treat a memory error as fatal to the system? Thanks, Mark.