Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4254067pxf; Tue, 23 Mar 2021 06:38:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5JKvSGNrn5uV26QjjIhmI5HcEX2MtInCwU9GU/nPxNum/t8cTj9RQOfO/WfeWvpElWw3l X-Received: by 2002:a17:906:7c48:: with SMTP id g8mr5180017ejp.138.1616506730634; Tue, 23 Mar 2021 06:38:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616506730; cv=none; d=google.com; s=arc-20160816; b=NY5KFrCrwG3dic73YMSO1bR0rMkFTaUWj8J5PWiDhEmcdyyCR0GaXTdmqgAUi3mhzO 8BTeQJy6Y3UqBwzl2q2hnJOh+Igz00nrg+zbT/v3Fh2ZX8oQ9l8srFq4kQa2VdDoATeb 4qFwvjIAKanZFz/wbOCUbur+Zg3rxhCuhLg1ddYNbDyWrTBvskQw25de9a0b1KjJnl5K q3FzCmV8TbSfVGxqYPDyX8ue3/mzojqpoL+2BLUClT/pVB/Kbu1dK6/iiRAUCP0CdSdv zJh8/PgAaTSPazP1vFdija3YQs7/99CQjFAE32lhzqrXQ0Lyf/5r6/w03o4Z2LCa3455 yF8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=IAmVG/HBeCtgkbLWnwaUrodtWDBlDiqTMm626xAgpp8=; b=VfI4SSoAHGuuxhUi3VhVY7rxR/V8MBb1qBOANwQ0gk5jrvhtW6NkY1+Gbpn6H6Dpqy AfJ7rtkbagxV3YdaC+KcvCBizrBCLPtvOOnfhvr6Oq/uejG6uGahoREPFapfMGQHia2t pgqMbhGNUL6hM7Oyj3LB7nhIlRF9Z/cb9K+xPaEIaIKC9h6EFbBoFky6IbZGChsjWD5C LJi6kBasyrSzt9M6+MLaoC2TtlZ/VchG/K3Cu9Wr7x1CXQLDWaMTa8WiCXfYCoKnVpHs EjI7wurChtf7955KoeO/x6Wq3T0jJKhzmX9SFKoCAQSBodQHH5kUosbiXY5Cj1pyi8uo qVig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Fd41GIP8; 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 p5si14181393edt.42.2021.03.23.06.38.27; Tue, 23 Mar 2021 06:38:50 -0700 (PDT) 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=Fd41GIP8; 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 S231327AbhCWMvz (ORCPT + 99 others); Tue, 23 Mar 2021 08:51:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230225AbhCWMvp (ORCPT ); Tue, 23 Mar 2021 08:51:45 -0400 Received: from mail-oi1-x234.google.com (mail-oi1-x234.google.com [IPv6:2607:f8b0:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB01DC061574 for ; Tue, 23 Mar 2021 05:51:44 -0700 (PDT) Received: by mail-oi1-x234.google.com with SMTP id d12so16871801oiw.12 for ; Tue, 23 Mar 2021 05:51:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=IAmVG/HBeCtgkbLWnwaUrodtWDBlDiqTMm626xAgpp8=; b=Fd41GIP8RzSKS++6KWoo1+6KAs7pGNTKJu7Ty7MHxacWYr2L3k5V4/KNK1pHad0Y33 3AnD2/ZR9a3C0XWXzWGV+16X+w4Q1VS2S5l7v6gg2v49uEA2I6of6uDTZhO9o/3vgJYv 06OB4nr6hKC1gqpGJdsaTIQTsUxQRyKpcRmjLPb6tifDGPHl+phnxujUDr92Osy6o9au mHMwczfz5BHPoEId1cj9cFoM3s8TzJS4tFswWyF+tskq25OMJCzCAk4CyPhYiJm1GsSu qHjfeMU2ACcDuzHqrYdV07KyEHn5oosvaECnkglXw1PKxh632jsoemBiq4GgEHZiiW+T jUPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=IAmVG/HBeCtgkbLWnwaUrodtWDBlDiqTMm626xAgpp8=; b=l9JrYNdasXUu580Top9Q+mgqPZoJvf1xxLgnCuhDPabXtmbY6rWRhRHkhBnfYrYmpA KAIiW/Q8fd7Jnnv6ADDkq5vVtOq1L95a36Tq9TldkZhI5PqIjL7fbZFeBWjiycc9SHJX BchU5w6FBt7E+7DzhBxDUt909AFaKdVSGu36RTW4Dir0OKe8Ojq8InC4h3Jxe4Oo8CFV XWNA8dsHcI/4Cj0asJmKurT0V+SwSUrt3ndO4KwurhtLj2yziHMgN0OVOIrH1+4HPi/P Gh6G9RSSHrtdvkAcAMfLDLDYj5SlhYBt6E23WpBnUwjc60rvd4FYWrz3ENOs1THO3rd7 pfAA== X-Gm-Message-State: AOAM531Jjl6pehcqYxyRZJeciVDtumzVhPePezmGapVVS0/qgVvtEx+O CmXQPFUQXIDtQJV11tiCCEgZXhKaoZCVO8+Yv5/5/Q== X-Received: by 2002:aca:44d6:: with SMTP id r205mr3166533oia.172.1616503903973; Tue, 23 Mar 2021 05:51:43 -0700 (PDT) MIME-Version: 1.0 References: <20210323124112.1229772-1-arnd@kernel.org> In-Reply-To: <20210323124112.1229772-1-arnd@kernel.org> From: Marco Elver Date: Tue, 23 Mar 2021 13:51:32 +0100 Message-ID: Subject: Re: [PATCH] kasan: fix hwasan build for gcc To: Arnd Bergmann Cc: Masahiro Yamada , Michal Marek , Andrey Ryabinin , Nathan Chancellor , Nick Desaulniers , Arnd Bergmann , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Andrew Morton , Linux Kbuild mailing list , kasan-dev , LKML , clang-built-linux Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 23 Mar 2021 at 13:41, Arnd Bergmann wrote: > > From: Arnd Bergmann > > gcc-11 adds support for -fsanitize=kernel-hwaddress, so it becomes > possible to enable CONFIG_KASAN_SW_TAGS. > > Unfortunately this fails to build at the moment, because the > corresponding command line arguments use llvm specific syntax. > > Change it to use the cc-param macro instead, which works on both > clang and gcc. > > Signed-off-by: Arnd Bergmann Reviewed-by: Marco Elver Although I think you need to rebase against either -mm or -next, because there have been changes to the CONFIG_KASAN_STACK variable. > --- > scripts/Makefile.kasan | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/scripts/Makefile.kasan b/scripts/Makefile.kasan > index 1e000cc2e7b4..0a2789783d1b 100644 > --- a/scripts/Makefile.kasan > +++ b/scripts/Makefile.kasan > @@ -36,14 +36,14 @@ endif # CONFIG_KASAN_GENERIC > ifdef CONFIG_KASAN_SW_TAGS > > ifdef CONFIG_KASAN_INLINE > - instrumentation_flags := -mllvm -hwasan-mapping-offset=$(KASAN_SHADOW_OFFSET) > + instrumentation_flags := $(call cc-param,hwasan-mapping-offset=$(KASAN_SHADOW_OFFSET)) > else > - instrumentation_flags := -mllvm -hwasan-instrument-with-calls=1 > + instrumentation_flags := $(call cc-param,hwasan-instrument-with-calls=1) > endif > > CFLAGS_KASAN := -fsanitize=kernel-hwaddress \ > - -mllvm -hwasan-instrument-stack=$(CONFIG_KASAN_STACK) \ > - -mllvm -hwasan-use-short-granules=0 \ > + $(call cc-param,hwasan-instrument-stack=$(CONFIG_KASAN_STACK)) \ > + $(call cc-param,hwasan-use-short-granules=0) \ > $(instrumentation_flags) > > endif # CONFIG_KASAN_SW_TAGS > -- > 2.29.2 >