From patchwork Sun Jan 6 19:23:38 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: 10749617 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 7671A14E5 for ; Sun, 6 Jan 2019 19:25:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B239288ED for ; Sun, 6 Jan 2019 19:25:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5E92F2891B; Sun, 6 Jan 2019 19:25:43 +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 6C2E4288ED for ; Sun, 6 Jan 2019 19:25:42 +0000 (UTC) Received: (qmail 21884 invoked by uid 550); 6 Jan 2019 19:25:28 -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 21821 invoked from network); 6 Jan 2019 19:25:28 -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=phMLnkSEvvtwWkL0fnAjRUATdL1D/Bn+8aLCy+6+BQz7JyW3U4Z0u9f2f4oRGDezjG /S/rcpFxh8NhvkwQJMYOOnaclL+09CZtCQmpFcrj6c3UWn4QrIIv5U5T57k/pBYeu8eG YAEjvCtKcwcmhQndgcG4nCaf56lNs33p/h1dSkIRTEoGSM5vYwrR0mLfiu017EyiD43s j/1vN7JKhz8LXpnNLsoNZrLjpRBxgFSEzIewi8wa/jLySA3V953esHQCqcxgxQWh3xkG xJu64Z5cjs5mWjxSM205ELqXpMrr6ioRzOHJp+To7SlshbPi9DXkufKwxRj/gFNiGeYM yLXA== 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=IGFsprWZxliS1io6oh4xDM/Or9FetHL+wqV7xrdVDItgww16woKleYBE0V1bv3xl2j LHVUvQRlX5f4zw1CyqlHYTjkpZaKCqq5lHPxSDs+SmNCEcZo9mHVPVoHCpC9HvCtM3u2 ukr+3TZlx5SBlMPAaT8VDWMhFqiJmlv23Gq8opm0r623bxgERfPfNIJBRNQwPSNQ7Scj SBPGwb4VxSAzrTCs1RgmwnFMTOzbeffCsO/5Lf6ykDO0UbwZBJxw2EPA9RutLhgu41Jq JYE0ngRLHVrn0ArG5Y9j9TB9V0ZF4XT3owP5fegK+e6L/Jqw76FJ+Q+LIKPOMF2tYdOJ K2Tw== X-Gm-Message-State: AA+aEWavTUJPG5GKxoPYu2zo7//foWIc100DYKjSkMJVeiDScsKlspkH QyZpHBu0iyCp46vZZDrf3AEQeQ== X-Google-Smtp-Source: AFSGD/VXv7SQ19vCkJLUFO247vGcMt/eFi87pi1euFVRwuQCrK4iDy1yR4RETyRcp8Ovq1HBaDnlKQ== X-Received: by 2002:aa7:d684:: with SMTP id d4mr51091724edr.59.1546802716691; Sun, 06 Jan 2019 11:25:16 -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: [PATCH V8 04/11] KVM: Document Memory ROE Date: Sun, 6 Jan 2019 21:23:38 +0200 Message-Id: <20190106192345.13578-5-ahmedsoliman@mena.vt.edu> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20190106192345.13578-1-ahmedsoliman@mena.vt.edu> References: <20190106192345.13578-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.