From patchwork Fri May 18 17:02:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sami Tolvanen X-Patchwork-Id: 10411777 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3FAB86031B for ; Fri, 18 May 2018 18:05:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2D13B28A17 for ; Fri, 18 May 2018 18:05:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1FC3428A6E; Fri, 18 May 2018 18:05:29 +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=-2.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8C18C28A17 for ; Fri, 18 May 2018 18:05:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From: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=uDiKOp3gPHLrgO56L+prsp5duMalf+LL2ytINZCYy1o=; b=tb/ GPlb/2sTu9X3kuc+V0QAzEhGBaRbNDG8PVJdL22HwE2Hdh2IJ0PiG+HqoIJiE8xcNHOucZJCBj0Qn nBMS2tc19nIdxlqn8Kplk41Z7CjDGfbh43F2L6n8CxOrKKmnAnbddYn9XE+EGep+pwZADKRBDm/8P RalOEKbmTK1oBnBS3ecnAJsf90/pVMZNNQhtP+eonvC2uEEI++H/+MTH6u50WT4+h0VdCsyMXbUcG ebyG/oPXkRc2qyn+OTxzcPwNN3OahkEqir8V5NbXt69xsECqZTVY4WMWMTK6yTZC26rigUhi9XAIQ deth7pTq1LYtjwUkrLaAcZmqgTTOWfg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fJjkr-0003M6-E7; Fri, 18 May 2018 18:05:25 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fJjkq-0003Ls-0K for linux-arm-kernel@bombadil.infradead.org; Fri, 18 May 2018 18:05:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=MERyx6KGPvqmreSmGcrPSaYG4ilsi/7OGouCw/7QygI=; b=O5hgb/Ix/GvT0mNROC+oTc+/A o5n1xkLdpKHhjxoWvLDKnA6/8/a/DcpmWuzqZgk+iWRo4Sbby641bXYNq3XMNE8Lq8XcK8AiqKuOl QGFyrLH1SAGAmFX9MAP1loQFIJvNwpu+1VmdzmIcQz5/jB/OP7OpBpueYMhbuCeUB9hiEeCo+i5AV EczKpcC4ChfUnqLA8duYZl9K3B5P76jppK/M2+MfciWZkhCHtiaf5o9IADD3hgeyTM15xI8DHYkrY dIqn5fhbtdjNaGUZkP4osggEOrU+hzW5ueLF9w1kEqt8yvHS7jiLVW8Wb6miFrKV8SaiepgQA0l/J iziRPdkYg==; Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fJilr-0002Hr-FF for linux-arm-kernel@lists.infradead.org; Fri, 18 May 2018 17:02:23 +0000 Received: by mail-pf0-x242.google.com with SMTP id v63-v6so4039374pfk.8 for ; Fri, 18 May 2018 10:02:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=MERyx6KGPvqmreSmGcrPSaYG4ilsi/7OGouCw/7QygI=; b=IcPLpZfnTHEec1rqF+AiEFEWNghhP2crf8KW3o8fRRbp0ncW81AHcyYw7k4md/GYYg lOdfrejIxbSTWDqcLCf8ArsU8XjP879T27NW8wI3xt0HWQQ/4gS1RDfabaq9+RYBQoSl Ru4BY7cach8LTCSpOzXHWrHlwjjuVUWlNbplBfIgpOdhpTzj6EBgyj3nxSSdWlwkugki zeaTnDjQ3U+sy69aso6IyYDOuaiCXtE2m6IdlSXngqUVCrvbcje7BCeHmW7j6LCZRb8w A7/nEUuBRxJapqpXEY9UNhmUFRVof616e8EVX34Knw+eyiA9oYWwXnWFkcSpG3vyNNit VRRg== 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; bh=MERyx6KGPvqmreSmGcrPSaYG4ilsi/7OGouCw/7QygI=; b=nmyfInqIiAoWF5DIBRcBHa0/+O4VY0u0VS843CtKMPeqtqidej3K4ACnPnYWZbBgGE +mY0Knza2IFUDxnUzsglU663zuen1el+66r/dUP7V8gy4WWovZ+lOTwCnwflXay35XvZ ++6NjvAik5ETA6YmEbqQC/eKpzZ3egsiwYwKAFBhAQqMR8ol3058xgIhBEMateKRWCGZ sw0kRLUZhTrj8c5DBO8qiZRNRz0bXE6Sc+tf9+0xtLmaXkafCxHVaJtxP5RCv+Zy5K8S Zh+AES+PLjiq2KE751fRY/w0DP0Yb53yhfxtk42FTXiW5MureY6twurfkYbu7pfUXLJf D0cw== X-Gm-Message-State: ALKqPwfO9tYH4E7mP5iHrXZK/Cu9pV30UCyUKXlb/O3W2ADxPNZ+sxe5 uvUiJ3voNEW1Ru+EXWnyo5Tp8Q== X-Google-Smtp-Source: AB8JxZqSz0BHe/QoMpkf/buTguiY94fs/bgT2JkSrjZ2vpynVxwD+DnQrtq5hkyhj+Zfs+OSHMqWEA== X-Received: by 2002:a65:4887:: with SMTP id n7-v6mr6594376pgs.215.1526662927727; Fri, 18 May 2018 10:02:07 -0700 (PDT) Received: from samitolvanen.mtv.corp.google.com ([2620:0:1000:1611:a74b:912:9321:d674]) by smtp.gmail.com with ESMTPSA id b130-v6sm10160025pga.21.2018.05.18.10.02.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 May 2018 10:02:07 -0700 (PDT) From: Sami Tolvanen To: Christoffer Dall , Marc Zyngier Subject: [PATCH] arm64: kvm: use -fno-jump-tables with clang Date: Fri, 18 May 2018 10:02:02 -0700 Message-Id: <20180518170202.11458-1-samitolvanen@google.com> X-Mailer: git-send-email 2.17.0.441.gb46fe60e1d-goog X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180518_130223_528238_7959A144 X-CRM114-Status: GOOD ( 11.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nick Desaulniers , linux-kernel@vger.kernel.org, AKASHI Takahiro , Sami Tolvanen , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Starting with LLVM r308050, clang generates a jump table with EL1 virtual addresses in __init_stage2_translation, which results in a kernel panic when booting at EL2: Kernel panic - not syncing: HYP panic: PS:800003c9 PC:ffff0000089e6fd8 ESR:86000004 FAR:ffff0000089e6fd8 HPFAR:0000000009825000 PAR:0000000000000000 VCPU:000804fc20001221 CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.14.0-rc7-dirty #3 Hardware name: ARM Juno development board (r1) (DT) Call trace: [] dump_backtrace+0x0/0x34c [] show_stack+0x18/0x20 [] dump_stack+0xc4/0xfc [] panic+0x138/0x2b4 [] panic+0x0/0x2b4 SMP: stopping secondary CPUs SMP: failed to stop secondary CPUs 0-3,5 Kernel Offset: disabled CPU features: 0x002086 Memory Limit: none ---[ end Kernel panic - not syncing: HYP panic: PS:800003c9 PC:ffff0000089e6fd8 ESR:86000004 FAR:ffff0000089e6fd8 HPFAR:0000000009825000 PAR:0000000000000000 VCPU:000804fc20001221 This change adds -fno-jump-tables to arm64/hyp to work around the bug. Suggested-by: AKASHI Takahiro Signed-off-by: Sami Tolvanen Tested-by: Andrey Konovalov --- arch/arm64/kvm/hyp/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm64/kvm/hyp/Makefile b/arch/arm64/kvm/hyp/Makefile index 4313f74753332..745b3255e7832 100644 --- a/arch/arm64/kvm/hyp/Makefile +++ b/arch/arm64/kvm/hyp/Makefile @@ -5,6 +5,10 @@ ccflags-y += -fno-stack-protector -DDISABLE_BRANCH_PROFILING +ifeq ($(cc-name),clang) +ccflags-y += -fno-jump-tables +endif + KVM=../../../../virt/kvm obj-$(CONFIG_KVM_ARM_HOST) += $(KVM)/arm/hyp/vgic-v3-sr.o