Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2848886imu; Sun, 6 Jan 2019 11:29:18 -0800 (PST) X-Google-Smtp-Source: ALg8bN7sFr0Eeqmi7tjeZB3vjxODTVY0LYoUZ2bMjZBc7H7KkOHlN30vpY8WNYT8TFK+cYdH5OAq X-Received: by 2002:a17:902:32c3:: with SMTP id z61mr58495487plb.114.1546802958549; Sun, 06 Jan 2019 11:29:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546802958; cv=none; d=google.com; s=arc-20160816; b=XifigbgpkfLIVj59OyUyfIPX5oOEjqKPfodxcpymiQt7mzgc3+KdHdt4gUN4NUQRG0 /aDbxZ1tZxPRLDfgnHUs3Ssg7FSKZOOMw1RaK3/XmbHLEW4bGQXZP8HIWfEmlfM8Rsgi eUgaMskkWJPcb/8I3IRH6Z8FzsqApvfk55ZJE8gT8pCZO6TPy2s/f6hazpEIdN22zBrE pmp+9Gta4aOuCsCZgilB9tBlDHi1vt0evykE27uGx+vhVxbbrGKDjXIHWVh6Sdw28r1Y IK2oZmGdEKZQv5+U9tKdNRMCbTPbmtkYckjNMXVHUY9R3DJePpVc1V1WDzvZblFyY0c2 3tPA== 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:message-id:date:subject:cc:to:from :dkim-signature; bh=S5NVvoOgAgdZo8wmN11QDMw/7RKccGkERCz5dFRhs3I=; b=D2M+Gnx1dWbaskVniZ7VkNGGZ//pnoFI6GOkbOQ4aFXlpAYcFd/1nWP/sHUzM0r/bx D4V0BVMjyVp11QYytOKqvja+HUUcCvOMqon81m5fc7n3xA5YfaAVNxZy/vxziHxnd5dX N1hWTHcEt0UrNZimU8rjmmrd0gNCIzlaiWota91vqmsoSMmXLf9XF+BqLiNw8XJE6BUu ZEAeodk4V08EgM5AozWhczBqDApGeMp6t1DxkL8qR2rpTq5M7ERLghkNhrdwukeD4KXN Xtaztq9fk5QJnyDiqqGbHKhTq7MZnYOur/ZaV6RXGHv3B1CKe5GgOx3yvoKEe0j+iAQy VHQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mena-vt-edu.20150623.gappssmtp.com header.s=20150623 header.b=phMLnkSE; 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=vt.edu Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g6si4945998pgn.57.2019.01.06.11.29.03; Sun, 06 Jan 2019 11:29:18 -0800 (PST) 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; dkim=pass header.i=@mena-vt-edu.20150623.gappssmtp.com header.s=20150623 header.b=phMLnkSE; 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=vt.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726382AbfAFTZV (ORCPT + 99 others); Sun, 6 Jan 2019 14:25:21 -0500 Received: from mail-ed1-f68.google.com ([209.85.208.68]:39189 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726316AbfAFTZS (ORCPT ); Sun, 6 Jan 2019 14:25:18 -0500 Received: by mail-ed1-f68.google.com with SMTP id b14so36026501edt.6 for ; Sun, 06 Jan 2019 11:25:17 -0800 (PST) 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=KJYNm2IPqxOza4NCNSLIiCmpYvUOzcg3dn7NP44z4Yo09rMSEoBkcW6bKw4qWS+lYW Os01T0RGhYB56TSmznbORZ9kHUtjWg5eXTZCcMQlfQXYiP8GNI0zdVsiHV5Laq99w133 /uQJDLAWUlRGnB8IaS2ixNQVYfcotdMzKaSolyJ53Il3h2Ilf670FMQqpx7hBC4Ci8Za w2NQit7DgHgcGwf6Yaa31cVAcc9DaCK1quqRkTCNUXUeOcVcd4pdqI/wNGnovylt8ZOD 6IaxzlfG9BS13fS7GyDGKwbG8llF5DnRzstQdiilEfNvsC2OTaiyTTpShNd230xDNSAa 9c0g== X-Gm-Message-State: AA+aEWb74UDZdzRTkgBC0Aodg3xBLEyOZJ11mbra7JmPKo6dc270wB6W w7VdUB8ccOVm0lFnRMcbU+2aGw== X-Received: by 2002:aa7:d684:: with SMTP id d4mr51091724edr.59.1546802716691; Sun, 06 Jan 2019 11:25:16 -0800 (PST) Received: from localhost.localdomain ([156.212.65.252]) by smtp.gmail.com with ESMTPSA id b46sm29994035edd.94.2019.01.06.11.25.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); 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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. -- 2.19.2