linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Andrew Scull <ascull@google.com>, Will Deacon <will@kernel.org>,
	Marc Zyngier <maz@kernel.org>, Sasha Levin <sashal@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	kvmarm@lists.cs.columbia.edu
Subject: [PATCH AUTOSEL 5.11 036/104] KVM: arm64: Use BUG and BUG_ON in nVHE hyp
Date: Wed,  5 May 2021 12:33:05 -0400	[thread overview]
Message-ID: <20210505163413.3461611-36-sashal@kernel.org> (raw)
In-Reply-To: <20210505163413.3461611-1-sashal@kernel.org>

From: Andrew Scull <ascull@google.com>

[ Upstream commit f79e616f27ab6cd74deb0995a8eead3d1c9d65af ]

hyp_panic() reports the address of the panic by using ELR_EL2, but this
isn't a useful address when hyp_panic() is called directly. Replace such
direct calls with BUG() and BUG_ON() which use BRK to trigger an
exception that then goes to hyp_panic() with the correct address. Also
remove the hyp_panic() declaration from the header file to avoid
accidental misuse.

Signed-off-by: Andrew Scull <ascull@google.com>
Acked-by: Will Deacon <will@kernel.org>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20210318143311.839894-5-ascull@google.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm64/include/asm/kvm_hyp.h   | 1 -
 arch/arm64/kvm/hyp/nvhe/hyp-main.c | 2 +-
 arch/arm64/kvm/hyp/nvhe/hyp-smp.c  | 6 ++----
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/arch/arm64/include/asm/kvm_hyp.h b/arch/arm64/include/asm/kvm_hyp.h
index 32ae676236b6..fe5fc814f228 100644
--- a/arch/arm64/include/asm/kvm_hyp.h
+++ b/arch/arm64/include/asm/kvm_hyp.h
@@ -100,7 +100,6 @@ u64 __guest_enter(struct kvm_vcpu *vcpu);
 
 bool kvm_host_psci_handler(struct kvm_cpu_context *host_ctxt);
 
-void __noreturn hyp_panic(void);
 #ifdef __KVM_NVHE_HYPERVISOR__
 void __noreturn __hyp_do_panic(struct kvm_cpu_context *host_ctxt, u64 spsr,
 			       u64 elr, u64 par);
diff --git a/arch/arm64/kvm/hyp/nvhe/hyp-main.c b/arch/arm64/kvm/hyp/nvhe/hyp-main.c
index 1b8ef37bf805..2630d3bbae62 100644
--- a/arch/arm64/kvm/hyp/nvhe/hyp-main.c
+++ b/arch/arm64/kvm/hyp/nvhe/hyp-main.c
@@ -181,6 +181,6 @@ void handle_trap(struct kvm_cpu_context *host_ctxt)
 		handle_host_smc(host_ctxt);
 		break;
 	default:
-		hyp_panic();
+		BUG();
 	}
 }
diff --git a/arch/arm64/kvm/hyp/nvhe/hyp-smp.c b/arch/arm64/kvm/hyp/nvhe/hyp-smp.c
index 2997aa156d8e..4495aed04240 100644
--- a/arch/arm64/kvm/hyp/nvhe/hyp-smp.c
+++ b/arch/arm64/kvm/hyp/nvhe/hyp-smp.c
@@ -18,8 +18,7 @@ u64 __ro_after_init hyp_cpu_logical_map[NR_CPUS] = { [0 ... NR_CPUS-1] = INVALID
 
 u64 cpu_logical_map(unsigned int cpu)
 {
-	if (cpu >= ARRAY_SIZE(hyp_cpu_logical_map))
-		hyp_panic();
+	BUG_ON(cpu >= ARRAY_SIZE(hyp_cpu_logical_map));
 
 	return hyp_cpu_logical_map[cpu];
 }
@@ -30,8 +29,7 @@ unsigned long __hyp_per_cpu_offset(unsigned int cpu)
 	unsigned long this_cpu_base;
 	unsigned long elf_base;
 
-	if (cpu >= ARRAY_SIZE(kvm_arm_hyp_percpu_base))
-		hyp_panic();
+	BUG_ON(cpu >= ARRAY_SIZE(kvm_arm_hyp_percpu_base));
 
 	cpu_base_array = (unsigned long *)hyp_symbol_addr(kvm_arm_hyp_percpu_base);
 	this_cpu_base = kern_hyp_va(cpu_base_array[cpu]);
-- 
2.30.2


  parent reply	other threads:[~2021-05-05 16:50 UTC|newest]

Thread overview: 106+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-05 16:32 [PATCH AUTOSEL 5.11 001/104] ath11k: fix thermal temperature read Sasha Levin
2021-05-05 16:32 ` [PATCH AUTOSEL 5.11 002/104] ALSA: usb-audio: Add Pioneer DJM-850 to quirks-table Sasha Levin
2021-05-05 16:32 ` [PATCH AUTOSEL 5.11 003/104] fs: dlm: fix debugfs dump Sasha Levin
2021-05-05 16:32 ` [PATCH AUTOSEL 5.11 004/104] fs: dlm: fix mark setting deadlock Sasha Levin
2021-05-05 16:32 ` [PATCH AUTOSEL 5.11 005/104] fs: dlm: add errno handling to check callback Sasha Levin
2021-05-05 16:32 ` [PATCH AUTOSEL 5.11 006/104] fs: dlm: add check if dlm is currently running Sasha Levin
2021-05-05 16:32 ` [PATCH AUTOSEL 5.11 007/104] fs: dlm: change allocation limits Sasha Levin
2021-05-05 16:32 ` [PATCH AUTOSEL 5.11 008/104] fs: dlm: check on minimum msglen size Sasha Levin
2021-05-05 16:32 ` [PATCH AUTOSEL 5.11 009/104] fs: dlm: flush swork on shutdown Sasha Levin
2021-05-05 16:32 ` [PATCH AUTOSEL 5.11 010/104] fs: dlm: add shutdown hook Sasha Levin
2021-05-05 16:32 ` [PATCH AUTOSEL 5.11 011/104] tipc: convert dest node's address to network order Sasha Levin
2021-05-05 16:32 ` [PATCH AUTOSEL 5.11 012/104] ASoC: Intel: bytcr_rt5640: Enable jack-detect support on Asus T100TAF Sasha Levin
2021-05-05 16:32 ` [PATCH AUTOSEL 5.11 013/104] net/mlx5e: Use net_prefetchw instead of prefetchw in MPWQE TX datapath Sasha Levin
2021-05-05 16:32 ` [PATCH AUTOSEL 5.11 014/104] net: stmmac: Set FIFO sizes for ipq806x Sasha Levin
2021-05-05 16:32 ` [PATCH AUTOSEL 5.11 015/104] ASoC: rsnd: core: Check convert rate in rsnd_hw_params Sasha Levin
2021-05-05 16:32 ` [PATCH AUTOSEL 5.11 016/104] Documentation: networking: switchdev: fix command for static FDB entries Sasha Levin
2021-05-05 16:32 ` [PATCH AUTOSEL 5.11 017/104] Bluetooth: Fix incorrect status handling in LE PHY UPDATE event Sasha Levin
2021-05-05 16:32 ` [PATCH AUTOSEL 5.11 018/104] i2c: bail out early when RDWR parameters are wrong Sasha Levin
2021-05-05 16:32 ` [PATCH AUTOSEL 5.11 019/104] ALSA: hdsp: don't disable if not enabled Sasha Levin
2021-05-05 16:32 ` [PATCH AUTOSEL 5.11 020/104] ALSA: hdspm: " Sasha Levin
2021-05-05 16:32 ` [PATCH AUTOSEL 5.11 021/104] ALSA: rme9652: " Sasha Levin
2021-05-05 16:32 ` [PATCH AUTOSEL 5.11 022/104] ALSA: bebob: enable to deliver MIDI messages for multiple ports Sasha Levin
2021-05-05 16:32 ` [PATCH AUTOSEL 5.11 023/104] Bluetooth: Set CONF_NOT_COMPLETE as l2cap_chan default Sasha Levin
2021-05-05 16:32 ` [PATCH AUTOSEL 5.11 024/104] Bluetooth: verify AMP hci_chan before amp_destroy Sasha Levin
2021-05-05 16:32 ` [PATCH AUTOSEL 5.11 025/104] Bluetooth: initialize skb_queue_head at l2cap_chan_create() Sasha Levin
2021-05-05 16:32 ` [PATCH AUTOSEL 5.11 026/104] net/sched: cls_flower: use ntohs for struct flow_dissector_key_ports Sasha Levin
2021-05-05 16:32 ` [PATCH AUTOSEL 5.11 027/104] net: bridge: when suppression is enabled exclude RARP packets Sasha Levin
2021-05-05 16:32 ` [PATCH AUTOSEL 5.11 028/104] Bluetooth: check for zapped sk before connecting Sasha Levin
2021-05-05 16:32 ` [PATCH AUTOSEL 5.11 029/104] selftests/powerpc: Fix L1D flushing tests for Power10 Sasha Levin
2021-05-05 16:32 ` [PATCH AUTOSEL 5.11 030/104] powerpc/32: Statically initialise first emergency context Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 031/104] net: hns3: remediate a potential overflow risk of bd_num_list Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 032/104] net: hns3: add handling for xmit skb with recursive fraglist Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 033/104] ip6_vti: proper dev_{hold|put} in ndo_[un]init methods Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 034/104] ASoC: Intel: bytcr_rt5640: Add quirk for the Chuwi Hi8 tablet Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 035/104] ice: handle increasing Tx or Rx ring sizes Sasha Levin
2021-05-05 16:33 ` Sasha Levin [this message]
2021-05-05 16:48   ` [PATCH AUTOSEL 5.11 036/104] KVM: arm64: Use BUG and BUG_ON in nVHE hyp Marc Zyngier
2021-05-06  0:14     ` Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 037/104] net: usb: ax88179_178a: initialize local variables before use Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 038/104] Bluetooth: btusb: Enable quirk boolean flag for Mediatek Chip Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 039/104] ASoC: rt5670: Add a quirk for the Dell Venue 10 Pro 5055 Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 040/104] selftests: mptcp: launch mptcp_connect with timeout Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 041/104] i2c: Add I2C_AQ_NO_REP_START adapter quirk Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 042/104] Bluetooth: Do not set cur_adv_instance in adv param MGMT request Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 043/104] MIPS: Loongson64: Use _CACHE_UNCACHED instead of _CACHE_UNCACHED_ACCELERATED Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 044/104] coresight: Do not scan for graph if none is present Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 045/104] IB/hfi1: Correct oversized ring allocation Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 046/104] mac80211: Set priority and queue mapping for injected frames Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 047/104] mac80211: clear the beacon's CRC after channel switch Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 048/104] ASoC: soc-compress: lock pcm_mutex to resolve lockdep error Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 049/104] pinctrl: samsung: use 'int' for register masks in Exynos Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 050/104] rtw88: 8822c: add LC calibration for RTL8822C Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 051/104] mt76: mt7615: fix key set/delete issues Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 052/104] mt76: mt7615: support loading EEPROM for MT7613BE Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 053/104] mt76: mt76x0: disable GTK offloading Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 054/104] mt76: mt7915: always check return value from mt7915_mcu_alloc_wtbl_req Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 055/104] mt76: mt7915: fix key set/delete issue Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 056/104] mt76: mt7915: fix txpower init for TSSI off chips Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 057/104] mt76: mt7915: add wifi subsystem reset Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 058/104] i2c: imx: Fix PM reference leak in i2c_imx_reg_slave() Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 059/104] fuse: invalidate attrs when page writeback completes Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 060/104] virtiofs: fix userns Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 061/104] cuse: prevent clone Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 062/104] iwlwifi: pcie: make cfg vs. trans_cfg more robust Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 063/104] iwlwifi: queue: avoid memory leak in reset flow Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 064/104] powerpc/mm: Add cond_resched() while removing hpte mappings Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 065/104] ASoC: rsnd: call rsnd_ssi_master_clk_start() from rsnd_ssi_init() Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 066/104] Revert "iommu/amd: Fix performance counter initialization" Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 067/104] iommu/amd: Remove performance counter pre-initialization test Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 068/104] drm/amd/display: Force vsync flip when reconfiguring MPCC Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 069/104] selftests: Set CC to clang in lib.mk if LLVM is set Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 070/104] kconfig: nconf: stop endless search loops Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 071/104] ALSA: hda/realtek: Add quirk for Lenovo Ideapad S740 Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 072/104] ASoC: Intel: sof_sdw: add quirk for new ADL-P Rvp Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 073/104] ALSA: hda/hdmi: fix race in handling acomp ELD notification at resume Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 074/104] sctp: Fix out-of-bounds warning in sctp_process_asconf_param() Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 075/104] flow_dissector: Fix out-of-bounds warning in __skb_flow_bpf_to_target() Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 076/104] powerpc/xive: Use the "ibm, chip-id" property only under PowerNV Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 077/104] powerpc/smp: Set numa node before updating mask Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 078/104] wilc1000: Bring MAC address setting in line with typical Linux behavior Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 079/104] mac80211: properly drop the connection in case of invalid CSA IE Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 080/104] ASoC: rt286: Generalize support for ALC3263 codec Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 081/104] ethtool: ioctl: Fix out-of-bounds warning in store_link_ksettings_for_user() Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 082/104] net: sched: tapr: prevent cycle_time == 0 in parse_taprio_schedule Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 083/104] samples/bpf: Fix broken tracex1 due to kprobe argument change Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 084/104] powerpc/pseries: Stop calling printk in rtas_stop_self() Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 085/104] drm/amd/display: fixed divide by zero kernel crash during dsc enablement Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 086/104] drm/amd/display: add handling for hdcp2 rx id list validation Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 087/104] drm/amdgpu: Add mem sync flag for IB allocated by SA Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 088/104] mt76: mt7615: fix entering driver-own state on mt7663 Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 089/104] crypto: ccp: Free SEV device if SEV init fails Sasha Levin
2021-05-05 16:33 ` [PATCH AUTOSEL 5.11 090/104] wl3501_cs: Fix out-of-bounds warnings in wl3501_send_pkt Sasha Levin
2021-05-05 16:34 ` [PATCH AUTOSEL 5.11 091/104] wl3501_cs: Fix out-of-bounds warnings in wl3501_mgmt_join Sasha Levin
2021-05-05 16:34 ` [PATCH AUTOSEL 5.11 092/104] qtnfmac: Fix possible buffer overflow in qtnf_event_handle_external_auth Sasha Levin
2021-05-05 16:34 ` [PATCH AUTOSEL 5.11 093/104] powerpc/iommu: Annotate nested lock for lockdep Sasha Levin
2021-05-05 16:34 ` [PATCH AUTOSEL 5.11 094/104] iavf: remove duplicate free resources calls Sasha Levin
2021-05-05 16:34 ` [PATCH AUTOSEL 5.11 095/104] net: ethernet: mtk_eth_soc: fix RX VLAN offload Sasha Levin
2021-05-05 16:34 ` [PATCH AUTOSEL 5.11 096/104] selftests: mlxsw: Increase the tolerance of backlog buildup Sasha Levin
2021-05-05 16:34 ` [PATCH AUTOSEL 5.11 097/104] selftests: mlxsw: Fix mausezahn invocation in ERSPAN scale test Sasha Levin
2021-05-05 16:34 ` [PATCH AUTOSEL 5.11 098/104] kbuild: generate Module.symvers only when vmlinux exists Sasha Levin
2021-05-05 16:34 ` [PATCH AUTOSEL 5.11 099/104] bnxt_en: Add PCI IDs for Hyper-V VF devices Sasha Levin
2021-05-05 16:34 ` [PATCH AUTOSEL 5.11 100/104] ia64: module: fix symbolizer crash on fdescr Sasha Levin
2021-05-05 16:34 ` [PATCH AUTOSEL 5.11 101/104] watchdog: rename __touch_watchdog() to a better descriptive name Sasha Levin
2021-05-05 16:34 ` [PATCH AUTOSEL 5.11 102/104] watchdog: explicitly update timestamp when reporting softlockup Sasha Levin
2021-05-05 16:34 ` [PATCH AUTOSEL 5.11 103/104] watchdog/softlockup: remove logic that tried to prevent repeated reports Sasha Levin
2021-05-05 16:34 ` [PATCH AUTOSEL 5.11 104/104] watchdog: fix barriers when printing backtraces from all CPUs Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210505163413.3461611-36-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=ascull@google.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).