Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1199682imm; Wed, 11 Jul 2018 19:58:22 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfdM/usw0Q7BCH1iuF1DP8dkniAeWr6k9iE9ukBHE9lMSDoGAUbMJvc96mSjb5lsx5N82wY X-Received: by 2002:a17:902:a508:: with SMTP id s8-v6mr428509plq.223.1531364302852; Wed, 11 Jul 2018 19:58:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531364302; cv=none; d=google.com; s=arc-20160816; b=K3dj8Eum2ekMtfN6cudh2EY8kggWzx/vtTV+HLf6r24hwA4lxraX/pi4kHyrfUcjFP wT0+70mDciylM3cCrxosPp90HGcj5A+7AabkQr3eeyB7DgK2g7LCxjeFUbFZmXO0QMFw O58udIm3PLr0j/GTGce+7v9Yk78m0f1Hyl8p2T/2Nz1oIxgmkXkqmdjA+uJ8eEZbp6+U PvxAhvAx6WlfXs7WkHx+W0z0HtsYHG7fIZnHZWpfc97Qj5dMIwvBouTtdyQxJex33V4E pbmrEZIWXLCiT2CJYwcb1N3FndZBJeQXrlEUfCRq+EZd6Dyz4212DPXppQhS3USjKPJs UaiA== 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 :arc-authentication-results; bh=lh8TxHl5WB9OmBO9lEWZUkFPn5o9qgsioXcJ38g1tTE=; b=DhIqBwmpIJ4nykUTVvKb3d6Kzw1Uif+DREe3ggT9LXlVtSZeUQc/f7nmXFXFXQIVve hbXbV3UMTQ2PleA6PGJo8HRoOppVHa6zZEKakjsNpUSqvg4h3s9EHqL5j7xTAmjc2fxD 2mkMvYC5QbEtJ2g46KWA4z997/bwsSu8qZJTThIgthtSdNXzuxEw4Mn24CV1S3lMostr BM8jhcvrn88B/CkMHOhmO8IN3okeJrxt2m6pzEjA5+wZIWvTMI5eVRv2LH1fZ9jXOZwV y0I2R01oOHp8BbLJcApIt/npttAzok5TW8a7IDVqZHonDAP7K6FA4u4S6yk97XYZxvUo PiWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=hPqxaqXp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id s2-v6si20125206plr.393.2018.07.11.19.58.08; Wed, 11 Jul 2018 19:58:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=hPqxaqXp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S2389034AbeGKVNt (ORCPT + 99 others); Wed, 11 Jul 2018 17:13:49 -0400 Received: from mail-oi0-f68.google.com ([209.85.218.68]:32952 "EHLO mail-oi0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732522AbeGKVNt (ORCPT ); Wed, 11 Jul 2018 17:13:49 -0400 Received: by mail-oi0-f68.google.com with SMTP id l10-v6so5162261oii.0 for ; Wed, 11 Jul 2018 14:07:37 -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=lh8TxHl5WB9OmBO9lEWZUkFPn5o9qgsioXcJ38g1tTE=; b=hPqxaqXpbNK98q6ILX77YhgMEtIeMRaBAHxQfRaKS4MJWJPHeKzWnoSGaEgLBO6ZYA FXvWA2aoDNipGQdC1MM9vCTOWbBT+zoS49ssfKtLHJWXyzZWaziigAV6fuK+CyJjoVvD UJJkbdV8zPjTLBE9yZ5/TQGqhamcXEBqL35nfKHA1UNyEGdwpuVsZuMtYmmw02vwdwvY c5c2rR04uu+LzNo52dCw6cVGvUIkFjzrzP69iFpdORFoHCadBPU20LrXbHyoJKa7md+j IN3K0PnwlSw5vtxOO/pKgvx+Aq8dDPc/x/VDbiyABDPyuikjW9LDQFgGYA5fvInVfLN1 xj6A== 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=lh8TxHl5WB9OmBO9lEWZUkFPn5o9qgsioXcJ38g1tTE=; b=Cc+IwasvJ/rAS6Y2c8DbqYrw5qLtxOZdpeEzecKtJ3nRmFwWBgjdLPWgbQdg3RIuLg O9rqnANaN9z3tvrY3pvIHHlGb4SNwFAdJ2Pmo/SV6dZPMBy/csPuJzwpNb+0Bq67+F19 4U33HD92eFxsyILXr4xkPjUT4dCgGjyZMcc3yBkrQdw7p0nOvXpKNvXJR0On3vc95XrU sgPVgFeWURlzxePdmK0HDcWKtcGmhVvHOz2kIY+goS7RASw7X/oHPWmfOa392zn37IuM sxGijH29OMx3dq622LB1KrlmcVATVzixNY3wqPIJy/dj+ejp4QVi1fk8XIt4hu7nrw9E S4iA== X-Gm-Message-State: AOUpUlErlVJrRtGsJqNJyCEbQ1iTM+ZPd640WeDU8AQRh3KoamXS2l4I Xl7COVXSlt8HkqS6MrTbHTgb/2mHDrX7XOn3zWSTIQ== X-Received: by 2002:aca:c42:: with SMTP id i2-v6mr264102oiy.219.1531343256258; Wed, 11 Jul 2018 14:07:36 -0700 (PDT) MIME-Version: 1.0 References: <20180710222639.8241-1-yu-cheng.yu@intel.com> <20180710222639.8241-23-yu-cheng.yu@intel.com> In-Reply-To: <20180710222639.8241-23-yu-cheng.yu@intel.com> From: Jann Horn Date: Wed, 11 Jul 2018 14:07:09 -0700 Message-ID: Subject: Re: [RFC PATCH v2 22/27] x86/cet/ibt: User-mode indirect branch tracking support To: yu-cheng.yu@intel.com Cc: "the arch/x86 maintainers" , "H . Peter Anvin" , Thomas Gleixner , Ingo Molnar , kernel list , linux-doc@vger.kernel.org, Linux-MM , linux-arch , Linux API , Arnd Bergmann , Andy Lutomirski , bsingharora@gmail.com, Cyrill Gorcunov , Dave Hansen , Florian Weimer , hjl.tools@gmail.com, Jonathan Corbet , keescook@chromiun.org, Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , ravi.v.shankar@intel.com, vedvyas.shanbhogue@intel.com 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 Tue, Jul 10, 2018 at 3:31 PM Yu-cheng Yu wrote: > > Add user-mode indirect branch tracking enabling/disabling > and supporting routines. > > Signed-off-by: H.J. Lu > Signed-off-by: Yu-cheng Yu [...] > diff --git a/arch/x86/kernel/cet.c b/arch/x86/kernel/cet.c > index 4eba7790c4e4..8bbd63e1a2ba 100644 > --- a/arch/x86/kernel/cet.c > +++ b/arch/x86/kernel/cet.c [...] > +static unsigned long ibt_mmap(unsigned long addr, unsigned long len) > +{ > + struct mm_struct *mm = current->mm; > + unsigned long populate; > + > + down_write(&mm->mmap_sem); > + addr = do_mmap(NULL, addr, len, PROT_READ | PROT_WRITE, > + MAP_ANONYMOUS | MAP_PRIVATE, > + VM_DONTDUMP, 0, &populate, NULL); > + up_write(&mm->mmap_sem); > + > + if (populate) > + mm_populate(addr, populate); > + > + return addr; > +} Is this thing going to stay writable? Will any process with an IBT bitmap be able to disable protections by messing with the bitmap even if the lock-out mode is active? If so, would it perhaps make sense to forbid lock-out mode if an IBT bitmap is active, to make it clear that effective lock-out is impossible in that state?