From patchwork Thu Apr 12 12:54:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abbott Liu X-Patchwork-Id: 10338495 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 79618603B5 for ; Thu, 12 Apr 2018 13:15:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 660BE2022C for ; Thu, 12 Apr 2018 13:15:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 58C4C21EEB; Thu, 12 Apr 2018 13:15:19 +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_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable 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 03EC5288BD for ; Thu, 12 Apr 2018 13:15:08 +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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=iSUsS4kKJ6Maex2C65SgAlQSlKO3xX0pvkOIR1HDceg=; b=lF5pqOEA9WzwEX /2Vf3MaqRXi15FP2To9q/6Wn/jluQhNmJh2DlA+d2v+oOaYg5DZ2W5ClUa0JrDaOWr60js/7Q2+5a zj48IPgvriM02QjYk4y0eUW3ALhQlm0Etbs+IBoCMFeqezBcCeTKI05zltzZTIP+t6c36R7tLSy01 aLdXLV4riSg22VIDtCGDbmiG93CwMGeltxtIffHbacl/LbdyG0Gei0wxd4l/6XNto7lQObgf2cLVs oHiM5TACEdIzmKwnnRzQ2xWVr+YXTbdbqyH0M5zDgLlKWb7MNtnMolLpjIU5TeEo4x46T6LeVrGIj /Ts+g2J4EzjUAGfx97dA==; 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 1f6c44-0001yj-5X; Thu, 12 Apr 2018 13:15:00 +0000 Received: from [45.249.212.32] (helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f6c40-0001w2-AH for linux-arm-kernel@lists.infradead.org; Thu, 12 Apr 2018 13:14:58 +0000 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 97473AD1A98D4; Thu, 12 Apr 2018 21:14:38 +0800 (CST) Received: from linux.site (10.67.187.223) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.361.1; Thu, 12 Apr 2018 21:14:33 +0800 From: Abbott Liu To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH 2/6] Disable instrumentation for some code Date: Thu, 12 Apr 2018 20:54:07 +0800 Message-ID: <20180412125411.326-3-liuwenliang@huawei.com> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180412125411.326-1-liuwenliang@huawei.com> References: <20180412125411.326-1-liuwenliang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.187.223] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180412_061456_509575_97E7282E X-CRM114-Status: GOOD ( 14.15 ) 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: , 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 From: Andrey Ryabinin Disable instrumentation for arch/arm/boot/compressed/* and arch/arm/vdso/* because those code won't linkd with kernel image. Disable instrumentation for arch/arm/kvm/hyp/*. See commit a6cdf1c08cbf ("kvm: arm64: Disable compiler instrumentation for hypervisor code") for more details. Disable instrumentation for arch/arm/mm/physaddr.c. See commit ec6d06efb0ba ("arm64: Add support for CONFIG_DEBUG_VIRTUAL") for more details. Disable kasan check in the function unwind_pop_register because it doesn't matter that kasan checks failed when unwind_pop_register read stack memory of task. Reported-by: Florian Fainelli Reported-by: Marc Zyngier Tested-by: Joel Stanley Tested-by: Florian Fainelli Tested-by: Abbott Liu Signed-off-by: Abbott Liu --- arch/arm/boot/compressed/Makefile | 1 + arch/arm/kernel/unwind.c | 3 ++- arch/arm/kvm/hyp/Makefile | 4 ++++ arch/arm/mm/Makefile | 1 + arch/arm/vdso/Makefile | 2 ++ 5 files changed, 10 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile index 45a6b9b..966103e 100644 --- a/arch/arm/boot/compressed/Makefile +++ b/arch/arm/boot/compressed/Makefile @@ -24,6 +24,7 @@ OBJS += hyp-stub.o endif GCOV_PROFILE := n +KASAN_SANITIZE := n # # Architecture dependencies diff --git a/arch/arm/kernel/unwind.c b/arch/arm/kernel/unwind.c index 0bee233..2e55c7d 100644 --- a/arch/arm/kernel/unwind.c +++ b/arch/arm/kernel/unwind.c @@ -249,7 +249,8 @@ static int unwind_pop_register(struct unwind_ctrl_block *ctrl, if (*vsp >= (unsigned long *)ctrl->sp_high) return -URC_FAILURE; - ctrl->vrs[reg] = *(*vsp)++; + ctrl->vrs[reg] = READ_ONCE_NOCHECK(*(*vsp)); + (*vsp)++; return URC_OK; } diff --git a/arch/arm/kvm/hyp/Makefile b/arch/arm/kvm/hyp/Makefile index 63d6b40..0a8b500 100644 --- a/arch/arm/kvm/hyp/Makefile +++ b/arch/arm/kvm/hyp/Makefile @@ -24,3 +24,7 @@ obj-$(CONFIG_KVM_ARM_HOST) += hyp-entry.o obj-$(CONFIG_KVM_ARM_HOST) += switch.o CFLAGS_switch.o += $(CFLAGS_ARMV7VE) obj-$(CONFIG_KVM_ARM_HOST) += s2-setup.o + +GCOV_PROFILE := n +KASAN_SANITIZE := n +UBSAN_SANITIZE := n diff --git a/arch/arm/mm/Makefile b/arch/arm/mm/Makefile index 9dbb849..c056e17 100644 --- a/arch/arm/mm/Makefile +++ b/arch/arm/mm/Makefile @@ -16,6 +16,7 @@ endif obj-$(CONFIG_ARM_PTDUMP_CORE) += dump.o obj-$(CONFIG_ARM_PTDUMP_DEBUGFS) += ptdump_debugfs.o obj-$(CONFIG_MODULES) += proc-syms.o +KASAN_SANITIZE_physaddr.o := n obj-$(CONFIG_DEBUG_VIRTUAL) += physaddr.o obj-$(CONFIG_ALIGNMENT_TRAP) += alignment.o diff --git a/arch/arm/vdso/Makefile b/arch/arm/vdso/Makefile index bb411821..87abbb7 100644 --- a/arch/arm/vdso/Makefile +++ b/arch/arm/vdso/Makefile @@ -30,6 +30,8 @@ CFLAGS_vgettimeofday.o = -O2 # Disable gcov profiling for VDSO code GCOV_PROFILE := n +KASAN_SANITIZE := n + # Force dependency $(obj)/vdso.o : $(obj)/vdso.so