From patchwork Wed Feb 3 14:19:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Perret X-Patchwork-Id: 12064461 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49B1AC433DB for ; Wed, 3 Feb 2021 14:20:51 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CAA4E64F2C for ; Wed, 3 Feb 2021 14:20:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CAA4E64F2C Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:From:Subject:Mime-Version:Message-Id:Date: Reply-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=4PC/pgSp0Fjoa7DMgBb6BRnzNbTLxNdvfnd84rNvSus=; b=UhpOPQpW1LuMfYwrESc+SKRdY8 B217Q2O3zURApr8rQqaQKcX+NSV3H5xcUZRlcMNuUzK72P+gp2+xQqbIoLYXsKv1bkqMY8vXLKfsd V9yqTTRlBXAMmN5hHLj5B6p6UfvCAFspmq6OiEOzBMLgOD/5tzvaSfyjamaPMxm8ThCQ5xhlDt7nS Znx+aLRvNp3QqcG9U4i9OlapNmU74MZtmxVYPL1qkuJDlYseRE5BPZ6cBsQXSo6rBfEYrFcuwdOZI z4X8NfQuaWAjXm9UCVBBV1bfZny6bxwjnQ2r0wZ0mUVX3UC2uW04esvHp0UAfdkMQpHFL7IErqIqN ftnpy9NA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l7J0O-0003Or-Kr; Wed, 03 Feb 2021 14:19:40 +0000 Received: from mail-wr1-x449.google.com ([2a00:1450:4864:20::449]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l7J0M-0003Nf-3j for linux-arm-kernel@lists.infradead.org; Wed, 03 Feb 2021 14:19:39 +0000 Received: by mail-wr1-x449.google.com with SMTP id s15so14786373wrt.14 for ; Wed, 03 Feb 2021 06:19:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:message-id:mime-version:subject:from:to:cc; bh=2YqmStJHtmDLb9ca8pHnXTtS9p5W2yatBMAuEkk2twc=; b=swt8i8oh/CahxjCm1i2LWz1PAhEJPYcgCpXP0sqxpm2LUsKOEQR/Tv0qTZc/ayZXro fM/xy/OMrvadN/XfZfFqE9II1fKG4oA2GlksIBodsSYBYT2mQdY2QmCpAWh+A33rzzL5 GBiuyPnm5s8VHkJgbxLVNkw+yIUI3Zicnnyitub/KQvWRFCUrkmL+zNaLx2zGrWCUXaC VxvambATQYjvSZI9oXIdrBvrKIuvZMvY2pdDM60IB/BE1kKNHUXBK29B6uGPOMVY+nc5 fvb5tienhYATycUO0iLqHIzDap95urS27UIbmZIvUgzX0u7Xs21ZzMPJLuQDzcL3a4Gs 0Hwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:mime-version:subject:from :to:cc; bh=2YqmStJHtmDLb9ca8pHnXTtS9p5W2yatBMAuEkk2twc=; b=n/Pajf5/65raUeQtOSoqJXUrdua4IAhOScxJV3qRLP6CnpuX2eHyAuumLlZ4e14+ea xjDjtQhAvvpn46OYXhzsiiYAZblhBLoSB06ZLBRIDNTnWvsWyNM4a6p1N/bzWrCT5NKq /7PU3fSKKMFFVikxP0HiNotoKYXt9j/STo8qzeKCinQDZQl4XB0B3IBfDIuWSgAiEsfy h6daluNVytDL43xis4EB6SSpcItxqfqasOitgRidMKUmEe5/UkKaBfTRFKSd8eoJ3SyF V/TNPDqmxThHcN5YPKpJkNjm2w+yZDvufZpPI86yH6pZGQuTQPcafFOpLkWLzW56N5e1 DhTw== X-Gm-Message-State: AOAM533HM7AdQDWStnVzFkCVPi5Fg1X2cSGdynt+9tssuWa8jBLwpgW6 1n4uZx5+DeAn+p0t6zFDtlmUhr2O6Axs X-Google-Smtp-Source: ABdhPJzQ47fLWpATF9oviOBeGLZ6a+5wZlOoYomkHouoJDdnNHFlCRVtBHfc0HOJyC8UgG5y/ze+CK1Gxa5x X-Received: from r2d2-qp.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:1652]) (user=qperret job=sendgmr) by 2002:a1c:4303:: with SMTP id q3mr3048441wma.3.1612361974461; Wed, 03 Feb 2021 06:19:34 -0800 (PST) Date: Wed, 3 Feb 2021 14:19:29 +0000 Message-Id: <20210203141931.615898-1-qperret@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.30.0.365.g02bc693789-goog Subject: [PATCH 0/2] KVM: arm64: Stub exports in nvhe code From: Quentin Perret To: arnd@arndb.de, maz@kernel.org, catalin.marinas@arm.com, will@kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210203_091938_195362_0DF28712 X-CRM114-Status: GOOD ( 13.58 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, suzuki.poulose@arm.com, qperret@google.com, linux-kernel@vger.kernel.org, kvmarm@lists.cs.columbia.edu, james.morse@arm.com, linux-arm-kernel@lists.infradead.org, kernel-team@android.com, ardb@kernel.org, julien.thierry.kdev@gmail.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi all, In the context of the currently ongoing work to remove the host kernel from the TCB under KVM/arm64, I have been trying to wrap the host kernel with a stage 2 page-table -- see [1]. Using this infrastructure, I attempted to unmap the .hyp. sections from the host stage 2 as it really shouldn't need to access them. But by doing so, I realized quickly the module loader was getting very confused by the usage of EXPORT_SYMBOL() macros in library functions that have been pulled into the EL2 object, and that we end up linking modules against the EL2 copy of e.g. memset. And so, this series essentially tries to fix this. - Patch 01 changes asm-generic/export.h to ensure we respect __DISABLE_EXPORTS even for asm exports; - and patch 02 makes use of it for all of the nVHE EL2 code. This was tested on aml-s905x-cc, which now successfully loads kernel modules with .hyp.text unmapped from the host. Thanks, Quentin [1] https://lore.kernel.org/kvmarm/20210108121524.656872-1-qperret@google.com/ Quentin Perret (2): asm-generic: export: Stub EXPORT_SYMBOL with __DISABLE_EXPORTS KVM: arm64: Stub EXPORT_SYMBOL for nVHE EL2 code arch/arm64/kvm/hyp/nvhe/Makefile | 4 ++-- include/asm-generic/export.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)