From patchwork Sun Jan 20 23:39:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ahmed Abd El Mawgood X-Patchwork-Id: 10772537 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C747413BF for ; Sun, 20 Jan 2019 23:41:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B3D0B29CB9 for ; Sun, 20 Jan 2019 23:41:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A49EE29CB1; Sun, 20 Jan 2019 23:41:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id CA3C929CB1 for ; Sun, 20 Jan 2019 23:41:49 +0000 (UTC) Received: (qmail 28035 invoked by uid 550); 20 Jan 2019 23:41:29 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 27981 invoked from network); 20 Jan 2019 23:41:29 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mena-vt-edu.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=S5NVvoOgAgdZo8wmN11QDMw/7RKccGkERCz5dFRhs3I=; b=BdDxLGM1dmo0GQ+oCKzyAyW/P0iJv04mOqd5KTQC7iP2RnAShme5aGa8+eljPHQD5R 9UmVk6y1JS7PQ1SLhctISAowhr2r0ah2arCKYzHwcPIMBUI450ApL7L8k0GqISPqpioD UxI4E6VVT0p3jaEWvnULiJntikx2nuzcq1kWXgGHNp3baPwmjmhoIgkO7KuC6y813yud zvXyPUwiIOeN+gu9q5I5gKTTvdXNundyTG6tPOqDVEezJVRkPGQ+ow29IgF9qiH/lwsP cnQMPZD9X9blbOT7wc7fTFkK8bEjOwn4Wu1NeUueXVV60brUtY0RSwlBTv9y0t/tG3Nh GlJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=S5NVvoOgAgdZo8wmN11QDMw/7RKccGkERCz5dFRhs3I=; b=p4aNogBUdgsn0wjA8bdn6Bbzt6V6M5SBKHYXmfGNOdir6nad4h9SFyPk5sq/Fa64u8 xrHe0NEsqg3XHPv58w7Q2nawkNg52K830urmFVm7390wfifS9a42yPepyF4qpjCSTSWm 66SWsqRkE7zZCqNQm8ERhmYlYIuiL9NgyEFpSjEE6kbK7+xoQB3WmRDqIXCy6AcqiIuG 2EAi+n6cpB845NYRKBwJPxnvhO8oWifl8NxUXxsDUsZk/cyv/iwIKGy/NMJy69e3Y5qn J2g5P/OakL8C2ztH+GCs1+Ny7kbdGrrNAKNCg3j3XfubdLZTw+0+8ExNQsgCRFP83DuS dBjA== X-Gm-Message-State: AJcUukfsM2gr4R4QuOWaSRYLmO2+unwU9TrbAbfMTEqVgSb/RvT9y0JH Rr/aXNEvpf8RcAgqv1t3iM0uDw== X-Google-Smtp-Source: ALg8bN4kc5ObGqv6NoNo2QHDN6CCtu/mF6luBJqOGiE2VJKAp52yGhiJxl9kbMkt/ISKNQ1uC0ZBkw== X-Received: by 2002:a1c:7409:: with SMTP id p9mr23272500wmc.136.1548027677700; Sun, 20 Jan 2019 15:41:17 -0800 (PST) From: Ahmed Abd El Mawgood To: Paolo Bonzini , rkrcmar@redhat.com, Jonathan Corbet , Thomas Gleixner , Ingo Molnar , Borislav Petkov , hpa@zytor.com, x86@kernel.org, kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, ahmedsoliman0x666@gmail.com, ovich00@gmail.com, kernel-hardening@lists.openwall.com, nigel.edwards@hpe.com, Boris Lukashev , Igor Stoppa Cc: Ahmed Abd El Mawgood Subject: [RESEND PATCH V8 04/11] KVM: Document Memory ROE Date: Mon, 21 Jan 2019 01:39:33 +0200 Message-Id: <20190120233940.15282-5-ahmedsoliman@mena.vt.edu> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20190120233940.15282-1-ahmedsoliman@mena.vt.edu> References: <20190120233940.15282-1-ahmedsoliman@mena.vt.edu> MIME-Version: 1.0 X-Virus-Scanned: ClamAV using ClamSMTP ROE version documented here is implemented in the next 2 patches Signed-off-by: Ahmed Abd El Mawgood --- Documentation/virtual/kvm/hypercalls.txt | 40 ++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/Documentation/virtual/kvm/hypercalls.txt b/Documentation/virtual/kvm/hypercalls.txt index da24c138c8..a31f316ce6 100644 --- a/Documentation/virtual/kvm/hypercalls.txt +++ b/Documentation/virtual/kvm/hypercalls.txt @@ -141,3 +141,43 @@ a0 corresponds to the APIC ID in the third argument (a2), bit 1 corresponds to the APIC ID a2+1, and so on. Returns the number of CPUs to which the IPIs were delivered successfully. + +7. KVM_HC_ROE +---------------- +Architecture: x86 +Status: active +Purpose: Hypercall used to apply Read-Only Enforcement to guest memory and +registers +Usage 1: + a0: ROE_VERSION + +Returns non-signed number that represents the current version of ROE +implementation current version. + +Usage 2: + + a0: ROE_MPROTECT (requires version >= 1) + a1: Start address aligned to page boundary. + a2: Number of pages to be protected. + +This configuration lets a guest kernel have part of its read/write memory +converted into read-only. This action is irreversible. +Upon successful run, the number of pages protected is returned. + +Usage 3: + a0: ROE_MPROTECT_CHUNK (requires version >= 2) + a1: Start address aligned to page boundary. + a2: Number of bytes to be protected. +This configuration lets a guest kernel have part of its read/write memory +converted into read-only with bytes granularity. ROE_MPROTECT_CHUNK is +relatively slow compared to ROE_MPROTECT. This action is irreversible. +Upon successful run, the number of bytes protected is returned. + +Error codes: + -KVM_ENOSYS: system call being triggered from ring 3 or it is not + implemented. + -EINVAL: error based on given parameters. + +Notes: KVM_HC_ROE can not be triggered from guest Ring 3 (user mode). The +reason is that user mode malicious software can make use of it to enforce read +only protection on an arbitrary memory page thus crashing the kernel.