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 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 2ADBBC433DB for ; Sun, 7 Mar 2021 19:16:40 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9029B64F56 for ; Sun, 7 Mar 2021 19:16:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9029B64F56 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 D5FAC6B0083; Sun, 7 Mar 2021 14:16:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D0F706B0085; Sun, 7 Mar 2021 14:16:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B89416B0088; Sun, 7 Mar 2021 14:16:38 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0035.hostedemail.com [216.40.44.35]) by kanga.kvack.org (Postfix) with ESMTP id 969E66B0083 for ; Sun, 7 Mar 2021 14:16:38 -0500 (EST) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 4883F3638 for ; Sun, 7 Mar 2021 19:16:38 +0000 (UTC) X-FDA: 77894034876.03.4FE64D3 Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) by imf21.hostedemail.com (Postfix) with ESMTP id 9400FE0011F1 for ; Sun, 7 Mar 2021 19:16:36 +0000 (UTC) Received: by mail-ej1-f52.google.com with SMTP id mm21so15785597ejb.12 for ; Sun, 07 Mar 2021 11:16:37 -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=TdtWEax3e+L9tciWGSFj6L0EDP5X9cwzVKpEq7qDOIg=; b=QLhFDQJuiRjwZl/96lV4Vn9PIeiwOA6ulpdpgniA9rFtYb6LbdKE+AjnL5fO97Fjlu V+XH4ur9EN3W33y1Nn3NA/IEYhSfVJWDYbn5gNU4P76lX2dGpMw5fChAD/BxWkwLPYiG hcm61groT0Pqi2AvBqP5p2Z0/k6CfEvYywWAXh9w89/+EjBEXi6VttDobYYJD7xp5xPo 5L9yQqE37nE6slp0AxOxgvEiuYquL5MkJhVVcE2440lpl7EEaYYLWf5MRdNo9NnjUIYu dngllgsizpuodH/U9GOWm7UaWE8dDxT0r9/3puGcF/Vac63gyApGyM5DJkVOESivEQ5l Gb+g== 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=TdtWEax3e+L9tciWGSFj6L0EDP5X9cwzVKpEq7qDOIg=; b=jYu43Kml8es4KritANCqbJWq10IehboIyeC6W1hc5Y0W18xxxVlrs/XO6DYpUgyy11 TqtSEy24/sJKMgak4N+gceqrHtlwRvPGKRzwr9C1A+T+yG7tJcOvAFAohVYyUFWNlePI n6zBRGonMicMamkvcf/fo6ZRLe69ULWcHGRVoc0B7sI6dwjWFFv8MLmX7qQHX7+4u7D8 uPadZL0oWNVbjMWGOEgp1QhBvOusiQRfDkNoxBPC+2mzTPMPA3QfaZcvc3mE3qm9Z2z5 HxGXgq9gq2qjhtCrBdqPQ6oyDvzXW+XCypK4/TBTBiaUxrCbe0gk7DDDNqAJVl2X/pQ8 kXYg== X-Gm-Message-State: AOAM531iB69zDPdPBFaAm4jvEK0++XQYMNDCQrQ9tnN/eTNKraL0HwEZ 5uChUl/eqXGlw0hICTnOY4odQbsAHZxaCW3s7lQGLQ== X-Google-Smtp-Source: ABdhPJzWTNkW/hO3ubILkBQCQLiAynvpieVDuFtUpUB+N7kNuo4ZQFeTSjIBbbPlIuYhyN8D54h+daTMhxxvKPOTZDQ= X-Received: by 2002:a17:906:f44:: with SMTP id h4mr11613752ejj.204.1615144596043; Sun, 07 Mar 2021 11:16:36 -0800 (PST) MIME-Version: 1.0 References: <8d0c76f97f35499f91a2b82d3e7c024d@intel.com> <59469ECC-5316-4074-98EF-52FFF7940818@amacapital.net> <20210303202402.384265a3@alex-virtual-machine> <20210303205129.0a66f7a7@alex-virtual-machine> In-Reply-To: <20210303205129.0a66f7a7@alex-virtual-machine> From: Andy Lutomirski Date: Sun, 7 Mar 2021 11:16:24 -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" , 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 9400FE0011F1 X-Stat-Signature: u946f4j7xhepg9wd13hua1ifg98jy54y Received-SPF: none (amacapital.net>: No applicable sender policy available) receiver=imf21; identity=mailfrom; envelope-from=""; helo=mail-ej1-f52.google.com; client-ip=209.85.218.52 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615144596-307966 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, Mar 3, 2021 at 4:51 AM Aili Yao wrote: > > On Wed, 3 Mar 2021 20:24:02 +0800 > Aili Yao wrote: > > > On Mon, 1 Mar 2021 11:09:36 -0800 > > Andy Lutomirski wrote: > > > > > > On Mar 1, 2021, at 11:02 AM, Luck, Tony wrote= : > > > > > > > > =EF=BB=BF > > > >> > > > >> 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 configurab= le. > > > > > > > > That sounds like an appalling hack. If users need such a mechanism > > > > we should create some better way to do that. > > > > > > > > > > Appalling hack or not, it works. So, if we=E2=80=99re going to send a= signal to user code that looks like it originated from a bina fide archite= ctural recoverable fault, it needs to be recoverable. A load from a failed= NVDIMM page is such a fault. A *kernel* load is not. So we need to disting= uish it somehow. > > > > 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? I don't know. > > When for such a case, an error is returned, can the program realize it= 's hwposion issue not other software error and process correctly? Again, I don't know. But changing the API like this seems potentialy dangerous and needs to be done with care. > > > > if this is the proper action, the original posion flow in current code = from read and write need to change too. > > > > 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 val= id, not the destination or disk space valid? They may well be trying to see if their memory is valid. > the patch will not affect this purpose as it's only valid for user page= which program provide to write or some syscall similiar parameter > > -- > Thanks! > Aili Yao --=20 Andy Lutomirski AMA Capital Management, LLC