Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp1542244ima; Thu, 25 Oct 2018 00:28:04 -0700 (PDT) X-Google-Smtp-Source: AJdET5fVLQIbklogsSh9TRAKKuZWCzKdPQspU0FLTOtl1s3jolRq/M23Fd7RcRIXWe7D6fc2+fhG X-Received: by 2002:a17:902:ab8a:: with SMTP id f10-v6mr426564plr.203.1540452484590; Thu, 25 Oct 2018 00:28:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540452484; cv=none; d=google.com; s=arc-20160816; b=cKU9IUksBUjZJwzNpsse/C3psHYvarb9a8oYxGWQ4LnIWD3oTw9eUtKNC+8/udJ0KP wp/AKonAo78uSufGi10st2r32CVF6MY9DeePL52HyOkCHOqy+7W5LC5yKHHjKJ3Aaa6j LolGzhwb6ui4w7MZ+UTdyQwD3itHCDC3hiz1y0upvIY8PjtkR5bjl3eekF3XF5aEG9Os 1waypkyKfznTZ6tkOQsBjsxIOZJR5enWdNYhBhGESYrg4ZrXKK6mMRn3E3FA8wYMIWgm dLZ/nGQuEWVwldFfSvKAhAUvN522E1f5+NDAdrjxe27PQ2ygApeIiXeFDs784RR+ddOi HJoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=6hlF8k1uv+241/Kh1blG0aK0TAXnW6aw8IdpndDKD1Q=; b=m0L4xbuK6WbzupX3RReOW1PKpsFJl5JgPYvYJCduD9yoZjUzitEY4A7SIMArCnxjiY olGQHyyXMFsVc9RO+FUEUXGA+5DHWDGsYah8OaidH7FYzhbTfM59GsfgNdR+dKnmQ9+h pytf3mEI8YIZtX3Gx6YEGRMtfH3H9x/oO/LKQfwyY4vkstx6B+WCttra/5nK4r+qrt3W jRpcu7PVG+cQEaxRGSPW9Xg8He2gmQZPY9E6ohR71SC7dojX3dlSegqxoVtxDCEliMNh Om4aGVhHfB1DdeahbSblejVjngHwthIDE36ETxrPolzqFUvBBhQEe8xyQdZshy+wmpSQ xCZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=pHrhMemX; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m22-v6si7215167pgj.583.2018.10.25.00.27.48; Thu, 25 Oct 2018 00:28:04 -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=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=pHrhMemX; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726776AbeJYP5i (ORCPT + 99 others); Thu, 25 Oct 2018 11:57:38 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:39486 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726465AbeJYP5i (ORCPT ); Thu, 25 Oct 2018 11:57:38 -0400 Received: by mail-pf1-f196.google.com with SMTP id c25-v6so3741659pfe.6 for ; Thu, 25 Oct 2018 00:26:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=6hlF8k1uv+241/Kh1blG0aK0TAXnW6aw8IdpndDKD1Q=; b=pHrhMemXrw5hl+arL43raL/gNhgyjpJPx4EE7SKkgRX/TKfdLX6x902ncQzH6HsXkC /5afeTEhVEpHp2G838i0ZKdmMR/9DbSrch37E5BONTPPZE/qpi+diJs6Fm6Hl89TCOhp eLLffi7SUefsEn86J5S96obmIgn8XhujAXKD+/oBdnyQVCb6qiSDzRHQea5mTNPLYHgK O+doMdWVRdXvdCfK0CoqXT0iq28y9gNVRDFzIstt9JidPWkDFCMzaoLUB3POUX84tCfE ycQhudTd/LUR1jUQ/6LXdbNQ9+qaNnSSaOf+UYwYex/cVH5LSem8WRQR2DpAdTgsLdhZ onpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=6hlF8k1uv+241/Kh1blG0aK0TAXnW6aw8IdpndDKD1Q=; b=bIgX6Ozk3wwheFhNhWd/OvAoXF4w0PBubQlXzLiCulhl2IoKMxlfiiwQf5azTEAVGv kvYYHnf0dEdIbjsppTiyRh2C7mBvy2SQiKXHOc710JbzNwwgmX/iHtGQMmu0ATUEXbpd IVlJmwupT0AeqVhsdvqjLbP9ZivrBa0Mfsofq1lWeaP0VyHNSe9/x4GBSnsoDamxPVZz 3hFyjH9FQ2VnHskDI21hm+fRR9AOIpwF3wxKO07ykTrPWpmGX7+MUUWUj5sLPwaXwfd3 FQRhZ2LBRU8RVkdeSPzSxBHxg2SxnJvS8vqYHPpAWBQYVZt6CmZSW3lELJ6NMSYxPJ1H dR8w== X-Gm-Message-State: AGRZ1gIiulP/6BaG/KQP64L3CCYN9mJN3wyyZePugBfqbZWPHcRogyP5 +EOYqZnbNg604UeV1nXM3mG0yg== X-Received: by 2002:a63:fd09:: with SMTP id d9-v6mr445528pgh.164.1540452368266; Thu, 25 Oct 2018 00:26:08 -0700 (PDT) Received: from kshutemo-mobl1.localdomain ([192.55.54.41]) by smtp.gmail.com with ESMTPSA id k13-v6sm7677787pff.30.2018.10.25.00.26.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Oct 2018 00:26:07 -0700 (PDT) Received: by kshutemo-mobl1.localdomain (Postfix, from userid 1000) id 5CF7D300225; Thu, 25 Oct 2018 10:26:03 +0300 (+03) Date: Thu, 25 Oct 2018 10:26:03 +0300 From: "Kirill A. Shutemov" To: Andy Lutomirski Cc: "Kirill A. Shutemov" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Dave Hansen , Peter Zijlstra , X86 ML , Linux-MM , LKML Subject: Re: [PATCH 2/2] x86/ldt: Unmap PTEs for the slow before freeing LDT Message-ID: <20181025072602.cz3vy2zhzq2px7ik@kshutemo-mobl1> References: <20181023163157.41441-1-kirill.shutemov@linux.intel.com> <20181023163157.41441-3-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 24, 2018 at 11:49:17AM -0700, Andy Lutomirski wrote: > On Tue, Oct 23, 2018 at 9:32 AM Kirill A. Shutemov > wrote: > > > > modify_ldt(2) leaves old LDT mapped after we switch over to the new one. > > Memory for the old LDT gets freed and the pages can be re-used. > > > > Leaving the mapping in place can have security implications. The mapping > > is present in userspace copy of page tables and Meltdown-like attack can > > read these freed and possibly reused pages. > > Code looks okay. But: > > > - /* > > - * Did we already have the top level entry allocated? We can't > > - * use pgd_none() for this because it doens't do anything on > > - * 4-level page table kernels. > > - */ > > - pgd = pgd_offset(mm, LDT_BASE_ADDR); > > This looks like an unrelated cleanup. Can it be its own patch? Okay, I'll move it into a separate patch in v3. I'll some more time for comments on v2 before respin. -- Kirill A. Shutemov