Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3824363ybi; Mon, 10 Jun 2019 17:59:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqyYVredL5su42A57UvkaQptcc6rQz11m650tXA8uTMGF/Vtgesg0yk+6m6uBcjW8jzwV5f+ X-Received: by 2002:a62:bd03:: with SMTP id a3mr20269021pff.209.1560214772087; Mon, 10 Jun 2019 17:59:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560214772; cv=none; d=google.com; s=arc-20160816; b=bwlGtzqlZBC/6nNuxvc1EAs9GYr+8B/ZroAEMpuyHTVjMhorBO5BJvjEd8dxCYfOx6 IZO25YGw/JI3cO2QRhWcnfR8nXoczP6Aos7GLvxXYw+RCss09MT/WpnGJbapRUFz95j0 3a8KAChADUhY4JoI3pAA7gHkseRPcl9iG0W+aMpMyalO2FkvTMJNcAf1rijIEjLlNJCP jmMbmNfzjuvqvgm8XDFAN+U8je0T+kVbv783pJQxu+ZZZ/E3ri8vrwwf8hMVIxouWgjW abn+10QTG3gL3h/3muhGcyJoWIPe/hmINC3bML5RX5mPiQdvtrXia14cgw9fK9Mg95Mq 21xQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:in-reply-to:cc:references:message-id :date:subject:mime-version:from:content-transfer-encoding :dkim-signature; bh=Qm0kPO1uAJ3z1V1j+us2fMRdl6WcfjHPQXtYwKhWHOw=; b=IYhh3qcgLih5VfT9cREYPBtgGKsv2bUkJcjJ2QNQVReijIwGolHFV1ySrIBAYIhOga rEs5O1L/ewdYseohbZB4ehYiZ1lmXsimpM6YqYpS1ofCLRJBlxhuJgEATVrnfsIbncdF 89lc+KUkgvG8PbDOxhwP1Fd9KZA2Pcy81lsO5G1PPKBB+D9dz2vNMtfVAiWhcyCuC1+8 YG/v2jWhM6V8JNAx6MnyEPWOFrwZeBvtLYkhyosXj8qhZNY/6CMZxoH9UvjwTZrA4Op0 FSRQPA5jaSHbzHRJN7JQQJj5hHqgVpQKyZyKqtzhhKZxm302c3eIr+VMAAdZI8INr6tQ eg6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=BVKkouMq; 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 h127si5615964pfe.44.2019.06.10.17.59.17; Mon, 10 Jun 2019 17:59:32 -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=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=BVKkouMq; 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 S2390287AbfFKA6u (ORCPT + 99 others); Mon, 10 Jun 2019 20:58:50 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:44462 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389168AbfFKA6u (ORCPT ); Mon, 10 Jun 2019 20:58:50 -0400 Received: by mail-pl1-f196.google.com with SMTP id t7so1709063plr.11 for ; Mon, 10 Jun 2019 17:58:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=Qm0kPO1uAJ3z1V1j+us2fMRdl6WcfjHPQXtYwKhWHOw=; b=BVKkouMqizWMIp86sUnwYUIJSyRkM2G6Pe8zlryowrNTb9LFpBf1If0yNMMHqWfp0F aqvarMEwPlbihNns5+AGPXDpt1we54kMWHty1e5OgyiGDIetI6BtOAAyQFCAS3LvpXtt uzvSXO7fOA1xexLVdCqI1QOPZpKtT4lZVG077v5++zFnzHYcC3ZBSAwwFeHo9MexBqAQ 2Hhjnsrz/HjTu2HPnoa50Wg160y84xDJPkQyFDks7AOcPsvsPIeb4DvMn/Muc/w88IXq lpM8C4dM7VF7To/MMIkC6rQztkpMZWTvQCV7twCTJ1I4ecG5LMDnzxqJ26KNPiGwgDTp +SDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=Qm0kPO1uAJ3z1V1j+us2fMRdl6WcfjHPQXtYwKhWHOw=; b=qyukW9uNCnXyDz55ElFFfcKVcPX0EU8AWCTeUqJVbrT0hFcW4CLjyD3v7HRbszCnws 8FTv49s0+m4N0I6UL55VRsIg1Q74r3PpZTvc3YFejapHAuAFDPScOYScAnqcjmjZ3IO7 ABlrATu+g5UYahN2qZVD7vzDZvup8sHEtaNrv/prxlTAVxvH/QzR9Ze1bGiw9AGrrLk+ G8q49FukXogekOlaEdavdw2kfc/hSGNRiDpLnr8e/swf6JttcHjb6MOuePo4JsVqvCe6 ZFH8Ker/nivexMCbHf2nVbN+0VvCcYkQl2THnSu5+VapVgKtVpcruDKrFuBIiK93HBaB 9zJg== X-Gm-Message-State: APjAAAWSUCsgRTfscnj2SXP3Xzz3if3geGFpPd+We5Fu2uF1gSRWpUUh d+SDAbsuH/5UOJsJVNCaQAWJ4A== X-Received: by 2002:a17:902:42e2:: with SMTP id h89mr70909928pld.271.1560214729538; Mon, 10 Jun 2019 17:58:49 -0700 (PDT) Received: from [10.228.61.2] (151.sub-97-41-129.myvzw.com. [97.41.129.151]) by smtp.gmail.com with ESMTPSA id h19sm11894263pfn.79.2019.06.10.17.58.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Jun 2019 17:58:46 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Andy Lutomirski Mime-Version: 1.0 (1.0) Subject: Re: [PATCH v7 03/14] x86/cet/ibt: Add IBT legacy code bitmap setup function Date: Mon, 10 Jun 2019 17:36:03 -0700 Message-Id: <7E931FED-B39D-4C05-8B78-D8CF2F0EF9FC@amacapital.net> References: <20190606200926.4029-1-yu-cheng.yu@intel.com> <20190607174336.GM3436@hirez.programming.kicks-ass.net> <34E0D316-552A-401C-ABAA-5584B5BC98C5@amacapital.net> <7e0b97bf1fbe6ff20653a8e4e147c6285cc5552d.camel@intel.com> <25281DB3-FCE4-40C2-BADB-B3B05C5F8DD3@amacapital.net> <3f19582d-78b1-5849-ffd0-53e8ca747c0d@intel.com> <5aa98999b1343f34828414b74261201886ec4591.camel@intel.com> <0665416d-9999-b394-df17-f2a5e1408130@intel.com> <5c8727dde9653402eea97bfdd030c479d1e8dd99.camel@intel.com> <328275c9b43c06809c9937c83d25126a6e3efcbd.camel@intel.com> <92e56b28-0cd4-e3f4-867b-639d9b98b86c@intel.com> <1b961c71d30e31ecb22da2c5401b1a81cb802d86.camel@intel.com> Cc: Yu-cheng Yu , Peter Zijlstra , x86@kernel.org, "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, Arnd Bergmann , Balbir Singh , Borislav Petkov , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , "H.J. Lu" , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Randy Dunlap , "Ravi V. Shankar" , Vedvyas Shanbhogue , Dave Martin In-Reply-To: To: Dave Hansen X-Mailer: iPhone Mail (16F203) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Jun 10, 2019, at 5:08 PM, Dave Hansen wrote: >=20 >> On 6/10/19 4:54 PM, Andy Lutomirski wrote: >> Another benefit of kernel management: we could plausibly auto-clear >> the bits corresponding to munmapped regions. Is this worth it? >=20 > I did it for MPX. I think I even went to the trouble of zapping the > whole pages that got unused. >=20 > But, MPX tables took 80% of the address space, worst-case. This takes > 0.003% :) The only case it would really matter would be a task was > long-running, used legacy executables/JITs, and was mapping/unmapping > text all over the address space. That seems rather unlikely. Every wasted page still costs 4K plus page table overhead. The worst case i= s a JIT that doesn=E2=80=99t clean up and leaks legacy bitmap memory all ove= r. We can blame the JIT, but the actual attribution could be complicated. It also matters when you unmap one thing, map something else, and are sad wh= en the legacy bits are still set. Admittedly, it=E2=80=99s a bit hard to imagine the exploit that takes advant= age of this.=