Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp398836pxb; Fri, 22 Apr 2022 03:30:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwI9EXe3cGyguThMU6jFy72tYR46IcTq/o2tIKQkguO3yfToFumPmaEx3eMlWfS9tz5Oq4P X-Received: by 2002:a17:907:7b92:b0:6db:71f1:fc20 with SMTP id ne18-20020a1709077b9200b006db71f1fc20mr3318049ejc.343.1650623446597; Fri, 22 Apr 2022 03:30:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650623446; cv=none; d=google.com; s=arc-20160816; b=bmVBOflcoT9SryS1j1fH0d5szP6+EKq9J7Nw4IFTGIKMot3sfa4LJxRC6lpjPjJ3c7 nFnNV1QVZ/unIQKDQq7luuRtVtYmtZrJ39wPetdvYK96RahuK/g+4bk3qGFx7g1hF71I YRWyYo+TILdcR64v1slotGvRwkoa4A7LRSgUzjUVOiqOxh+lP1rb2MmiMP0QjZ8UTv1b VCG30KCIpIlAnBcJx9K9A9zTFfWHGrKzixA7sZszh18JTZic/oj6zHrtxeRknTOAkht8 o2vcFqrcVxYdIisJyKWHyDVk4nZ/0X0zkPSJm7gnLZc1RsnCJSoGc7tKEiVsNfTfcqrK WURQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:cc:from:subject:mime-version:message-id:date :dkim-signature; bh=+ofVstgby+3VUZOCrqyBENIw0S2XGlsTcYhm1RZdUZ8=; b=NH5DJd0bxI2M1uQa2F5xHy0xnng16LWhmLktKdRFfeUfNO1CvKnf8MLjzidus4VXcM gHwZU28ULDhlP6O1WLrW6e73t3n4qhihk7a2opTyMpVkxdzxuUJamO4vfxaNCPTwPFim EcoUAnWZLIWRqpAj7T3ghrYrKkKGKYwT6P6ysZue8wz7IfgvExBJfOjRsz97rmNhwT1H 5jPN81Su9/9rdPr6K7ptC8F12vubqCgcabZWCTHKan6v91mx1I+ek4hSmPElZUhuM6Dj +J97bPan1a7rFysg+QTZd/Bpzbv1qIYlM3wmmb3Rv2Wj3HlvaTiYpETgWfrJFT70ctNX T6Sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="V7/nRf1a"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rv4-20020a17090710c400b006df76385d42si6058371ejb.482.2022.04.22.03.30.21; Fri, 22 Apr 2022 03:30:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="V7/nRf1a"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378840AbiDTVqS (ORCPT + 99 others); Wed, 20 Apr 2022 17:46:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241443AbiDTVqR (ORCPT ); Wed, 20 Apr 2022 17:46:17 -0400 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC8B33DDC6 for ; Wed, 20 Apr 2022 14:43:29 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-2f16f3a7c34so26806187b3.17 for ; Wed, 20 Apr 2022 14:43:29 -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=+ofVstgby+3VUZOCrqyBENIw0S2XGlsTcYhm1RZdUZ8=; b=V7/nRf1aqIhn3GrpHT/lkZMBo6WJCgvRWtI4hC60Tae7j51kV7NX/30fPVFIT1ZkRi UKsROxDen1kXaLPU9eDlOYdcjYnozYuA1MnCV5aibXYS3U3bKc+BUjEJwkVwRxaK3hCB GGSVcC3uywSpPEm1PDWOTeFyI7qJnBk/oLORu10hqRdBr9k0nt570qWwaznIFNr2gmiw 8XjMBScKKSOI1Y+1Y77BNZ7MLZTkTJ13fqOIjHBAd6Rfx4XFYzh/TGqiQ6vNll2ZiYoS WRm5geb+q+v1x1QVSZEjNHe3dtSRAg2v4RqdKtcocsQgYo32gQqVgraqx9QT36kUhGkB Rg2g== 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=+ofVstgby+3VUZOCrqyBENIw0S2XGlsTcYhm1RZdUZ8=; b=Pm5ZQ6begRf0/rddJtfshkxiJ4SdRThDT2CUy8gwxAKAngY4nuuYE6JBXaAva7xSgU fUYSCw9quZNI1ywxtVPXEzck5vp2KctqF314yU+a10oGKQrLsq9P7WiPtOgkZpE4FW8V +m95h0z1ui6wr/owsB345937Xt5dyFBuyLa3C7viGo7YPX9U9uQuI+QjVC8AgsFNm+db vzDyFm0hTc8jRNgzXeOT3sjqS8DGDXt+W0LfX92NmiAOjudaGb8Dt146QemF5bKiSYsF UbnPRvnJd3Z4Y2UuiuRAhJ8ua+ds4phnR4X9dpCO5iSYEaXDJIp9VFN9T5CQc+GT4uN3 7bDA== X-Gm-Message-State: AOAM531BgJQ205mJ3OF+ngwYs6rz/xfSkHII3IZ5Aylejlq+3jEuDFki MJbK9uAfXKfUw6rD9UNGxsvQbEGkYqA2zh61ow== X-Received: from kaleshsingh.mtv.corp.google.com ([2620:15c:211:200:2a20:cec4:8f41:cd6f]) (user=kaleshsingh job=sendgmr) by 2002:a81:478b:0:b0:2ea:da8c:5c21 with SMTP id u133-20020a81478b000000b002eada8c5c21mr23887312ywa.189.1650491008962; Wed, 20 Apr 2022 14:43:28 -0700 (PDT) Date: Wed, 20 Apr 2022 14:42:51 -0700 Message-Id: <20220420214317.3303360-1-kaleshsingh@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog Subject: [PATCH v8 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 , Mark Rutland , Ard Biesheuvel , Zenghui Yu , Nathan Chancellor , Masahiro Yamada , Changbin Du , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MISSING_HEADERS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi all, This is v8 of the nVHE hypervisor stack enhancements. This version is based on 5.18-rc3. Previous versions can be found at: v7: https://lore.kernel.org/r/20220408200349.1529080-1-kaleshsingh@google.com/ 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-rc3 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 | 3 ++ arch/arm64/kvm/arm.c | 37 +++++++++++-- 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 | 68 ++++++++++++++++-------- scripts/kallsyms.c | 3 +- 12 files changed, 220 insertions(+), 69 deletions(-) base-commit: b2d229d4ddb17db541098b83524d901257e93845 -- 2.36.0.rc0.470.gd361397f0d-goog