Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2047245ybz; Thu, 30 Apr 2020 09:55:43 -0700 (PDT) X-Google-Smtp-Source: APiQypJk+ZEOxPo6YNOLVpaaduJ3WN2fHCwT0LGs0UY/NmOHbCtWmYZWGYLUR8XhktayZfMD6XWQ X-Received: by 2002:a50:eb8b:: with SMTP id y11mr3647061edr.229.1588265743603; Thu, 30 Apr 2020 09:55:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588265743; cv=none; d=google.com; s=arc-20160816; b=kN/3XeOb6LxwreB1DK9jy1bBzaJABu8W5hk4R4WB/0CbL5m7SkZDdD0ULm8ruWnqQx MwzN8hhKgjevhrKF/zIXGvpe9qaevsz6NqB4YPbqBcIt0cOpp1L4uguVpC59DO2jhBmi vdf+dYt41ByWlQo4JkujrKDN+bPkLEOdx3agfuc6Vws5EypNC1BFUhQfcZy2VRI0+K+h 9gPHVBeaynqQGWUM5MCBE6N3qqcdjVRFJ2VcCO2alezqkwn8yKbtUEc/6RRtUjIEIqGe PSxiZ22WmqMHNDVnp37d2vO+s44iAZn53vKaJb0vfEj2yIy+u99irVwK5w3OzkRsH3OO tEWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=c6CSGnmXUS1z9rbM34iwtFUpreKuTZCCGUcUhb0Fymw=; b=g4vTjQfh2zHedazrWG6LlVnVoAQphSLO26rJUuB0tkPdg9IAsHPB+sYORcjtqtpNsg RHTSa9Y8G0sXN64CCbODhhQkBY8ehSdgZFAbR4+i1c0mjAr/a+hQz1ag03MFGRv4O6HG MCwyun1VUKKJcoTZ/g0Iy6l/Qcj+J+TMHFlUBv0XK7DFwUWV1Mt8gH5XOfRCKr2N3p/3 vZFApCvexfBEwrHH8B6jYvhBVNWfFRb7TWx1xUC5acJS/9oeic1XQVRJH52W23I7tzQ9 4k8gwyxskYVsGJx5+Zo+mt1zgbzKXSA405tTtgo7DusBU77EmJslafKkZbf4so2CqeYk qAkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QQERtHd2; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d5si89811edy.479.2020.04.30.09.55.20; Thu, 30 Apr 2020 09:55:43 -0700 (PDT) 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=@kernel.org header.s=default header.b=QQERtHd2; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726618AbgD3Qv7 (ORCPT + 99 others); Thu, 30 Apr 2020 12:51:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:45824 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726309AbgD3Qv6 (ORCPT ); Thu, 30 Apr 2020 12:51:58 -0400 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9EE8724954 for ; Thu, 30 Apr 2020 16:51:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588265517; bh=Qh9yGfu7EKu8YBjyZn57LidMIeIdE9hqIfI7Nfz5zto=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=QQERtHd2tvFSzKdIw7cibcdVNaSdmyG20LzUeHLE/Rd8Ra4MIYEURm5Tv//rSLTV3 Ek6VFKay/KjG3PAgO0ceXHc5n3oywEIqZ8rPWxNojM3LY+jscNuyhwVbvMuYomubRe 4UlthhnQYnlVlPE86wP9+rVbZLbym61P7wrGwo7c= Received: by mail-wm1-f50.google.com with SMTP id r26so2770667wmh.0 for ; Thu, 30 Apr 2020 09:51:57 -0700 (PDT) X-Gm-Message-State: AGi0PubUm9UnXic1pn1cW6RNQ9zWoDfcQqbPSrwTNDyrsjyvJW9nzvHl EDW08NvTLIvEBh9WmZpUMNvWZbCqMfnImf7tk2kRUg== X-Received: by 2002:a1c:23d4:: with SMTP id j203mr4175179wmj.49.1588265515945; Thu, 30 Apr 2020 09:51:55 -0700 (PDT) MIME-Version: 1.0 References: <158823509800.2094061.9683997333958344535.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: From: Andy Lutomirski Date: Thu, 30 Apr 2020 09:51:44 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 0/2] Replace and improve "mcsafe" with copy_safe() To: Linus Torvalds Cc: Dan Williams , Thomas Gleixner , Ingo Molnar , Tony Luck , Peter Zijlstra , Borislav Petkov , stable , "the arch/x86 maintainers" , "H. Peter Anvin" , Paul Mackerras , Benjamin Herrenschmidt , Erwin Tsaur , Michael Ellerman , Arnaldo Carvalho de Melo , linux-nvdimm , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 30, 2020 at 7:03 AM Linus Torvalds wrote: > > On Thu, Apr 30, 2020 at 1:41 AM Dan Williams wrote: > > > > With the above realizations the name "mcsafe" is no longer accurate and > > copy_safe() is proposed as its replacement. x86 grows a copy_safe_fast() > > implementation as a default implementation that is independent of > > detecting the presence of x86-MCA. > > How is this then different from "probe_kernel_read()" and > "probe_kernel_write()"? Other than the obvious "it does it for both > reads and writes"? > > IOW, wouldn't it be sensible to try to match the naming and try to > find some unified model for all these things? > > "probe_kernel_copy()"? I don't like this whole concept. If I'm going to copy from memory that might be bad but is at least a valid pointer, I want a function to do this. If I'm going to copy from memory that might be entirely bogus, that's a different operation. In other words, if I'm writing e.g. filesystem that is touching get_user_pages()'d persistent memory, I don't want to panic if the memory fails, but I do want at least a very loud warning if I follow a wild pointer. So I think that probe_kernel_copy() is not a valid replacement for memcpy_mcsafe(). --Andy