Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1881536pxb; Mon, 18 Jan 2021 02:22:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJxXl+eMK/63kUIMqb7i5pCRP+AfLn1P2U2wpy+/6kEiz4YRZgfh+F5LSbtCuO5IThl23vB/ X-Received: by 2002:a17:906:cf81:: with SMTP id um1mr17306617ejb.122.1610965357503; Mon, 18 Jan 2021 02:22:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610965357; cv=none; d=google.com; s=arc-20160816; b=HmXEPJf1VGn76oU5iKIOMRUE/OWXbZJgnTggVQCoJ+RkIvKYI6mjXdX6ZvyvFJ3KOx WJTGQJz3/wZu958N0Udo3h9GYFQBKdTn7j+m5gC4KvEYbznHjTirSg9KXIqVp80hKCIf ge61V85ZrNAp4x32+e9yVgbzjtOO+5RggIGdtjVwevMakrOPLH34fNm7m783W+L3Izwr pVwAmL+GWqQiHqlp5/3e10QFH8DsWrWr6DZ10SOv6jcIDg2LYqZnWIG6z6YFZ49ayqJC wS2p9ql9EdWdnG0nK7wGoqTkDY2e5vfVovO0c7i6Ct/UU6jK+SPZt+mvcDtHxq/xOeFQ XiiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=o6jQxvrdg4qy2EZL9N8xtit/ocZhA3/uVnMS0C547Vs=; b=BLva99ZDdm6YBE+uyKY4G8dNc5u3nUYJvIjDAe+gSXB9JwzG4XPcnV8qkcJVH4vxIC XuSY6flu3qWqbulh6x47UaB6oqIWsntNmFNgvAdoYcaxYV7wz8kFdCG/7UHBtxIG2NR8 kElvaMDLpNKN/Xm/84LiLECX3AuDaHXycpdRaXKqZb1GQxCXDxJPlppNo780xpQ0fSbB QhJZBQ3nsZH5FOAXkummUZ4tcsVS1oKanYoaljlHslBh+pjZADg2tUeTme3wPxFVBPkO E4b/KPpmXRaPzueMbLns0KsfkPz6t/YM54Uk9xasDevUzjcujZBu/8+5mWVijZXXQ/4T pkcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="bWs/iuft"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lt6si6773706ejb.133.2021.01.18.02.22.14; Mon, 18 Jan 2021 02:22:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="bWs/iuft"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S2389851AbhARKQY (ORCPT + 99 others); Mon, 18 Jan 2021 05:16:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389365AbhARJzJ (ORCPT ); Mon, 18 Jan 2021 04:55:09 -0500 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAB71C0613D6 for ; Mon, 18 Jan 2021 01:53:53 -0800 (PST) Received: by mail-wm1-x330.google.com with SMTP id v184so8983961wma.1 for ; Mon, 18 Jan 2021 01:53:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=o6jQxvrdg4qy2EZL9N8xtit/ocZhA3/uVnMS0C547Vs=; b=bWs/iuftHz+PV+7azX+PPueBRNaKcm8Aswspr7cdp6br161cqyo1C3q0AZ6KRLiz5G +H+or0jMkO+QMHs9om3G6i/tq/3KotYssKySfHSuglxD8TzkkJJSsMrBs6IWxnJ0cWKk eZ+ZaXooYnj6U/NSv2cwee2gBg/F2TgUtchRWdKcQ8WGR9zRQTG+3fQ3zxH1jhnJpFih gV+j3huAbMfbXI6hzxt+7y9BHo79RhyhZyyKwlt8yc65jazDFJapmY4bVEduUfieBg9g Fh1TtWlLbWgESVKCtfOG1mRSEzmoKre3omZtsz9cuhRMzqhSq3h51RMNpiThwOLhNnnk AGjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=o6jQxvrdg4qy2EZL9N8xtit/ocZhA3/uVnMS0C547Vs=; b=Hl1lD21VkBUD7EtFdz+gT32efxbNU+6zO50il5iQ+bb08/noiyys+crY7A9BoLlnQd n/+0/+Qu5bRpYayUiftl/GwxWxqG9gHG35rcQzED05hAJ83RGcPttc2nI6MX6oyZDPMn aAqKAqvdlZ3mjJwJDAoAhVmNZTzDH9KR2E+sGeq92mQ/yFNIudR2F47R4uibyIsDVQgM zBsPo4P9l4pwCYyWdI2e7plvRrtxyTzfZSVJUtXdsJbF4aGhv3JdV6qanGqYfzXdDoy0 3Kmrr8/DE5c986NbOwAP0PPJVtb+pPSw6SdnQZBElgi2aW3LpXc3a71xqjRanJF5H43+ X7eA== X-Gm-Message-State: AOAM53226GYQL1vgramRZydSfbyA9Voxvs/XkFZ+7Pb22Q8VOE0pVQGP YV1zFLYu+7KCkJo1tV9lA+OF9w== X-Received: by 2002:a1c:6283:: with SMTP id w125mr19819076wmb.155.1610963632505; Mon, 18 Jan 2021 01:53:52 -0800 (PST) Received: from google.com ([2a01:4b00:8523:2d03:3d4d:985d:87b7:4d55]) by smtp.gmail.com with ESMTPSA id f68sm15081928wmf.6.2021.01.18.01.53.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jan 2021 01:53:51 -0800 (PST) Date: Mon, 18 Jan 2021 09:53:50 +0000 From: David Brazdil To: Elena Petrova Cc: kvmarm@lists.cs.columbia.edu, George-Aurelian Popescu , Marc Zyngier , open list , linux-arm-kernel@lists.infradead.org, George Popescu Subject: Re: [PATCH v3 1/9] KVM: arm64: Enable UBSan instrumentation in nVHE hyp code Message-ID: <20210118095350.j5dy7om6dfn276cj@google.com> References: <20210115171830.3602110-1-lenaptr@google.com> <20210115171830.3602110-2-lenaptr@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210115171830.3602110-2-lenaptr@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 15, 2021 at 05:18:22PM +0000, Elena Petrova wrote: > From: George-Aurelian Popescu > > Implement UBSan handlers inside nVHe hyp code, as empty functions for the > moment, so the undefined behaviours, that are triggered there, will be > linked to them, not to the ones defined in kernel-proper lib/ubsan.c. > > In this way, enabling UBSAN_MISC won't cause a link error. The commit message needs to be updated - UBSAN_MISC does not exist any longer. Also "nVHe" is a typo. Other than that: Acked-by: David Brazdil > > Signed-off-by: Elena Petrova > --- > arch/arm64/kvm/hyp/nvhe/Makefile | 3 ++- > arch/arm64/kvm/hyp/nvhe/ubsan.c | 30 ++++++++++++++++++++++++++++++ > 2 files changed, 32 insertions(+), 1 deletion(-) > create mode 100644 arch/arm64/kvm/hyp/nvhe/ubsan.c > > diff --git a/arch/arm64/kvm/hyp/nvhe/Makefile b/arch/arm64/kvm/hyp/nvhe/Makefile > index 1f1e351c5fe2..2a683e7c6c5b 100644 > --- a/arch/arm64/kvm/hyp/nvhe/Makefile > +++ b/arch/arm64/kvm/hyp/nvhe/Makefile > @@ -10,6 +10,8 @@ obj-y := timer-sr.o sysreg-sr.o debug-sr.o switch.o tlb.o hyp-init.o host.o \ > hyp-main.o hyp-smp.o psci-relay.o > obj-y += ../vgic-v3-sr.o ../aarch32.o ../vgic-v2-cpuif-proxy.o ../entry.o \ > ../fpsimd.o ../hyp-entry.o ../exception.o > +obj-$(CONFIG_UBSAN) += ubsan.o > +CFLAGS_ubsan.nvhe.o += -I $(srctree)/lib/ > > ## > ## Build rules for compiling nVHE hyp code > @@ -61,7 +63,6 @@ KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_FTRACE) $(CC_FLAGS_SCS), $(KBUILD_CFLAG > # cause crashes. Just disable it. > GCOV_PROFILE := n > KASAN_SANITIZE := n > -UBSAN_SANITIZE := n > KCOV_INSTRUMENT := n > > # Skip objtool checking for this directory because nVHE code is compiled with > diff --git a/arch/arm64/kvm/hyp/nvhe/ubsan.c b/arch/arm64/kvm/hyp/nvhe/ubsan.c > new file mode 100644 > index 000000000000..a5db6b61ceb2 > --- /dev/null > +++ b/arch/arm64/kvm/hyp/nvhe/ubsan.c > @@ -0,0 +1,30 @@ > +// SPDX-License-Identifier: GPL-2.0-only > +/* > + * Copyright 2020 Google LLC > + * Author: George Popescu > + */ > +#include > +#include > +#include > + > +void __ubsan_handle_add_overflow(void *_data, void *lhs, void *rhs) {} > + > +void __ubsan_handle_sub_overflow(void *_data, void *lhs, void *rhs) {} > + > +void __ubsan_handle_mul_overflow(void *_data, void *lhs, void *rhs) {} > + > +void __ubsan_handle_negate_overflow(void *_data, void *old_val) {} > + > +void __ubsan_handle_divrem_overflow(void *_data, void *lhs, void *rhs) {} > + > +void __ubsan_handle_type_mismatch(struct type_mismatch_data *data, void *ptr) {} > + > +void __ubsan_handle_type_mismatch_v1(void *_data, void *ptr) {} > + > +void __ubsan_handle_out_of_bounds(void *_data, void *index) {} > + > +void __ubsan_handle_shift_out_of_bounds(void *_data, void *lhs, void *rhs) {} > + > +void __ubsan_handle_builtin_unreachable(void *_data) {} > + > +void __ubsan_handle_load_invalid_value(void *_data, void *val) {} > -- > 2.30.0.296.g2bfb1c46d8-goog > > _______________________________________________ > kvmarm mailing list > kvmarm@lists.cs.columbia.edu > https://lists.cs.columbia.edu/mailman/listinfo/kvmarm