From patchwork Thu Oct 3 15:51:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 175171 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp595651ill; Thu, 3 Oct 2019 10:02:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqyEaao6QeFshkHjmbBLsl73HKw0vBuHTy/EcCW3conwgITsj2trFc56PglOC1Mx0flKh0VH X-Received: by 2002:a05:6402:1e4:: with SMTP id i4mr10658215edy.31.1570122136846; Thu, 03 Oct 2019 10:02:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570122136; cv=none; d=google.com; s=arc-20160816; b=TMqkZ3yylAYNX2G526/9nuRXE/QD8oOOnlSELYPhdJcz7zcpwfUoX8VtLTgK8Bbw4R aRy8frjjFjEYntIGfWnRM+3BE7LbgfeP+/ne0EwXJGfrl5CnavMoQyiSZteCus+6Qpzd jogvwjZ/nlXDeMVXqw382xaugY1n3xxsqj3M21QqTDF8h6b00g2CaVozB4Q+ySqy6k/4 v4A5rW9t9M/Prq4qCHpdaYalU17Mihi5KZqEqTBFo8CYSbJ+ixWrMQadodKE5DwxIMQR ggPDy9d2uqpeu8VU0BLaC7P4ykT6Hiv5dZe2fojII+18yWXPrB59tR0kXkWsnSyXCPFk Cvng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3htRQl954QmBuJyLQwasHk4KigwbFor2wr91rI3ejzQ=; b=OqSX6KM2e11tH4Ja65dhXgn4Yz4+8JQtqngU/rMQARtpywkBq1LtjLmfJH7rP+W1T1 KYHFWaSIqLAKW+KehYxMhvpxqs+BaF6gWoIYpFsMAS64ebPmboqWETK2P6Jnv8TMT0Nk qx0lyGhvg6NJOKVuoHADBio1osCxmmjUKRS0NfDbmZIsrmAHU+Ujf5gnvGKigzySSZsn 9XGsfhYEkyWpPtmnfLsNAX3kUl5IQFvUAQEZDWLdefDFqs+EHuOL4gM5Wf2fobEGIDyc b4FinU+Dih0Frsq7ABLvkKmTluEHQWRV1r/K83lJwGXUuOvQ7ihfA6BaEL7bM6+Jjeh1 bXRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TuXC0dv3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h20si1817014edb.218.2019.10.03.10.02.16; Thu, 03 Oct 2019 10:02:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TuXC0dv3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393232AbfJCRCP (ORCPT + 27 others); Thu, 3 Oct 2019 13:02:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:54888 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404879AbfJCQn1 (ORCPT ); Thu, 3 Oct 2019 12:43:27 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EDC3720865; Thu, 3 Oct 2019 16:43:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570121006; bh=Ykb93oMr+3gztSj7HV5KYl0vXoN7XcXRQ9o4/s8Ik+A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TuXC0dv35m2RHhPPS0WA9v2206OLTTreQRqVt1VvlmzZmY+rGPt+3kiihNf0A+Wk2 7g0cwEnpSA3d8r5IhIEyexkMvS8DbAiYYZvfL8Srg/PsaLR6NVrDroBVScZwGOTAC+ GDF10eUbHcmt/q1PA8MeM3exkuU95/7gF5q5nFA4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Catalin Marinas , Mark Rutland , Andrey Ryabinin , Will Deacon , Sasha Levin Subject: [PATCH 5.3 120/344] kasan/arm64: fix CONFIG_KASAN_SW_TAGS && KASAN_INLINE Date: Thu, 3 Oct 2019 17:51:25 +0200 Message-Id: <20191003154552.032770815@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191003154540.062170222@linuxfoundation.org> References: <20191003154540.062170222@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mark Rutland [ Upstream commit 34b5560db40d2941cfbe82eca1641353d5aed1a9 ] The generic Makefile.kasan propagates CONFIG_KASAN_SHADOW_OFFSET into KASAN_SHADOW_OFFSET, but only does so for CONFIG_KASAN_GENERIC. Since commit: 6bd1d0be0e97936d ("arm64: kasan: Switch to using KASAN_SHADOW_OFFSET") ... arm64 defines CONFIG_KASAN_SHADOW_OFFSET in Kconfig rather than defining KASAN_SHADOW_OFFSET in a Makefile. Thus, if CONFIG_KASAN_SW_TAGS && KASAN_INLINE are selected, we get build time splats due to KASAN_SHADOW_OFFSET not being set: | [mark@lakrids:~/src/linux]% usellvm 8.0.1 usekorg 8.1.0 make ARCH=arm64 CROSS_COMPILE=aarch64-linux- CC=clang | scripts/kconfig/conf --syncconfig Kconfig | CC scripts/mod/empty.o | clang (LLVM option parsing): for the -hwasan-mapping-offset option: '' value invalid for uint argument! | scripts/Makefile.build:273: recipe for target 'scripts/mod/empty.o' failed | make[1]: *** [scripts/mod/empty.o] Error 1 | Makefile:1123: recipe for target 'prepare0' failed | make: *** [prepare0] Error 2 Let's fix this by always propagating CONFIG_KASAN_SHADOW_OFFSET into KASAN_SHADOW_OFFSET if CONFIG_KASAN is selected, moving the existing common definition of +CFLAGS_KASAN_NOSANITIZE to the top of Makefile.kasan. Cc: Catalin Marinas Signed-off-by: Mark Rutland Acked-by: Andrey Ryabinin Tested-by Steve Capper Signed-off-by: Will Deacon Signed-off-by: Sasha Levin --- scripts/Makefile.kasan | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) -- 2.20.1 diff --git a/scripts/Makefile.kasan b/scripts/Makefile.kasan index 6410bd22fe387..03757cc60e06c 100644 --- a/scripts/Makefile.kasan +++ b/scripts/Makefile.kasan @@ -1,4 +1,9 @@ # SPDX-License-Identifier: GPL-2.0 +ifdef CONFIG_KASAN +CFLAGS_KASAN_NOSANITIZE := -fno-builtin +KASAN_SHADOW_OFFSET ?= $(CONFIG_KASAN_SHADOW_OFFSET) +endif + ifdef CONFIG_KASAN_GENERIC ifdef CONFIG_KASAN_INLINE @@ -7,8 +12,6 @@ else call_threshold := 0 endif -KASAN_SHADOW_OFFSET ?= $(CONFIG_KASAN_SHADOW_OFFSET) - CFLAGS_KASAN_MINIMAL := -fsanitize=kernel-address cc-param = $(call cc-option, -mllvm -$(1), $(call cc-option, --param $(1))) @@ -45,7 +48,3 @@ CFLAGS_KASAN := -fsanitize=kernel-hwaddress \ $(instrumentation_flags) endif # CONFIG_KASAN_SW_TAGS - -ifdef CONFIG_KASAN -CFLAGS_KASAN_NOSANITIZE := -fno-builtin -endif