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 6BA17C433EF for ; Wed, 4 May 2022 10:26:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EB4AD6B0074; Wed, 4 May 2022 06:26:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E64036B0075; Wed, 4 May 2022 06:26:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D2C046B0078; Wed, 4 May 2022 06:26:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id C02666B0074 for ; Wed, 4 May 2022 06:26:51 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 9633C2AF47 for ; Wed, 4 May 2022 10:26:51 +0000 (UTC) X-FDA: 79427682222.11.6903044 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf07.hostedemail.com (Postfix) with ESMTP id E504440082 for ; Wed, 4 May 2022 10:26:46 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1DA4AB8253E; Wed, 4 May 2022 10:26:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 10C3EC385A4; Wed, 4 May 2022 10:26:43 +0000 (UTC) Date: Wed, 4 May 2022 11:26:40 +0100 From: Catalin Marinas To: Tong Tiangen Cc: Mark Rutland , James Morse , Andrew Morton , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Robin Murphy , Dave Hansen , Will Deacon , Alexander Viro , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , x86@kernel.org, "H . Peter Anvin" , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Kefeng Wang , Xie XiuQi , Guohanjun Subject: Re: [PATCH -next v4 4/7] arm64: add copy_{to, from}_user to machine check safe Message-ID: References: <20220420030418.3189040-1-tongtiangen@huawei.com> <20220420030418.3189040-5-tongtiangen@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220420030418.3189040-5-tongtiangen@huawei.com> X-Stat-Signature: 1ttqmdg1x8nati4we11jg1n6yswr99pg X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: E504440082 Authentication-Results: imf07.hostedemail.com; dkim=none; spf=pass (imf07.hostedemail.com: domain of cmarinas@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=cmarinas@kernel.org; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none) X-Rspam-User: X-HE-Tag: 1651660006-865222 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 Wed, Apr 20, 2022 at 03:04:15AM +0000, Tong Tiangen wrote: > Add copy_{to, from}_user() to machine check safe. > > If copy fail due to hardware memory error, only the relevant processes are > affected, so killing the user process and isolate the user page with > hardware memory errors is a more reasonable choice than kernel panic. Just to make sure I understand - we can only recover if the fault is in a user page. That is, for a copy_from_user(), we can only handle the faults in the source address, not the destination. > diff --git a/arch/arm64/lib/copy_from_user.S b/arch/arm64/lib/copy_from_user.S > index 34e317907524..480cc5ac0a8d 100644 > --- a/arch/arm64/lib/copy_from_user.S > +++ b/arch/arm64/lib/copy_from_user.S > @@ -25,7 +25,7 @@ > .endm > > .macro strb1 reg, ptr, val > - strb \reg, [\ptr], \val > + USER_MC(9998f, strb \reg, [\ptr], \val) > .endm So if I got the above correctly, why do we need an exception table entry for the store to the kernel address? -- Catalin