Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1059287pxk; Thu, 1 Oct 2020 23:12:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxj/kfDgPtn20sxErqLeeWgWZYryP8BmEwYHjZ6APPu9k6rpTn4qgu/J3aiVVn1A2U7PH4A X-Received: by 2002:a17:906:edb6:: with SMTP id sa22mr611452ejb.101.1601619123645; Thu, 01 Oct 2020 23:12:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601619123; cv=none; d=google.com; s=arc-20160816; b=lB/z9e1O2bErIaOK1dhn+qTpOpqn8kzFpFKkQq7zIdF1IVuq3BS+p+0XNIZUNXUMAS yLHhpuCXgGtPNT7f4pImXcPrlJbQVwVSJthTB0mhcZqHnbu9afC1CSdk0Hi44VvgLJbc Eo+Zg7+RzKQCSYM45LkEWldAeF1cvmm5eQFW2ypEzpdLviANwEoF6cqIUl4X6vneYolP iEaDCaNOrA5Tw6250PA/hPowTgRM8XoZatWsDBtOpJl4M0cowVBHUoSjOaTydEeLRadW J5iSvtXSvZ99l9zDw1xMdgi/HX50D/pgRiR72ShkzZ1eA2m33fu0IgfdA2VrLl/PK3eZ Z7Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ErDIuUWMtALu7PV5gTspIOaPecBO2jLlFmry3dq1eBo=; b=CXfZGXw3opPifn7iU2qOieXsKVY2CjbJk4xcisyXte+su9S5wTwRSp5csmn+CvXlUQ /hai3xwYgMyQ3e8ZSbkhYbv2VpB9kPMiSR8VN9saGYvOzQy8BnAbIY6jn+2tLljkEGp8 Vun8lXJfhlBs49MZYv/nguGbKWEKdedfsSm4XeF5ub6SGtmdC9wRWik3cQjM+cDKs+le mSw4Uw+vr/NARtyOlc5IPkD8WbQhPtB+JUvKfsYJ1gIVgsjdJvLasfDQ4yOVmlJPeoCZ slOD/wBeLmhXV8VBOCNr0tmeUfdIUXlggndxt7EvzpsYJUwtyOZ5MjVnZ770a9k6icMA DwQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=rBhLzpe9; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w20si369935ejz.72.2020.10.01.23.11.39; Thu, 01 Oct 2020 23:12:03 -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=@google.com header.s=20161025 header.b=rBhLzpe9; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726036AbgJBGJX (ORCPT + 99 others); Fri, 2 Oct 2020 02:09:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725968AbgJBGJX (ORCPT ); Fri, 2 Oct 2020 02:09:23 -0400 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77C86C0613E2 for ; Thu, 1 Oct 2020 23:09:21 -0700 (PDT) Received: by mail-ej1-x644.google.com with SMTP id p9so323068ejf.6 for ; Thu, 01 Oct 2020 23:09:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ErDIuUWMtALu7PV5gTspIOaPecBO2jLlFmry3dq1eBo=; b=rBhLzpe9AaLtN/2VQTeF4ZLBJk0wEwLO1iXW7SFdIMCovz/n+bZLB7IAveG1e9ur8g YRDBg+0/O3HVIFt9+77VO4vz1qRhWN0N5JLUJkLHeKN0Fq2FV1sS8zieRMheOhUf5bVF 9qAS9mTkKdzWHR4dJan0mJZrLW9vG6XzX1iipaUrffpCB3CFAGIdFAOD70DlWd/BV/00 YeempllyPkiOQYQTjPfz7FvV8Zq35XFb+EARWaMiaC9negdQ9wmS4SToBah7FpromM0/ j46OcFr+y/fWE9HUSVM5XGUXZ/ifypV3vicbNueD/Gkh591QW2pcf6xwTpu/Kqy1srWq wZGQ== 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; bh=ErDIuUWMtALu7PV5gTspIOaPecBO2jLlFmry3dq1eBo=; b=I6AaMS8lzZmxfzl2t+jxxVIQVYNwLFrgmEDO9eB95qZMWW2oo6jd2KG01IMVW4XuRC /068Qt3+s4vDkos/+bal5PRFzHmxQgrKqiSOmzpiIw62OI78nou9D2wVZnpJX8B2VOSb SjfhU+Stn+seI/B2gvW+fqGlZVJqUJ74AKdP/z/APLdwbjvHdmuUUZuJmd6Wn55qX5Z+ H5iZO2gvzLuLqYXlHyMGgKrgh32TilJtn4H3GIl+R89TSodHQcWT6i5XVkNMJCI80tm+ 8qyvYVjh1Tg2NOFMIBSd+CbCgogTef+mY9/uwV3TOKSKf1Y2Ro4thpQ2WJ1hy9Q2eK4n ySFA== X-Gm-Message-State: AOAM530Vy6BVQz97IBL5Cj0QyVVklrCY4yPkXT2gJinFj7Wy4LVsRhKv ph9j1q/sHrcWe43+J67dP0iqNtQ21e9Ezqb1jdwzOw== X-Received: by 2002:a17:906:394:: with SMTP id b20mr570705eja.513.1601618959814; Thu, 01 Oct 2020 23:09:19 -0700 (PDT) MIME-Version: 1.0 References: <20200929133814.2834621-1-elver@google.com> <20200929133814.2834621-3-elver@google.com> In-Reply-To: <20200929133814.2834621-3-elver@google.com> From: Jann Horn Date: Fri, 2 Oct 2020 08:08:53 +0200 Message-ID: Subject: Re: [PATCH v4 02/11] x86, kfence: enable KFENCE for x86 To: Marco Elver Cc: Andrew Morton , Alexander Potapenko , "H . Peter Anvin" , "Paul E . McKenney" , Andrey Konovalov , Andrey Ryabinin , Andy Lutomirski , Borislav Petkov , Catalin Marinas , Christoph Lameter , Dave Hansen , David Rientjes , Dmitry Vyukov , Eric Dumazet , Greg Kroah-Hartman , Hillf Danton , Ingo Molnar , Jonathan.Cameron@huawei.com, Jonathan Corbet , Joonsoo Kim , Kees Cook , Mark Rutland , Pekka Enberg , Peter Zijlstra , sjpark@amazon.com, Thomas Gleixner , Vlastimil Babka , Will Deacon , "the arch/x86 maintainers" , linux-doc@vger.kernel.org, kernel list , kasan-dev , Linux ARM , Linux-MM Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 29, 2020 at 3:38 PM Marco Elver wrote: > Add architecture specific implementation details for KFENCE and enable > KFENCE for the x86 architecture. In particular, this implements the > required interface in for setting up the pool and > providing helper functions for protecting and unprotecting pages. [...] > diff --git a/arch/x86/include/asm/kfence.h b/arch/x86/include/asm/kfence.h [...] > +/* Protect the given page and flush TLBs. */ > +static inline bool kfence_protect_page(unsigned long addr, bool protect) > +{ [...] > + flush_tlb_one_kernel(addr); flush_tlb_one_kernel() -> flush_tlb_one_user() -> __flush_tlb_one_user() -> native_flush_tlb_one_user() only flushes on the local CPU core, not on others. If you want to leave it this way, I think this needs a comment explaining why we're not doing a global flush (locking context / performance overhead / ... ?).