Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3401218ybi; Mon, 10 Jun 2019 09:37:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqx9jj5M2/duVALHskFLs/G6rqC1eZ53gfFKA/EgBNXVM/A6/HVtG3o9sXYnaIzZLqJCN9ZG X-Received: by 2002:a17:902:9a06:: with SMTP id v6mr53991902plp.71.1560184642172; Mon, 10 Jun 2019 09:37:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560184642; cv=none; d=google.com; s=arc-20160816; b=nJTQUaOglfS3yg8ikps/tkV6J4BVDzK1lo/fN/ySPZd7btiJfnJ4Uv7Lj8Rj8TyWsV lVWJriMQB5KplTO+dDb/l77nBwutprLpF248pTGzSeKOmP9nFP6xq2Jtw6u9mCGQ9U5r a4Umgk98iimkgb6RNJzy1K7SkVQcjgzaWZqBgfDv+Ywi91ZXYP9uJjQWQfoiEYjpUg3q vRhpEH1fgW3Sxm5iZPHLuUIUSojwkKEF8kR3IYhpBp/yzzrQI59XdqOIijh4znnEt4PN VCcwCX+5pGSSyB97jdDqPXHpbLW30bv96Mq9Iu2JdARRMASOyAb8TuP8PSR3waTNTfUD /XAg== 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=ZrrMMxf68rYUQrjsizo1vq0YK1i87Qr/FZ/0HM6pY08=; b=JSzmwqdX1sp+QVCNFAeRrVFgh3uDd9pO0nm7+D3U9/64ykqQFhwSFduW1MWrPSKKQJ O7A8SJEfXHZ3ICP9e5+kQyadnJoOaR7mL1NDpMDFkyZ7DmNbv2fg5+S3dRe8NQNdfhom ODjGNZLxVMlHc111NtpdL23vZui97zgNyP9t4NQGHzDTUfJ8QZOiv07jeFx++KDHNkv9 UXAQTbx67SJASVpCT8U+VQW4M7QncOVSbQJjePVL9ezsOnyJBZcQqOttcrltzSgO67P6 nuXci87yznOULseK4K0bOJrc1temuOuGhHNf3nwIr/40qelEAPRIze1uT3B+MWeZ9Uey 41Xg== 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 z18si9964111pga.321.2019.06.10.09.37.06; Mon, 10 Jun 2019 09:37:22 -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 S2404045AbfFJPzy (ORCPT + 99 others); Mon, 10 Jun 2019 11:55:54 -0400 Received: from mga12.intel.com ([192.55.52.136]:5731 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403791AbfFJPzx (ORCPT ); Mon, 10 Jun 2019 11:55:53 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jun 2019 08:55:52 -0700 X-ExtLoop1: 1 Received: from yyu32-desk1.sc.intel.com ([143.183.136.147]) by orsmga004.jf.intel.com with ESMTP; 10 Jun 2019 08:55:51 -0700 Message-ID: Subject: Re: [PATCH v7 03/14] x86/cet/ibt: Add IBT legacy code bitmap setup function From: Yu-cheng Yu To: Pavel Machek , Dave Hansen 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 , Andy Lutomirski , 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 , Randy Dunlap , "Ravi V. Shankar" , Vedvyas Shanbhogue , Dave Martin Date: Mon, 10 Jun 2019 08:47:45 -0700 In-Reply-To: <20190608205218.GA2359@xo-6d-61-c0.localdomain> 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> <20190608205218.GA2359@xo-6d-61-c0.localdomain> 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 Sat, 2019-06-08 at 22:52 +0200, Pavel Machek wrote: > Hi! > > > > I've no idea what the kernel should do; since you failed to answer the > > > question what happens when you point this to garbage. > > > > > > Does it then fault or what? > > > > Yeah, I think you'll fault with a rather mysterious CR2 value since > > you'll go look at the instruction that faulted and not see any > > references to the CR2 value. > > > > I think this new MSR probably needs to get included in oops output when > > CET is enabled. > > > > Why don't we require that a VMA be in place for the entire bitmap? > > Don't we need a "get" prctl function too in case something like a JIT is > > running and needs to find the location of this bitmap to set bits itself? > > > > Or, do we just go whole-hog and have the kernel manage the bitmap > > itself. Our interface here could be: > > > > prctl(PR_MARK_CODE_AS_LEGACY, start, size); > > > > and then have the kernel allocate and set the bitmap for those code > > locations. > > For the record, that sounds like a better interface than userspace knowing > about the bitmap formats... > Pavel Initially we implemented the bitmap that way. To manage the bitmap, every time the application issues a syscall for a .so it loads, and the kernel does copy_from_user() & copy_to_user() (or similar things). If a system has a few legacy .so files and every application does the same, it can take a long time to boot up. Yu-cheng