Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp760217pxf; Wed, 10 Mar 2021 17:33:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJw3rBhX9jXbWWPpjbz4PZ2u/Fw2AsD4g0EszcudqaBNZBAFV+hKhVIendhp3oyvtVuK7alS X-Received: by 2002:aa7:db41:: with SMTP id n1mr6196332edt.186.1615426410950; Wed, 10 Mar 2021 17:33:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615426410; cv=none; d=google.com; s=arc-20160816; b=LATjF6WgKG1oMvbR+AtBzAWvH0uhsi/rroH0DviyN7GxCwqjdXkLg/oKquCI8DWjgR 19fy0fR8K4QTUQzfjfdAHKzzc0uJxxYybejjfIJcnX9KPOPpuuWNjnD84bRwX6MJ3u4n TCgSvgB95KW3F7VIUoWk93+rKHmvrS0aXzcjs+8/qjENKekHRNWO8Jk2HGptMHzDgGww 1dXzqNFsC100aE4u5tnY1Qeq0DjX4r9/+2OGeMY/k+EBwrCY5CELa+oxn8gXVDaMClTD OLv9MBUjsECK79+dE1LTe8M8sr/ImZ4H0Cvo+77IBDY5s4ZidAAilNEdg0QYlwF9Abq6 a7JA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=VpOIjQ3p9w0rNFfbAO51HuvtMJp/6aJrl+qPrZuKuR8=; b=NW00xCxnVaOxUznVM4OHmvmO18WguN1M8DlIKQceBs1Zi30JvePnjnn0KeoyzDiM9T hRVKcDseY8yE1BWGzMG8x5Xm83wzvY9j8bjr3UyHs3japvsHbuPVyRzP1cOCwdWBUkzO flOUlKDzI9HTztRbz/WcP2/vrmbYnkZO3BRSyk31/dsnvb0iYp3EeW1j/Z7xE5hAPoZH HxusrVhxo4ivt0zEayX/qZxYRpBtX/SInGVzpc5LDfXklzYXHRB/DLMnPA0rQUwAGcKW d3OAgY2Mk2zhzGpQJmUDPpfGNQWxlPlQ28lAVQkGIvzDt5XqoyDfGJMdzjRYvEpBH0JX PjoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b="aM/wmrMK"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q14si619244ejy.320.2021.03.10.17.33.07; Wed, 10 Mar 2021 17:33:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b="aM/wmrMK"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229468AbhCKB20 (ORCPT + 99 others); Wed, 10 Mar 2021 20:28:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229544AbhCKB2Z (ORCPT ); Wed, 10 Mar 2021 20:28:25 -0500 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10982C061760 for ; Wed, 10 Mar 2021 17:28:25 -0800 (PST) Received: by mail-ej1-x62c.google.com with SMTP id dx17so42829135ejb.2 for ; Wed, 10 Mar 2021 17:28:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=VpOIjQ3p9w0rNFfbAO51HuvtMJp/6aJrl+qPrZuKuR8=; b=aM/wmrMKYr9tu1cwciQttikcxEZH1/v/i+xHpN3cj4QpcL/AU7fKmsWFk9SGeEeUAl XPRFwqreWDxUrqnN+WDqh9pH3udYulUcseEJtij+krUz2w6yLZIBO72w7H/PytPOU0e2 QmAagxnT+PmwAfCzV8VyX8VL3c8FH0PJwrZzjgDMO6vWECa/F3XMyH25193pxJTWq18m 5wejTpNj21k/DNvUX2DyHlQG3osbrPUlZ33s1jbLzrAZZoIR/lydR1HenxDeUjb+wE+U w8P5ha3WaUO7prJow5sGuquFUmLi1UG/i0AyhEw7Hb0HD7XRKP1xbj67OrL0cbUnw6L5 3StQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=VpOIjQ3p9w0rNFfbAO51HuvtMJp/6aJrl+qPrZuKuR8=; b=X0X7S3tvZVfo76g5Z/DygB2iUyNx8qLn0hRJXW+UpPZBLnQVfaReKWLJszu/wf1bPS dpEnyieFEo2YOxOCmPvtKLkR+6zvGl17a4duAOjowx295dKndlzbVE1s1k3CPsnx9jb4 Y2sBC6Ghk2KM3ypyb/XcCz2/0DwRWbsX0ZFr4sCxRAsuwmACNG2f5qLw2/oEYQpoXPif 3KiwohxESwBQkNQ5kvm12zzpQmvyH4sm6LTLturJabUhYPBGIoCvCbgdJJTwVRl3wqEE gfnOhMRraJVygbpFAw9fuffcrEm50R5YI+mDMqMrorr/smqDTBHTAbmgnRSN12mrG88t /GAA== X-Gm-Message-State: AOAM531HPG5R2FA4EW9ejW3aurf8R1k+CYhnTIW/AyPGD10BuyyNV23K 0mAu72Qy1CvlVJD6Gs4fzbmxao+pGKLqip5r1PVU7w== X-Received: by 2002:a17:906:f44:: with SMTP id h4mr663334ejj.204.1615426103622; Wed, 10 Mar 2021 17:28:23 -0800 (PST) MIME-Version: 1.0 References: <4fc1b4e8f1fb4c8c81f280db09178797@intel.com> <047D5B49-FDBB-494C-81E9-DA811476747D@amacapital.net> <20210311091941.45790fcf@alex-virtual-machine> In-Reply-To: <20210311091941.45790fcf@alex-virtual-machine> From: Andy Lutomirski Date: Wed, 10 Mar 2021 17:28:12 -0800 Message-ID: Subject: Re: [PATCH v3] x86/fault: Send a SIGBUS to user process always for hwpoison page access. To: Aili Yao 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 , yangfeng1@kingsoft.com, Linux-MM , LKML , sunhao2@kingsoft.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 10, 2021 at 5:19 PM Aili Yao wrote: > > On Mon, 8 Mar 2021 11:00:28 -0800 > Andy Lutomirski wrote: > > > > On Mar 8, 2021, at 10:31 AM, Luck, Tony wrote: > > > > > > =EF=BB=BF > > >> > > >> Can you point me at that SIGBUS code in a current kernel? > > > > > > It is in kill_me_maybe(). mce_vaddr is setup when we disassemble wha= tever get_user() > > > or copy from user variant was in use in the kernel when the poison me= mory was consumed. > > > > > > if (p->mce_vaddr !=3D (void __user *)-1l) { > > > force_sig_mceerr(BUS_MCEERR_AR, p->mce_vaddr, PAGE_SHI= FT); > > > > Hmm. On the one hand, no one has complained yet. On the other hand, har= dware that supports this isn=E2=80=99t exactly common. > > > > We may need some actual ABI design here. We also need to make sure that= things like io_uring accesses or, more generally, anything using the use_m= m / use_temporary_mm ends up either sending no signal or sending a signal t= o the right target. > > > > > > > > Would it be any better if we used the BUS_MCEERR_AO code that goes in= to siginfo? > > > > Dunno. > > 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 scenar= io; 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 to = ignore? > Maybe we can use a send_sig_mceerr() instead of force_sig_mceerr(), if pr= ocess want to > ignore the SIGBUS, then it will ignore that, or it can also process the S= IGBUS? 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. 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. --Andy