Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1205976ybi; Fri, 14 Jun 2019 10:23:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqxVZ0dfFW2Z2atgcExvb5vgJs80J6DZS7quvDzwqvzyhNxFwqOSKvFqfHLynfiUgFA38nBq X-Received: by 2002:a62:1652:: with SMTP id 79mr36491870pfw.20.1560533007324; Fri, 14 Jun 2019 10:23:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560533007; cv=none; d=google.com; s=arc-20160816; b=pcc55M6Kn0LtyXTTRNZoSC8kT7Tp4UT/PO0H3XfM5fTlDkIwBlvlM0KHcJVuLGz0op m6oaR17sE5UgQ5ZwKaFiZdXLzE9ESJkLTQa17kr4SmIPAz8Bf63OxOkDuDG8wROAahJy Ks3uv1dtAkXdANY1lbGPosOlY/g652vo0pAVrXSHiNw3jGHHDHfqaRg4ZprjFJYiqtS6 ixnudFGrgmWKr4dKIfQaphiXGrQLIU1GSUu2l9h2FtLFpJfPzyVa2ko+J3007zPRmkYQ QkT3/l/dtQ4oQPAtN9NunCqWEwb035/yZ+GazsT5WnMJr0X46Uru2EoKWma78ZsAAEnF fHDw== 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=RlatM2SrDmbHde069o7uKlxCxy4yOVtfrXmbT2isUz4=; b=s1ywh6nlT425DIiTCjRfw5rKMULoa15AMiI7ZDt6Vnt1fJMuWLlCH9ysNJ10UDUPBl XLlogR9GNWYDCfwse1MsyKwQz5nfIqMoeB3ELpYDagtAB9cixxwJ2Q/ysQ/EmoW7swZQ pxYNmLDYYZW3QsPoL7iitJnHBw7CVeULjchL9m3uY+Qnh1nNKVvcOS3GjBM//ABESGxh +J34k/GDhIFAD67aKNK+wbvcN3nzqiz7lBp9WcMqxsHsvxDIeU1LWXJTaSpHPH+Rvlzb eWVilrEWP5jhfKgxxviDXrVlzk2cRnoqHQ+PCUuh/T63PEdnsnieuUv+4tTDsFPoARDS fpBA== 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 w21si2977323pff.263.2019.06.14.10.23.12; Fri, 14 Jun 2019 10:23:27 -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 S1726490AbfFNRVa (ORCPT + 99 others); Fri, 14 Jun 2019 13:21:30 -0400 Received: from mga04.intel.com ([192.55.52.120]:22039 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725837AbfFNRVa (ORCPT ); Fri, 14 Jun 2019 13:21:30 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Jun 2019 10:21:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,373,1557212400"; d="scan'208";a="185026928" Received: from yyu32-desk1.sc.intel.com ([10.144.153.205]) by fmsmga002.fm.intel.com with ESMTP; 14 Jun 2019 10:21:29 -0700 Message-ID: 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, 14 Jun 2019 10:13:27 -0700 In-Reply-To: <5ddf59e2-c701-3741-eaa1-f63ee741ea55@intel.com> 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> <5ddf59e2-c701-3741-eaa1-f63ee741ea55@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-14 at 09:13 -0700, Dave Hansen wrote: > On 6/14/19 8:25 AM, Yu-cheng Yu wrote: > > On Mon, 2019-06-10 at 15:59 -0700, Dave Hansen wrote: > > > On 6/10/19 3:40 PM, Yu-cheng Yu wrote: > > > > Ok, we will go back to do_mmap() with MAP_PRIVATE, MAP_NORESERVE and > > > > VM_DONTDUMP. The bitmap will cover only 48-bit address space. > > > > > > Could you make sure to discuss the downsides of only doing a 48-bit > > > address space? > > > > The downside is that we cannot load legacy lib's above 48-bit address space, > > but > > currently ld-linux does not do that. Should ld-linux do that in the future, > > dlopen() fails. Considering CRIU migration, we probably need to do this > > anyway? > > Again, I was thinking about JITs. Please remember that not all code in > the system is from files on the disk. Please. We need to be really, > really sure that we don't addle this implementation by being narrow > minded about this. > > Please don't forget about JITs. > > > > What are the reasons behind and implications of VM_DONTDUMP? > > > > The bitmap is very big. > > Really? It's actually, what, 8*4096=32k, so 1/32,768th of the size of > the libraries legacy libraries you load? Do our crash dumps really not > know how to represent or deal with sparse mappings? Ok, even the core dump is not physically big, its size still looks odd, right? Could this also affect how much time for GDB to load it. We will only mmap the bitmap when the first time the bitmap prctl is called. I have a related question: Do we allow the application to read the bitmap, or any fault from the application on bitmap pages? We populate a page only when bits are set from a prctl. Any other fault means either the application tries to find out an address range's status or it executes legacy code that has not been marked in the bitmap. > > > In GDB, it should be easy to tell why a control-protection fault occurred > > without the bitmap. > > How about why one didn't happen? We'll dump the bitmap if it is allocated. Yu-cheng