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 KH X-Patchwork-Id: 175131 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp555866ill; Thu, 3 Oct 2019 09:29:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqydx6kKhiX4zX5prF7A24dLOOOCMIX9Fs4ZFKsXdy2xn6lIMFHFizcggOgMt6eZmj88Gf9Y X-Received: by 2002:aa7:cd5a:: with SMTP id v26mr10355034edw.256.1570120148328; Thu, 03 Oct 2019 09:29:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570120148; cv=none; d=google.com; s=arc-20160816; b=PHe1QY/lREgVXP873us1oCpQf2xGqeJPDHBdjzD6AlrUfk1jqJnVEJSuolFhUWBTHR 4T0JgymTdPY0kz+diBeowoij1Z0RZpidojaWPmACHPCs/t+ckozKsFCMFcx2FrLEPvEd 1QXxCkForiY2J5SPnETlQVfNPt7fZELpQnHheKhjWmdFSCFb7JM5JKswrmY/yuwvXLNh 2p8342ifhy5NjPBknu+yrOtXS9pl58cXvTRfI5USRoJeua7TFj5d26Gg/9XNbUWW/T8C nrjcbGzMJhkIWRhd55r1XsnLmheToX6vG8/N7m4j45O+DrpXpMZe62GT3g47hy40SPck Yk/w== 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=qUcwMxGpdt8q97fKw1fBmYgLGXtXE8UzK6GvbTCJH2BXPHKHp4be/JYFpv0vngD/jl eoQp8Q894rpSqx7m4QAI3awlGormQSHDEfcPKCzfFf1v9oadirdWwGOgQumu4d5j6LrD TTzXs/1yK9HDmV3wtz1OE7YJjFA5aeYpEuhjAyOC1QGqeEHZURvr1OntOgh3x+s6l63r S75b2M2SQt4P7/syNaQjr+mJaWQXRYvugUxUpjVwkhXEVk3lDZSbgtY5lN0H2NUOlSER 0X6m9B6aRsuoBO3LK712YD2hTW0uMXe++/HA/E7I1HdYg+IAlaqfhKnNZBXDepk2kH0g EaHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tbiuOhcp; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 c9si1788904eda.229.2019.10.03.09.29.08; Thu, 03 Oct 2019 09:29:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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=tbiuOhcp; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391530AbfJCQ2w (ORCPT + 14 others); Thu, 3 Oct 2019 12:28:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:33600 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389668AbfJCQ2v (ORCPT ); Thu, 3 Oct 2019 12:28:51 -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 44CD121783; Thu, 3 Oct 2019 16:28:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570120130; bh=Ykb93oMr+3gztSj7HV5KYl0vXoN7XcXRQ9o4/s8Ik+A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tbiuOhcpeJVUS6D/UN+I0kPopwEElWSVZovHrY+GWiiC9EAL1Z6WvLGUPyzAGhP9D T7nArGXv9rw3thDRI9+Tnh6qwTXLcuozpcolB7VACFb9fhDHkZIHvfHQ/q0kQlDMgy OMjM3Zive/byRWdaDJMZ/jPxJhI+yqtnpizTSCBA= 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.2 107/313] kasan/arm64: fix CONFIG_KASAN_SW_TAGS && KASAN_INLINE Date: Thu, 3 Oct 2019 17:51:25 +0200 Message-Id: <20191003154543.398677051@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191003154533.590915454@linuxfoundation.org> References: <20191003154533.590915454@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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