Received: by 2002:a05:6a10:87d6:0:0:0:0 with SMTP id g22csp334400pxr; Sun, 10 Apr 2022 16:36:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx30YHsa+JT2L87AkqEkWs0hiDx82gH5i8sXMI2sBVjvXigeWp9drmPE8GHeHQXBB9W3A2a X-Received: by 2002:a05:6a00:894:b0:4fe:25d7:f59e with SMTP id q20-20020a056a00089400b004fe25d7f59emr30531162pfj.58.1649633815475; Sun, 10 Apr 2022 16:36:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649633815; cv=none; d=google.com; s=arc-20160816; b=unhsnvlH2f50Tvvm4unULCb5jWZU0oJ31GkLZ6stkAXqEfJvcZH4ZSS5iwkWq16mf0 /FmfZlYdTzZBaqz3mvgw7ZCNWd1vnrkLyAiOj63bXB4UooiSK7oyyuBxROOn3e5riXek 15v8TI4TPMNqhB1ZEISswhhzCRSbZPvrJFHCiizqP+D5VkxbgD9scupPHsXFHBa8ORrN NgDTvkXq4hUFu9b2et8mVVOboQm754hWZWyPUZ59pO+bZnu7YIvPUhxGlBbkO1xHx+qP csJqlCHRD5dydBu3aH9mDMeVVFO9nufz/7Uf5PQyJVU/JZtU8+tl0kT+3GhxGhNdWFLf 1oPA== 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:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=/Q679EIBzT8wQStFHBdny1DCFpZkgNCfZBjf6cUCIVY=; b=Tua+i1RPkVFZVNPVIVQQkYwNHduF4vqzOuNTy9MnJRxGNQ8NjcnZIrceF8tKud/GMR 4RB1e0HXQgqGL8WLS2bwJvmeui3oSX1I5AC6ViQirLWPe83Jj49xUdHjgt1Is06DP1f/ 9nryEn0ZhJMHo2WAP8AJBDJwUJBtMbJbpGAWDo4ylVyTdKRXCXazVuxjkQO57wx/oZVe 19fi88LfJOxYa/PxoQyoFbBFwrpKF31hBK/aXe0viRdUZ186S7z8PV9WxuahCcXWBxBl WLE3F/5CsRTADcC7wAeuPExohbal5GHL2fAFawTbcFe5U1Prw6tnaRXpTkd5i7eFr4L+ buoA== 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w129-20020a636287000000b00382a08a885dsi7502102pgb.362.2022.04.10.16.36.41; Sun, 10 Apr 2022 16:36:55 -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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237201AbiDIJTy (ORCPT + 99 others); Sat, 9 Apr 2022 05:19:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229964AbiDIJTw (ORCPT ); Sat, 9 Apr 2022 05:19:52 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B139207C9E for ; Sat, 9 Apr 2022 02:17:45 -0700 (PDT) Received: from kwepemi100007.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Kb8dg56shzdZXd; Sat, 9 Apr 2022 17:17:11 +0800 (CST) Received: from kwepemm600017.china.huawei.com (7.193.23.234) by kwepemi100007.china.huawei.com (7.221.188.115) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Sat, 9 Apr 2022 17:17:42 +0800 Received: from [10.174.179.234] (10.174.179.234) by kwepemm600017.china.huawei.com (7.193.23.234) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Sat, 9 Apr 2022 17:17:41 +0800 Message-ID: <8ef7a71b-fd0d-f86e-98bc-0a9cffc79207@huawei.com> Date: Sat, 9 Apr 2022 17:17:40 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [RFC PATCH -next V2 5/7] arm64: add get_user to machine check safe To: Mark Rutland CC: Andrew Morton , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Catalin Marinas , Will Deacon , Alexander Viro , , "H. Peter Anvin" , , , References: <20220406091311.3354723-1-tongtiangen@huawei.com> <20220406091311.3354723-6-tongtiangen@huawei.com> From: Tong Tiangen In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.179.234] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemm600017.china.huawei.com (7.193.23.234) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,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 在 2022/4/8 23:22, Mark Rutland 写道: > 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. > . I seem to understand what you mean. Take copy_to_user()/put_user() as an example. If it encounters memory error, only related processes will be affected. According to this understanding, it seems that all uaccess can be recovered. Thanks, Tong.