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=-3.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 D608DC433DB for ; Mon, 8 Mar 2021 18:14:53 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 888FA65230 for ; Mon, 8 Mar 2021 18:14:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 888FA65230 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amacapital.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 058B28D0056; Mon, 8 Mar 2021 13:14:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 02F5E8D001D; Mon, 8 Mar 2021 13:14:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DEDEF8D0056; Mon, 8 Mar 2021 13:14:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0157.hostedemail.com [216.40.44.157]) by kanga.kvack.org (Postfix) with ESMTP id C39598D001D for ; Mon, 8 Mar 2021 13:14:52 -0500 (EST) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 8AFA4180AD820 for ; Mon, 8 Mar 2021 18:14:52 +0000 (UTC) X-FDA: 77897508024.22.DA567AF Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by imf13.hostedemail.com (Postfix) with ESMTP id E2CA6E005F24 for ; Mon, 8 Mar 2021 18:14:45 +0000 (UTC) Received: by mail-pl1-f176.google.com with SMTP id s7so5257707plg.5 for ; Mon, 08 Mar 2021 10:14:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=BMzfJiSNckr4c5bJM9oyPQFJf7z3QvS6eYTHskXsafM=; b=DpdsAgQaHmv2JAOZ+bhP4sp1RBYFsEYq+SSfL2bHCxvx4Oa+1ey6LCvKTUtsJX7Hnp hxHAmGtQTiskkXfkKXpXdazG70wERIFgteI6y6U5Fs9wDN8wvPnMrJerRQutlJJLEaRV 2ldo+mTCwY3AdiYz6eHD8OhGUuAQFFTvGFRUty6qE5zy2vLNxlNfv9WjSjWWr2/afs5v wWGxPAcQJ/z+ygYio+jqXC3w+rSbJ5EV4g3Mjk2pYiIKza25EBc6YM+pjjFNZ9MRfjN0 VzijfTuc+xxMtHYB1ynPtu1wbl/5e7/MM7MVoXYmHpgouhMgUyp5yaiRPeoktmQMtabo N6yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=BMzfJiSNckr4c5bJM9oyPQFJf7z3QvS6eYTHskXsafM=; b=ug7yOz6NvGEbuvMDLSXUzhNXnKX2XQOOI3igErINvvBSAfmE+bhuSkYCmjR/XSOwX/ yr4+D5LE3pPVcCKGx8OoitPsIMe3dWkLxoR+Yvj3r9FbxjrYbB0FF5C15y+CZEjbJRp3 0WKEFTo7B8ooN1IXqfXmPkbpjLRxTgiJ7dWHcfHgG9GMYuvZ/fkG0cqqB+VxAXIgAUJQ uQEgcF91PGtIKrXdxUNN/Y9AOu+IoGwneS3VhUGFz0UK1tq6dgPgXn2QlYGbLm4Na3W4 1h1Hj+ihKHwZVkE936PJI7QBTuft6X1upBuuvm+T/22jMh4LnIq7W/5Xd9hYzBArb6Y+ 7TYw== X-Gm-Message-State: AOAM531GQwt95exNVoyCESzoGHIYQiEoGNIuqLFE5FxBxjLrkFLW5WPk heFjdD/4mNoVBecgRvj4hfsAiA== X-Google-Smtp-Source: ABdhPJwz39/p7xj03gR2pGest2ZPugtBXlw5U3YPRRZUCmiPLFttiRa/JNLUKm+korjrZ+RdYKPd0Q== X-Received: by 2002:a17:90a:4894:: with SMTP id b20mr143836pjh.50.1615227286141; Mon, 08 Mar 2021 10:14:46 -0800 (PST) Received: from ?IPv6:2601:646:c200:1ef2:691e:92d:1e16:d5b3? ([2601:646:c200:1ef2:691e:92d:1e16:d5b3]) by smtp.gmail.com with ESMTPSA id k27sm11567445pfg.95.2021.03.08.10.14.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 08 Mar 2021 10:14:45 -0800 (PST) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Andy Lutomirski Mime-Version: 1.0 (1.0) Subject: Re: [PATCH v3] x86/fault: Send a SIGBUS to user process always for hwpoison page access. Date: Mon, 8 Mar 2021 10:14:44 -0800 Message-Id: <8F3F763F-59CC-4E25-B4DE-89CD0632F754@amacapital.net> References: <20210308174912.4ac9029a@alex-virtual-machine> Cc: "Luck, Tony" , 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 In-Reply-To: <20210308174912.4ac9029a@alex-virtual-machine> To: Aili Yao X-Mailer: iPhone Mail (18D52) X-Stat-Signature: ct5n4ysmz8e5b8rph7oa3ouggce3becn X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: E2CA6E005F24 Received-SPF: none (amacapital.net>: No applicable sender policy available) receiver=imf13; identity=mailfrom; envelope-from=""; helo=mail-pl1-f176.google.com; client-ip=209.85.214.176 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615227285-295101 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 Mar 8, 2021, at 1:49 AM, Aili Yao wrote: >=20 > =EF=BB=BFOn Sun, 7 Mar 2021 11:16:24 -0800 > Andy Lutomirski wrote: >=20 >>>>>>> Some programs may use read(2), write(2), etc as ways to check if >>>>>>> memory is valid without getting a signal. They might not want >>>>>>> signals, which means that this feature might need to be configurable= . =20 >>>>>>=20 >>>>>> That sounds like an appalling hack. If users need such a mechanism >>>>>> we should create some better way to do that. >>>>>>=20 >>>>>=20 >>>>> Appalling hack or not, it works. So, if we=E2=80=99re going to send a s= ignal to user code that looks like it originated from a bina fide architectu= ral recoverable fault, it needs to be recoverable. A load from a failed NVD= IMM page is such a fault. A *kernel* load is not. So we need to distinguish i= t somehow. =20 >>>>=20 >>>> Sorry for my previous mis-understanding, and i have some questions: >>>> if programs use read,write to check if if memory is valid, does it real= ly want to cover the poison case? =20 >>=20 >> I don't know. >>=20 >>>> When for such a case, an error is returned, can the program realize it= 's hwposion issue not other software error and process correctly? =20 >>=20 >> Again, I don't know. But changing the API like this seems potentialy >> dangerous and needs to be done with care. >>=20 >>>>=20 >>>> if this is the proper action, the original posion flow in current code f= rom read and write need to change too. >>>>=20 >>>=20 >>> Sorry, another question: >>> When programs use read(2), write(2) as ways to check if memory is valid= , does it really want to check if the user page the program provided is vali= d, not the destination or disk space valid? =20 >>=20 >> They may well be trying to see if their memory is valid. >=20 > Thanks for your reply, and I don't know what to do. > For current code, if user program write to a block device(maybe a test try= ) and if its user copy page corrupt when in kernel copy, the process is kill= ed with a SIGBUS. > And for the page fault case in this thread, the process is error returned.= Can you point me at that SIGBUS code in a current kernel? >=20 > --=20 > Thanks! > Aili Yao