From patchwork Fri Apr 8 20:03:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalesh Singh X-Patchwork-Id: 12807166 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3C689C4332F for ; Fri, 8 Apr 2022 20:05:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:From:Subject:Mime-Version:Message-Id :Date:Reply-To:To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=xV8V0Bwk85OT9NkdVSuHVM/95R0j2JaDC8Karr+KJNU=; b=O4Zcytqn+hTDHl lN7sK+m8GmHQQY+nZgFUiFntNeJSYJi/s5BDRVhbBIZQLBLh2YstTYrTkCb58UJUTQYZen5N68WWO 68Kf61ws0rK2h9syTxjLKRnrbhT+cWBUMSMvGJ8pWhDZOt1eZfgvgqpa6yhk6hCjzcpQPjpxUfLHE d0NC/KU723rPaSSn3oFbydO5tGO40JrWqoJf2ue2Y90YEcsnJnxvaS7u2q0re15DQZsF+yqyP86Kw AjBSQY8OhdyBnQUYB//7hHwT+bBB36hDcr76BNYJL9cr70KRmRTiag9kjvv0/W9SJFJo9eqRiVyJv D9qnA09va150nyU9r8aQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ncups-0018Bj-Pu; Fri, 08 Apr 2022 20:04:00 +0000 Received: from mail-pf1-x44a.google.com ([2607:f8b0:4864:20::44a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ncupp-0018BB-DN for linux-arm-kernel@lists.infradead.org; Fri, 08 Apr 2022 20:03:58 +0000 Received: by mail-pf1-x44a.google.com with SMTP id p187-20020a6229c4000000b004fb57adf76fso5705175pfp.2 for ; Fri, 08 Apr 2022 13:03:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:message-id:mime-version:subject:from:cc; bh=uL4T8x7PjGlhNU0AUZ082p/RK2qsDuZaw90ql6pSgAk=; b=OVGsPQrYXwHuNe31ITOhye0y5tdZdj03XTVkCx5cOcyhrwhRfEDyKUSS1JIVjLaN/o XqeiY7Ly5Fd4YffB7xzCjxD+MsinUrXhkz1IX7fbJ7YF7DZo8EhlMIDvzWl16oEAi5Tg 5GF7VQRqe3GCtryeQKKxcwfbA5cFkUyRL2b2TauXhZGh+Gkt1Q31YZXFgd0l9bDLJMaQ /SPTq1Zz+YJuAWJM4LZCaf65GbiCLYw4hygxl3QvtvGA7UUcsg5mrpvZYjihEgGjWbPC qUbD6DyMRsBchsR35e+T7yn5MH9/TED3jrkIjqCb4v/veg9ZrDip6Ui6iUFahq+zA8X9 8s2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:mime-version:subject:from:cc; bh=uL4T8x7PjGlhNU0AUZ082p/RK2qsDuZaw90ql6pSgAk=; b=2RMUurrcUVtyyWOH54ck/k8LT8wHGkqIBYCqzW+BpuSry07/oEVE+C09CSHN5m0h1R wDc/G9UNWw8R9LX5/sSbDbfaEGEEf4fitZQSzxoL0eAwHBO2Co+laum4xPRMNX7P51Tv 3jTYkP+0q/yegmU09K8QnB7Z+et1ncq76wwENuky6c6Ug/CxeqXwWYBUOLr4IfvMglb6 1TA3lMxD37j3fKA5G5BFLAEVTjeFM3puFDjB8QqHtwvGGOy+7FGG/ViqH56lfhleP24t GlMg3YfNEkDJ3V75lAVYtRgj1O5Cxsnma+pd9cNYfiZEnUM/C82vzGU4Z5K+2rAuaTUb o3sQ== X-Gm-Message-State: AOAM531rnm27fnkipfDmAe+8lQ7mopmmNarHtpK74hsOn40P1CHeOEBG 0bhpn5gTrWzxNoen4UvwOekUdqVGk2ulvdzbPw== X-Google-Smtp-Source: ABdhPJyiunI3puMJj1X39Qi2X/Kl8I3Sm0IuMT8hRzbT/V7JmfxVLYcFkeHruDPMJTX5Vy4HLKMcgBC/SSaYRfJ+Bg== X-Received: from kaleshsingh.mtv.corp.google.com ([2620:15c:211:200:f0ed:c8a:dab7:ecc2]) (user=kaleshsingh job=sendgmr) by 2002:a17:903:216:b0:156:1e8d:a81 with SMTP id r22-20020a170903021600b001561e8d0a81mr20473765plh.140.1649448234615; Fri, 08 Apr 2022 13:03:54 -0700 (PDT) Date: Fri, 8 Apr 2022 13:03:23 -0700 Message-Id: <20220408200349.1529080-1-kaleshsingh@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.35.1.1178.g4f1659d476-goog Subject: [PATCH v7 0/6] KVM: arm64: Hypervisor stack enhancements From: Kalesh Singh Cc: will@kernel.org, maz@kernel.org, qperret@google.com, tabba@google.com, surenb@google.com, kernel-team@android.com, Kalesh Singh , James Morse , Alexandru Elisei , Suzuki K Poulose , Catalin Marinas , Andrew Walbran , Mark Rutland , Andrew Jones , Ard Biesheuvel , Zenghui Yu , Nick Desaulniers , Changbin Du , Masahiro Yamada , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220408_130357_493155_2CFA78F5 X-CRM114-Status: GOOD ( 11.16 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi all, This is v7 of the nVHE hypervisor stack enhancements. This version is based on 5.18-rc1 and drops the hypervisor stack unwinding and overflow-stack patches. These require further discussion and will be resent separately. Previous versions can be found at: v6: https://lore.kernel.org/r/20220314200148.2695206-1-kaleshsingh@google.com/ v5: https://lore.kernel.org/r/20220307184935.1704614-1-kaleshsingh@google.com/ v4: https://lore.kernel.org/r/20220225033548.1912117-1-kaleshsingh@google.com/ v3: https://lore.kernel.org/r/20220224051439.640768-1-kaleshsingh@google.com/ v2: https://lore.kernel.org/r/20220222165212.2005066-1-kaleshsingh@google.com/ v1: https://lore.kernel.org/r/20220210224220.4076151-1-kaleshsingh@google.com/ Thanks, Kalesh ----- This series is based on 5.18-rc1 and adds stack guard pages to nVHE and pKVM hypervisor; and symbolization of hypervisor addresses. The guard page stack overflow detection is based on the technique used by arm64 VMAP_STACK. i.e. the stack is aligned such that the 'stack shift' bit of any valid SP is 1. The 'stack shift' bit can be tested in the exception entry to detect overflow without corrupting GPRs. Kalesh Singh (6): KVM: arm64: Introduce hyp_alloc_private_va_range() KVM: arm64: Introduce pkvm_alloc_private_va_range() KVM: arm64: Add guard pages for KVM nVHE hypervisor stack KVM: arm64: Add guard pages for pKVM (protected nVHE) hypervisor stack KVM: arm64: Detect and handle hypervisor stack overflows KVM: arm64: Symbolize the nVHE HYP addresses arch/arm64/include/asm/kvm_asm.h | 1 + arch/arm64/include/asm/kvm_mmu.h | 4 ++ arch/arm64/kvm/arm.c | 39 ++++++++++++-- arch/arm64/kvm/handle_exit.c | 13 ++--- arch/arm64/kvm/hyp/include/nvhe/mm.h | 6 ++- arch/arm64/kvm/hyp/nvhe/host.S | 24 +++++++++ arch/arm64/kvm/hyp/nvhe/hyp-main.c | 18 ++++++- arch/arm64/kvm/hyp/nvhe/mm.c | 78 ++++++++++++++++++---------- arch/arm64/kvm/hyp/nvhe/setup.c | 31 +++++++++-- arch/arm64/kvm/hyp/nvhe/switch.c | 7 ++- arch/arm64/kvm/mmu.c | 70 ++++++++++++++++--------- scripts/kallsyms.c | 2 +- 12 files changed, 223 insertions(+), 70 deletions(-) base-commit: 3123109284176b1532874591f7c81f3837bbdc17