Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1060721imm; Fri, 12 Oct 2018 11:03:46 -0700 (PDT) X-Google-Smtp-Source: ACcGV60TzvDNihdz8Z03738P+MYtHkMHsjVcgDMklzMW0qF1WzzJpq+MLEyrz1kHu8pOt4u1TX2l X-Received: by 2002:a63:d556:: with SMTP id v22-v6mr6155277pgi.357.1539367426781; Fri, 12 Oct 2018 11:03:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539367426; cv=none; d=google.com; s=arc-20160816; b=Yuc2NKetceKOBZO7CvITaZeL42Pd6O9Tk8bGzoI+1YdL52wWUUtYdBv6UP6qr5C0LF uKysttCTEvATBS4M+InwOspGIYckN2EznZkSyGhtQNxkiNugTAo5FWqhmvLEsAMWQJ2j h8J6mSzduqUhs7oZlGa5lkHjVfmJMW5RjMoSH0oSf8f1hnvDWTmONTXUc26FnPlhBG/s UqmiIHFSCxW+E6nGNzzguoxBQQm3jyFEtU91cZeFF5HVjJxb2/99UvtPPWYSPs/aB/jH +YJpFph1HMxoyxk7UIql4F/2v/rAs9KbkfX9xc5LN7KBh6C++k4YviMp59C8xYW7D9z7 Kv0w== 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=iTTTeHz/vHctBgx8nRhvW1qOF3vb9vMIYjrzQMyg5VU=; b=zEbW1wb61ClO3ry390T/2y9/TChh2sjMCLD/d7SBiAlRAJwtYhjFH3+2cMxfoX4z76 A5b+IaPWJZ7bOojizmBVi2HYzIZcASbqPK4ZB3ioCHGiJZ17sYm4XZsueAXE0ow6WsG3 YmijAvgnl6aorHK+dBEAWNnV90etwsPPRROTxc78btGlt/7IWWMlR0tGbNyvl3BD44Hq t7iSshvicXp0cJH0+NLeMPUJlgh33RM3mCn3lSWazC5XgTOceHnimDmBrhOtkhz2CHI4 atRLjNnWKst3dUHkOzmzn62jlo2oLn5HJqWNrAxHIutWcpFG3hzE5ykvAaetttrITCCu m5VQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=a8E7Pu2C; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 31-v6si1997031plc.423.2018.10.12.11.03.31; Fri, 12 Oct 2018 11:03:46 -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=@kernel.org header.s=default header.b=a8E7Pu2C; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727633AbeJMBgN (ORCPT + 99 others); Fri, 12 Oct 2018 21:36:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:43156 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726526AbeJMBgN (ORCPT ); Fri, 12 Oct 2018 21:36:13 -0400 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (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 D9C832151C for ; Fri, 12 Oct 2018 18:02:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539367352; bh=gh/wgzZhCN63Ik/wl41gD6zk514cHTisZSs6EW7mBuc=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=a8E7Pu2CCUQ619qu7hDoHW7d7y6OrLPh5THtwZr1sJgujlE4TS2tyRQKtRBwJUt/A JDZ0r0JtrrwMChMGc1umhz0+D3yWjxDtuHU+mziZ92JadEP5xyqoHHyFVkM1uo57H5 eT7tvOSlXZnsRQCY2SH2x4qKFUdnZ9YRiQrlDM1w= Received: by mail-wr1-f53.google.com with SMTP id e4-v6so14363600wrs.0 for ; Fri, 12 Oct 2018 11:02:31 -0700 (PDT) X-Gm-Message-State: ABuFfojSQC74fg+u/mXl1n/LXlurj8ArFC/ODdwyNs5ekktVO546AD+C /a1oVZrCxoqXkVwi+go78q2gM7RzKN4Pkz9ll2DD/w== X-Received: by 2002:adf:e387:: with SMTP id e7-v6mr6223878wrm.94.1539367350260; Fri, 12 Oct 2018 11:02:30 -0700 (PDT) MIME-Version: 1.0 References: <20181004140547.13014-1-bigeasy@linutronix.de> <20181004140547.13014-6-bigeasy@linutronix.de> <39e0a55f-4920-cfde-9bef-09c51109d211@linux.intel.com> In-Reply-To: <39e0a55f-4920-cfde-9bef-09c51109d211@linux.intel.com> From: Andy Lutomirski Date: Fri, 12 Oct 2018 11:02:18 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 05/11] x86/fpu: set PKRU state for kernel threads To: Dave Hansen Cc: Sebastian Andrzej Siewior , LKML , X86 ML , Andrew Lutomirski , Paolo Bonzini , Radim Krcmar , kvm list , "Jason A. Donenfeld" , Rik van Riel 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 Fri, Oct 12, 2018 at 10:54 AM Dave Hansen wrote: > > On 10/04/2018 07:05 AM, Sebastian Andrzej Siewior wrote: > > The PKRU value is not set for kernel threads because they do not have > > the ->initialized value set. As a result the kernel thread has a random > > PKRU value set which it inherits from the previous task. > > It has been suggested by Paolo Bonzini to set it for kernel threads, too > > because it might be a fix. > > I *think* this is not required because the kernel threads don't copy > > data to/from userland and don't have access to any userspace mm in > > general. > > However there is this use_mm(). If we gain a mm by use_mm() we don't > > have a matching PKRU value because those are per thread. It has been > > suggested to use 0 as the PKRU value but this would bypass PKRU. > > > > Set the initial (default) PKRU value for kernel threads. > > We might want to do this for cleanliness reasons... Maybe. > > But this *should* have no practical effects. Kernel threads have no > real 'mm' and no user pages. They should not have do access to user > mappings. Protection keys *only* apply to user mappings. Thus, > logically, they should never be affected by PKRU values. > > So I'm kinda missing the point of the patch. use_mm().