Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp601840ybi; Fri, 7 Jun 2019 13:26:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqyy/bVQgg0xBIK3y3sOEPAuKUg8IzaryG6KvPgevaf68Vu0uzZZCi1OhwzgS/dSbF5mrivz X-Received: by 2002:a62:ee04:: with SMTP id e4mr58597147pfi.232.1559939214743; Fri, 07 Jun 2019 13:26:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559939214; cv=none; d=google.com; s=arc-20160816; b=WtK6bPD3bOmu96pNroFCH4T0JFz22gaYB+ra0ynn9QihTG0KKZgKdKIWtuzEpZAPp5 PynwWqxUet8f9cXTZ/bLsGUObmllO0oB7tTbfZGb+XyiQ6zOgL1OjLTjG9FSq3Ahlxiu 1p+mCy9GaBS1RkNz+0CGArP8xhQ0Or3w64qzdjz8Kzr5TTcGB5MzAVqTPD+r5I9UXEXB 5c/ip+ri2A+ssuNjmf0jVgWIxE/eAMpktnbds6w3iZw+yYsKBANUaRUP7ZN4K5q+9FBJ DBQYkl7dj6NJF5hl8NIhz30Xt+KLJII2i80OAR/syVthyJqGBUfvtMViMGWXJnBw6Ws1 LrVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=AdroJ+jjl9mLSvX2fCDMcD9Uq4Wl0tRfoxZHbjn62X4=; b=pIUkOvyjtw/VsTUGN6sizY+cUiXychgNzreCQFauWwCeqNlbiqNdNkp3eWuvFXXDBG Bgcvdn351+qITT7qnJanRRztCYGcxkkNNgd+V9sBc+TP7WNud720nVEhJTiLJh2HDGgg p954NOzt1W0qzGC61ledKl3uq0PVEzQQXSCp2skyjmhpKJKtg+gdXUW4kx9BbqvezlXD wn6gpO6NZRdTkzC+GEsfe9Z6wOLXnBLm3JcqpprxMfDIwqCCzaOST2y2TlJ6XoHtaLyT 9+mg4UlvnU0Xlx9TY//avjkfi6G2gXYWYei197DEv8vLHcxbHa+YU+kGN5Udi5+rrSHj PP9A== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t188si2986349pgc.228.2019.06.07.13.26.38; Fri, 07 Jun 2019 13:26:54 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730334AbfFGUOP (ORCPT + 99 others); Fri, 7 Jun 2019 16:14:15 -0400 Received: from mga11.intel.com ([192.55.52.93]:41728 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729353AbfFGUOO (ORCPT ); Fri, 7 Jun 2019 16:14:14 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Jun 2019 13:14:14 -0700 X-ExtLoop1: 1 Received: from yyu32-desk1.sc.intel.com ([143.183.136.147]) by orsmga002.jf.intel.com with ESMTP; 07 Jun 2019 13:14:12 -0700 Message-ID: <0e505563f7dae3849b57fb327f578f41b760b6f7.camel@intel.com> Subject: Re: [PATCH v7 03/14] x86/cet/ibt: Add IBT legacy code bitmap setup function From: Yu-cheng Yu To: Dave Hansen , Andy Lutomirski Cc: 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 Date: Fri, 07 Jun 2019 13:06:10 -0700 In-Reply-To: <4b448cde-ee4e-1c95-0f7f-4fe694be7db6@intel.com> References: <20190606200926.4029-1-yu-cheng.yu@intel.com> <20190606200926.4029-4-yu-cheng.yu@intel.com> <20190607080832.GT3419@hirez.programming.kicks-ass.net> <20190607174336.GM3436@hirez.programming.kicks-ass.net> <34E0D316-552A-401C-ABAA-5584B5BC98C5@amacapital.net> <7e0b97bf1fbe6ff20653a8e4e147c6285cc5552d.camel@intel.com> <4b448cde-ee4e-1c95-0f7f-4fe694be7db6@intel.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.1-2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2019-06-07 at 13:00 -0700, Dave Hansen wrote: > On 6/7/19 12:49 PM, Yu-cheng Yu wrote: > > > > > > This also gives us an excellent opportunity to make it read-only as seen > > > from > > > userspace to prevent exploits from just poking it full of ones before > > > redirecting execution. > > > > GLIBC sets bits only for legacy code, and then makes the bitmap read- > > only. That > > avoids most issues: > > > > To populate bitmap pages, mprotect() is required. > > Reading zero bitmap pages would not waste more physical memory, right? > > Huh, how does glibc know about all possible past and future legacy code > in the application? When dlopen() gets a legacy binary and the policy allows that, it will manage the bitmap: If a bitmap has not been created, create one. Set bits for the legacy code being loaded. Yu-cheng