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 X-Spam-Level: X-Spam-Status: No, score=-4.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_2 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9C12C433E0 for ; Thu, 11 Mar 2021 02:02:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BCAE164F81 for ; Thu, 11 Mar 2021 02:02:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BCAE164F81 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kingsoft.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 48D768D0265; Wed, 10 Mar 2021 21:02:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 43D4E8D0250; Wed, 10 Mar 2021 21:02:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2DE0E8D0265; Wed, 10 Mar 2021 21:02:00 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0087.hostedemail.com [216.40.44.87]) by kanga.kvack.org (Postfix) with ESMTP id 1411C8D0250 for ; Wed, 10 Mar 2021 21:02:00 -0500 (EST) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id CEC1C4DCD for ; Thu, 11 Mar 2021 02:01:59 +0000 (UTC) X-FDA: 77905942758.04.918AD63 Received: from mail.kingsoft.com (mail.kingsoft.com [114.255.44.145]) by imf11.hostedemail.com (Postfix) with ESMTP id 2586B2000380 for ; Thu, 11 Mar 2021 02:01:51 +0000 (UTC) X-AuditID: 0a580155-1f5ff7000005482e-22-6049728f68b2 Received: from mail.kingsoft.com (localhost [10.88.1.32]) (using TLS with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.kingsoft.com (SMG-2-NODE-85) with SMTP id 89.95.18478.F8279406; Thu, 11 Mar 2021 09:29:51 +0800 (HKT) Received: from alex-virtual-machine (172.16.253.254) by KSBJMAIL2.kingsoft.cn (10.88.1.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Thu, 11 Mar 2021 10:01:54 +0800 Date: Thu, 11 Mar 2021 10:01:54 +0800 From: Aili Yao To: Andy Lutomirski CC: "Luck, Tony" , Oleg Nesterov , Linux API , Andy Lutomirski , HORIGUCHI NAOYA , Dave Hansen , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , X86 ML , , Linux-MM , LKML , , , Subject: Re: [PATCH v3] x86/fault: Send a SIGBUS to user process always for hwpoison page access. Message-ID: <20210311100154.5a75c62e@alex-virtual-machine> In-Reply-To: References: <4fc1b4e8f1fb4c8c81f280db09178797@intel.com> <047D5B49-FDBB-494C-81E9-DA811476747D@amacapital.net> <20210311091941.45790fcf@alex-virtual-machine> Organization: kingsoft X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [172.16.253.254] X-ClientProxiedBy: KSBJMAIL1.kingsoft.cn (10.88.1.31) To KSBJMAIL2.kingsoft.cn (10.88.1.32) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrJIsWRmVeSWpSXmKPEx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d-Queue-Id: 2586B2000380 Received-SPF: none (kingsoft.com>: No applicable sender policy available) receiver=imf11; identity=mailfrom; envelope-from=""; helo=mail.kingsoft.com; client-ip=114.255.44.145 X-HE-DKIM-Result: none/none X-HE-Tag: 1615428111-55235 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, 10 Mar 2021 17:28:12 -0800 Andy Lutomirski wrote: > On Wed, Mar 10, 2021 at 5:19 PM Aili Yao wrote: > > > > On Mon, 8 Mar 2021 11:00:28 -0800 > > Andy Lutomirski wrote: > > =20 > > > > On Mar 8, 2021, at 10:31 AM, Luck, Tony wrote: > > > > > > > > =EF=BB=BF =20 > > > >> > > > >> Can you point me at that SIGBUS code in a current kernel? =20 > > > > > > > > It is in kill_me_maybe(). mce_vaddr is setup when we disassemble w= hatever get_user() > > > > or copy from user variant was in use in the kernel when the poison = memory was consumed. > > > > > > > > if (p->mce_vaddr !=3D (void __user *)-1l) { > > > > force_sig_mceerr(BUS_MCEERR_AR, p->mce_vaddr, PAGE_S= HIFT); =20 > > > > > > Hmm. On the one hand, no one has complained yet. On the other hand, h= ardware that supports this isn=E2=80=99t exactly common. > > > > > > We may need some actual ABI design here. We also need to make sure th= at things like io_uring accesses or, more generally, anything using the use= _mm / use_temporary_mm ends up either sending no signal or sending a signal= to the right target. > > > =20 > > > > > > > > Would it be any better if we used the BUS_MCEERR_AO code that goes = into siginfo? =20 > > > > > > Dunno. =20 > > > > I have one thought here but don't know if it's proper: > > > > Previous patch use force_sig_mceerr to the user process for such a scen= ario; with this method > > The SIGBUS can't be ignored as force_sig_mceerr() was designed to. > > > > If the user process don't want this signal, will it set signal config t= o ignore? > > Maybe we can use a send_sig_mceerr() instead of force_sig_mceerr(), if = process want to > > ignore the SIGBUS, then it will ignore that, or it can also process the= SIGBUS? =20 >=20 > I don't think the signal blocking mechanism makes sense for this. > Blocking a signal is for saying that, if another process sends the > signal (or an async event like ctrl-C), then the process doesn't want > it. Blocking doesn't block synchronous things like faults. >=20 > I think we need to at least fix the existing bug before we add more > signals. AFAICS the MCE_IN_KERNEL_COPYIN code is busted for kernel > threads. Got this, Thanks! I read https://man7.org/linux/man-pages/man2/write.2.html, and it seems the= write syscall is not expecting an signal, maybe a specific error code for this scenario is enough. --=20 Thanks! Aili Yao