Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3132391ybt; Mon, 29 Jun 2020 16:22:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyuIfKXzKk6wkfehFsuspFGgrvTyETSzDFY7gqMooYLcpOob1ub/HQ/XZ6hkaL2gYyiweIS X-Received: by 2002:a50:cdc6:: with SMTP id h6mr19765364edj.111.1593472939954; Mon, 29 Jun 2020 16:22:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593472939; cv=none; d=google.com; s=arc-20160816; b=ZewoKEqr24c9JNtbStu93zcrmk+c1tpl4SNO5446xW5wb/YWamSmhTyaxR+AVzS9C9 XCSVsW5GPMzKWqUIG1lr6yqX7lKqQx3ngGtUWjMCgdsmK+IOwbnHqq5N8K5462FaUwDy l+gdhR4+VJDQ8Hd7e+7hTLxRJUPSKMFK+11aJTSZR51wxhU7jfXTmBl0RvVOstfggu2a Y81HNNS8EdB9QN6+BWkwVA1mUsQsftw0KTBoIseiePutXUPsMo4UaZtk3QNN4ToYbsgO yaRQFxwcNg66ep2Ol33k/8Bc3X5h1ZAFrDDAU7/reJVqaZvpEkhd0/JqvQ9kThK7PSd5 cuhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Y3eOZWqjsfvFABJlAWadxHNb9WOoW2QZW11FNR7qgIM=; b=xA4Lgk9oaUN/FZwhRNwe939LjjJand5m4T8hnKJ3Yw8nuVo3YQRj4r8O4eOO+4pd9y TfmqDkahxOKCHwYyid+rahGwBy96FJVSUgbwbyJL9dV5HSzfzfWEHN00IBlMGppzfPrQ l+slfCFossdU04XbNl2gLDyJFvD7jc0VjYPjloaGIusJsEbG0okXIKGiRRu5sAWhCjAx mZc4vq/Kaznamr5iCniAOaA8qPsoccVEbqJDNwuLk8PXjbK3Rb9ds+SPmGgpHvzfcbFY 5ixwc1Pl8ZqQrYNchqV4MYUIv/pxHqkLKquBfFAb79GORBUKsFAcZtGmwM5YAcf6c4fc KhTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=wE7nxuQQ; 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 g22si586655edm.294.2020.06.29.16.21.56; Mon, 29 Jun 2020 16:22:19 -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=wE7nxuQQ; 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 S1729704AbgF2XVH (ORCPT + 99 others); Mon, 29 Jun 2020 19:21:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728706AbgF2XVG (ORCPT ); Mon, 29 Jun 2020 19:21:06 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CFDEC03E97A for ; Mon, 29 Jun 2020 16:21:06 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id l63so9001255pge.12 for ; Mon, 29 Jun 2020 16:21:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Y3eOZWqjsfvFABJlAWadxHNb9WOoW2QZW11FNR7qgIM=; b=wE7nxuQQ8Ee1SyIlOGu96foC1kguVLhQnWfsM449qkfn/VoKBCtsVMOqOmKx7IZI4C RVaEjdafrzkZKrdHnHpUfIuUaR+nDUOQdXro+nnJx5XibnwFB04m0UpfLU8lcAfNzunK FH4vq/4AmRKx0OXYjTpIwOSmyWjemlGQQrsAim9D+osZfnHYYrMcyKBMOA6AcmZTCt7D SC8HEZlX2KwR8OsKRbEGGGO82nQHiO6QrFnPdGaYVsrLOIGowYuaQm3rOF21PeyeGPnP uhJe537nfOotmxkifcJzP2KlYRs06hCp+YYdixCMO/J34Bhc2jSz49ZJoQbscAlwSyYN PnZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Y3eOZWqjsfvFABJlAWadxHNb9WOoW2QZW11FNR7qgIM=; b=uGZvWq3NCJeK8nzruyfsKDyamO8A2vkpYfbJUqD23yOsVKIAy88WqYIT6uWrY4GsO3 nbBfp9BBSAB2ZWS5LOn3hKAokCOzarqcvf73i/YodsxiqrX9tJ4zHMaaC1tTYXUiiWJq PDY5M3RN/T5PEyUl5um2Ud/IyaW3CjeeapKiCahy/ZLPJqe2a+f5QCbpFSpyUk6IlAjD Z5vArZYHeF+8xEn77H4kMj2keE2Sz33Jse1jsXa/1pCIkjuBCk47EVdLeYSvEf/vGtn5 NY+rR0znijZPVZ6cBMQp/Y/TcV8lO17H1Sjx9K1gJM//7tn9Cn3HH/Oh649SpY2aD0Z1 w8Kg== X-Gm-Message-State: AOAM530N6aMSyfmhH8+pioGbHHod6+fMCTwy2/J+4rIkXamzHJLRcnJH rT0oYaSWYeBqsIwf4xMcv+khIA== X-Received: by 2002:a62:ce48:: with SMTP id y69mr15584876pfg.208.1593472865320; Mon, 29 Jun 2020 16:21:05 -0700 (PDT) Received: from google.com ([2620:15c:201:2:ce90:ab18:83b0:619]) by smtp.gmail.com with ESMTPSA id d9sm722596pgg.74.2020.06.29.16.21.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jun 2020 16:21:04 -0700 (PDT) Date: Mon, 29 Jun 2020 16:20:59 -0700 From: Sami Tolvanen To: Masahiro Yamada Cc: Will Deacon , Greg Kroah-Hartman , "Paul E. McKenney" , Kees Cook , Nick Desaulniers , clang-built-linux , Kernel Hardening , linux-arch , linux-arm-kernel , Linux Kbuild mailing list , Linux Kernel Mailing List , linux-pci@vger.kernel.org, X86 ML Subject: Re: [PATCH 00/22] add support for Clang LTO Message-ID: <20200629232059.GA3787278@google.com> References: <20200624203200.78870-1-samitolvanen@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Masahiro, On Mon, Jun 29, 2020 at 01:56:19AM +0900, Masahiro Yamada wrote: > On Thu, Jun 25, 2020 at 5:32 AM 'Sami Tolvanen' via Clang Built Linux > wrote: > > > > This patch series adds support for building x86_64 and arm64 kernels > > with Clang's Link Time Optimization (LTO). > > > > In addition to performance, the primary motivation for LTO is to allow > > Clang's Control-Flow Integrity (CFI) to be used in the kernel. Google's > > Pixel devices have shipped with LTO+CFI kernels since 2018. > > > > Most of the patches are build system changes for handling LLVM bitcode, > > which Clang produces with LTO instead of ELF object files, postponing > > ELF processing until a later stage, and ensuring initcall ordering. > > > > Note that first objtool patch in the series is already in linux-next, > > but as it's needed with LTO, I'm including it also here to make testing > > easier. > > > I put this series on a testing branch, > and 0-day bot started reporting some issues. Yes, I'll fix those issues in v2. > (but 0-day bot is quieter than I expected. > Perhaps, 0-day bot does not turn on LLVM=1 ?) In order for it to test an LTO build, it would need to enable LTO_CLANG explicitly though, in addition to LLVM=1. > I also got an error for > ARCH=arm64 allyesconfig + CONFIG_LTO_CLANG=y > > > > $ make ARCH=arm64 LLVM=1 LLVM_IAS=1 > CROSS_COMPILE=~/tools/aarch64-linaro-7.5/bin/aarch64-linux-gnu- > -j24 > > ... > > GEN .version > CHK include/generated/compile.h > UPD include/generated/compile.h > CC init/version.o > AR init/built-in.a > GEN .tmp_initcalls.lds > GEN .tmp_symversions.lds > LTO vmlinux.o > MODPOST vmlinux.symvers > MODINFO modules.builtin.modinfo > GEN modules.builtin > LD .tmp_vmlinux.kallsyms1 > ld.lld: error: undefined symbol: __compiletime_assert_905 > >>> referenced by irqbypass.c > >>> vmlinux.o:(jeq_imm) > make: *** [Makefile:1161: vmlinux] Error 1 I can reproduce this with ToT LLVM and it's BUILD_BUG_ON_MSG(..., "value too large for the field") in drivers/net/ethernet/netronome/nfp/bpf/jit.c. Specifically, the FIELD_FIT / __BF_FIELD_CHECK macro in ur_load_imm_any. This compiles just fine with an earlier LLVM revision, so it could be a relatively recent regression. I'll take a look. Thanks for catching this! Sami