Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp7195769rwp; Tue, 18 Jul 2023 11:25:45 -0700 (PDT) X-Google-Smtp-Source: APBJJlFP12riuQYFu1PDLRU25NCV9GMyLfuRfhHR1upQv8PEohtkmmzss5R5KL4WOKsIJEocnymO X-Received: by 2002:a5d:51c8:0:b0:314:f14:c24f with SMTP id n8-20020a5d51c8000000b003140f14c24fmr5270275wrv.0.1689704744780; Tue, 18 Jul 2023 11:25:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689704744; cv=none; d=google.com; s=arc-20160816; b=CUR64mXE1ZaIduCAP10xWGa58Ja46mb4iEDTE6dpYOnx/cLqQdsFxby3+Vyw0bQd9u 55PKvYV16I9NaYQMqQwapX3Py+PKZ4c2FX5I7GM5imY33wQXXmG/zzNIcYfbZ4W2E87i GZ00gPrxpNHH4ZxVx9gli1pPEqeUaQGGMAFwWzZta1MWQUqmsWBywTsPhqb1evWD5+mJ xJ+oDj7UR8fgeixohYvoNhVbOWG6/caTDenMNPodo5Avw9WrlMOv+5wnojL6qbHQIIOe GDH0aV7xLNrvnXBsqrOZUYoxmTV/fzp3tk4vXL1lP0gLbuuh4Nc/APwJVT7FYZWuqnNT wN1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=FakhO3efxXs79fOL17bUjDsDDzuXwblSHaFpqeVimdw=; fh=trmellB29dKXoILfh5Lhe6lqLUsBKS7MIJVbjI1eWOc=; b=jOXzujGrMOm22jk5oC5oomlXmKd6iBHcJwCvhuEolpwOdwwzZ/PysbCF9ivq4PJ4KM txOyEZ5xI591lunFB+kPFnhLbniKEOYt+a9qliEsU99Axlz88qaXkERX+dmA63+o1CBS OIvVgqz0o78tzh1XklA+Vn58brbOwX09iJH8/jFRiVAp9bxvVH+JxGQs2zj2zSp+Y1Xo T3UBP7jrwNP5SRB8hoqVZ9Dwnygu0E8fqD8IavrY12AnY9lP3288NfJ2CsCMZ7bp9s/3 fSOzj/b8J9c+0sRfrS9vY31U76KzzH0upnLuKjjMs83Ds9uedy3o0WH37FRboKklacRW kUCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=bTuSMkUB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j21-20020a170906255500b00993a37985dfsi1424010ejb.179.2023.07.18.11.25.20; Tue, 18 Jul 2023 11:25:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=bTuSMkUB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232825AbjGRRuh (ORCPT + 99 others); Tue, 18 Jul 2023 13:50:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232342AbjGRRue (ORCPT ); Tue, 18 Jul 2023 13:50:34 -0400 Received: from mail-qv1-xf35.google.com (mail-qv1-xf35.google.com [IPv6:2607:f8b0:4864:20::f35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD840C0 for ; Tue, 18 Jul 2023 10:50:33 -0700 (PDT) Received: by mail-qv1-xf35.google.com with SMTP id 6a1803df08f44-635dd1b52a2so31416056d6.3 for ; Tue, 18 Jul 2023 10:50:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1689702633; x=1692294633; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=FakhO3efxXs79fOL17bUjDsDDzuXwblSHaFpqeVimdw=; b=bTuSMkUBvr4fylgeHAiAN25RP9JNHB7zTbDbqfWscsW2JgPB8o/8BeqWZQO/eXySTO slzdF+ITVkW8uOs8DMMyUiQdCVU1wjDg0vTuOvYmRLlVe9KNyOG3PNVGEEilR+9sUvxE VmqMGsuv3b9C0SNBB4uK3Og7dysZddca/g1zuNtjMVdk/r07Z2xTFkgTPL0VJAREIYmi 28JrcRod5na0FQm1k1l8AEa2IshKh1vWVfPS5hpNUkb6YeLhVny8G+aJr49jF1mrjAdI sy2GvtCPN74I9Y4Ggd0UK+bW2+OhUDYsSytk/fWCG1oazheZguiZAS9aSVWUK2VdWYlp lnLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689702633; x=1692294633; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FakhO3efxXs79fOL17bUjDsDDzuXwblSHaFpqeVimdw=; b=QoVNcU8N0qxyej7i07GG1ko+kPBLaN2EADvl6/vX5cGDwc6EivU7IxGERwDT+/kxBr znnfHJbCIuoylc9UoyupkFrSKlzklg/3WJAge5g7OCdOVqB5rprJ8i77LewKuwqIN37v 4YTeqEvVKXUghGM7FKhjKWxx8RJZyw8oNnhU/IGcsjSeuWrbGkVUpTw+Cw2YaKu90VOk Ae+/01h8hJTWvp2T6hCCi3niH/8IpWw8AjYHiDfVoJUHNZqHhEL6RoSy4XX1JYU4cckW hwxubkgFF3zfEK/N8+mZ1zfgLVqx2HIu8Vew5N7qq04Ga9r1SSRlBlUnlKz7H6psa2P9 QJkw== X-Gm-Message-State: ABy/qLbFsXn/HkWSFmgNHhoRAH6Y/2UgqNPEHeMu8x/L4aZaczREPz6Y 8mjVCm6l77WqYdZK8/e0RzzoZhJYiqBvA8hpqKCWuw== X-Received: by 2002:a0c:d990:0:b0:635:f23e:ef97 with SMTP id y16-20020a0cd990000000b00635f23eef97mr14273252qvj.7.1689702632732; Tue, 18 Jul 2023 10:50:32 -0700 (PDT) MIME-Version: 1.0 References: <20230717-enable-kasan-lto1-v2-1-d47bf182f5c6@gmail.com> In-Reply-To: <20230717-enable-kasan-lto1-v2-1-d47bf182f5c6@gmail.com> From: Nick Desaulniers Date: Tue, 18 Jul 2023 10:50:21 -0700 Message-ID: Subject: Re: [PATCH v2] arch: enable HAS_LTO_CLANG with KASAN and KCOV To: Jakob Koschel Cc: Andrew Morton , Nathan Chancellor , Tom Rix , Kees Cook , linux-kernel@vger.kernel.org, llvm@lists.linux.dev Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 17, 2023 at 11:49=E2=80=AFPM Jakob Koschel wrote: > > Both KASAN and KCOV had issues with LTO_CLANG if DEBUG_INFO is enabled. > With LTO inlinable function calls are required to have debug info if > they are inlined into a function that has debug info. > > Starting with LLVM 17 this will be fixed ([1],[2]) and enabling LTO with > KASAN/KCOV and DEBUG_INFO doesn't cause linker errors anymore. > > Link: https://github.com/llvm/llvm-project/commit/913f7e93dac67ecff47bade= 862ba42f27cb68ca9 > Link: https://github.com/llvm/llvm-project/commit/4a8b1249306ff11f229320a= bdeadf0c215a00400 > Reviewed-by: Nathan Chancellor > Signed-off-by: Jakob Koschel > --- > Changes in v2: > - Added correct To:/Cc: > - Added comment about required LLVM 17 version dependency > - Link to v1: https://lore.kernel.org/r/20230717-enable-kasan-lto1-v1-1-4= 71e706a5c4e@gmail.com > --- > arch/Kconfig | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/arch/Kconfig b/arch/Kconfig > index aff2746c8af2..d722bcfcc870 100644 > --- a/arch/Kconfig > +++ b/arch/Kconfig > @@ -745,7 +745,10 @@ config HAS_LTO_CLANG > depends on $(success,$(AR) --help | head -n 1 | grep -qi llvm) > depends on ARCH_SUPPORTS_LTO_CLANG > depends on !FTRACE_MCOUNT_USE_RECORDMCOUNT > - depends on !KASAN || KASAN_HW_TAGS > + # KASAN & KCOV were missing necessary debug information prior to = LLVM 17 > + # which are required with LTO. Hi Jakob, Thanks for follow up with a v2. I think Nathan meant he was literally looking for a link here in the comment, like: # https://github.com/ClangBuiltLinux/linux/issues/1721 Mind sending a v3 with that? You can replace the comment you added to arch/Kconfig in v2 outright with that link. If folks need to know more they can follow that link or run git blame on it= . > + depends on (!KASAN || KASAN_HW_TAGS || CLANG_VERSION >=3D 170000)= || !DEBUG_INFO > + depends on (!KCOV || CLANG_VERSION >=3D 170000) || !DEBUG_INFO > depends on !GCOV_KERNEL > help > The compiler and Kconfig options support building with Clang's > > --- > base-commit: fdf0eaf11452d72945af31804e2a1048ee1b574c > change-id: 20230717-enable-kasan-lto1-656754c76241 > > Best regards, > -- > Jakob Koschel > --=20 Thanks, ~Nick Desaulniers