Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1670832ybt; Thu, 25 Jun 2020 11:16:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzzzSuibcbT2N+wNH4Hjdcj48J7UzwkoeRgMft4LUs1hhmLClnKepn9G0hm9tL4A/iydWeR X-Received: by 2002:a17:906:2b92:: with SMTP id m18mr32542866ejg.218.1593108982944; Thu, 25 Jun 2020 11:16:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593108982; cv=none; d=google.com; s=arc-20160816; b=ixFsZ71PuDbFRJPp7LVs5BNG/chSfxx30envRcrjFRL9Rm4b+PKB02OT1yJA9m26Nl xBaN95dRJuKDhPr6CTWU/sJCEamtKMIW8b5nQ0JsHoLXnMcQ1c42oM9NK0zcunbkLRX+ AN1V6cGIBIQcLnn0kxdgoGqu0vOLVrIPeqC+rdCUUH48Yn341wOlA8RLL6hHsWfOld7I lNp84qzT0se2Z+3dn6XkaGBzYyMaCnqn8O9H/EDy4zMWXDXRgfby+o30wotAsWszW86z TWWytcGrrTzJXHtaIkmfg+hQtKj85xWcURuf5vKczn37uxXHHbpIJgF+9qCXKnzmwgeI TqVQ== 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=cYEaM8fKpZG71PCkfHkApRmPtCwvXrrY+JocHC3nIv8=; b=S/9mDTn8NWnE2IsZeTqudLVZG96IUaFoZgfHR9mOx2sQEynrdow1qd4az4kSoSSBwd ZYs1mp8B/17tkWhxj8heCdujBuzkOKzmv9dlpbjMOjx9hlhn8Q9vBcnJAjXTWHYZuUZk d7prxxcWLAzSgSQT0p9QQnznmXQWagC+YAEfKU/d0GbwN+L7IhiNp3TGJpS2xH210zPk kiLnxFSvRMURAiK6YeDaAEZauF1u5oJ8xEmkDcbrDT0mVe+QZ3dpgzvE7VFKM9O4Xv/H YtHmhmi7m0xv6oQB5qV3oTXu1yZW5xHMZZ1boXs0Ch1ZePqrhb/9bOZp7EVq6a2mLDPP 5LYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=XvqTcKvU; 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 bi8si17620903edb.602.2020.06.25.11.15.59; Thu, 25 Jun 2020 11:16:22 -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=XvqTcKvU; 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 S2405922AbgFYQWf (ORCPT + 99 others); Thu, 25 Jun 2020 12:22:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390728AbgFYQWe (ORCPT ); Thu, 25 Jun 2020 12:22:34 -0400 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9F3BC08C5DC for ; Thu, 25 Jun 2020 09:22:34 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id j12so3228452pfn.10 for ; Thu, 25 Jun 2020 09:22:34 -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=cYEaM8fKpZG71PCkfHkApRmPtCwvXrrY+JocHC3nIv8=; b=XvqTcKvUnBqjH+Xq2/BDnD76lMTzDE39N73VPsal3e7jDR5L9CqPzEwi/HtJXxg5pZ sSViKozmxlxfRjR5junnpvtTtyW6G2rRQEW8ZFvCQk6aCeqvQ+zuO9yimSN9sFS7QooW PvXgArAb+SfCZcIY+Pqu9KdLFcAqo8UvqBCXGiy9t48Z69ZF5FReGe2odlppsG/6UARl Mdd0bQaWJWxZe0j9OL67jRPrRKjRhuCt16S32a8eOmCrvrHTXERopZ1dh0M2Ua2NwCSI Ek6M040jALm4P02V4qkx9xuhsfQb+UTvzenYTCIy4JIByKPSb7KkGeYN6II1dO0BKO5s 5Xmw== 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=cYEaM8fKpZG71PCkfHkApRmPtCwvXrrY+JocHC3nIv8=; b=HZlK8s0s1hKmvnj8ADUoZeH2xXdYChzaN3vXPoRPOG/pGlkix2fs1SXvha0QCwYvdv NCLXyblEjXqGTs/CGPD+ubi2KV3JviSXkXN53n+6EAyZf/u1TdpsER7skqd0V7Dc7+nJ IdtE2apelhoLsvmNgYFklHSSzS4H5owlp2jKyw5f/KJ009k8lpJKX1pmmGAWXflz7ldc ahAMwNhTS5ZWJyml+TRVrsnmRXK1C0e597Gj6+4jTEFSLku66YUup+PS67N/fJ0fapjS qiR0CxMX+KUOULAZMBD6AcRRDr6iHypLAKKGBQLHUDPQkQzXFGqDKJalnKZJOI2zNHiG W+Rg== X-Gm-Message-State: AOAM531aJpucj5uKL/M5kvG1kre15UjDvVfzQRmVpbVD0qM7uy1gkHfB V98VHUGUJzqyWb2VmHhX8W9eQg== X-Received: by 2002:a63:7313:: with SMTP id o19mr27664372pgc.307.1593102153849; Thu, 25 Jun 2020 09:22:33 -0700 (PDT) Received: from google.com ([2620:15c:201:2:ce90:ab18:83b0:619]) by smtp.gmail.com with ESMTPSA id 7sm10151225pgh.80.2020.06.25.09.22.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jun 2020 09:22:32 -0700 (PDT) Date: Thu, 25 Jun 2020 09:22:26 -0700 From: Sami Tolvanen To: Peter Zijlstra Cc: Masahiro Yamada , Will Deacon , Greg Kroah-Hartman , "Paul E. McKenney" , Kees Cook , Nick Desaulniers , clang-built-linux@googlegroups.com, kernel-hardening@lists.openwall.com, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH 05/22] kbuild: lto: postpone objtool Message-ID: <20200625162226.GC173089@google.com> References: <20200624203200.78870-1-samitolvanen@google.com> <20200624203200.78870-6-samitolvanen@google.com> <20200624211908.GT4817@hirez.programming.kicks-ass.net> <20200624214925.GB120457@google.com> <20200625074716.GX4817@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200625074716.GX4817@hirez.programming.kicks-ass.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 25, 2020 at 09:47:16AM +0200, Peter Zijlstra wrote: > On Wed, Jun 24, 2020 at 02:49:25PM -0700, Sami Tolvanen wrote: > > On Wed, Jun 24, 2020 at 11:19:08PM +0200, Peter Zijlstra wrote: > > > On Wed, Jun 24, 2020 at 01:31:43PM -0700, Sami Tolvanen wrote: > > > > diff --git a/include/linux/compiler.h b/include/linux/compiler.h > > > > index 30827f82ad62..12b115152532 100644 > > > > --- a/include/linux/compiler.h > > > > +++ b/include/linux/compiler.h > > > > @@ -120,7 +120,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, > > > > /* Annotate a C jump table to allow objtool to follow the code flow */ > > > > #define __annotate_jump_table __section(.rodata..c_jump_table) > > > > > > > > -#ifdef CONFIG_DEBUG_ENTRY > > > > +#if defined(CONFIG_DEBUG_ENTRY) || defined(CONFIG_LTO_CLANG) > > > > /* Begin/end of an instrumentation safe region */ > > > > #define instrumentation_begin() ({ \ > > > > asm volatile("%c0:\n\t" \ > > > > > > Why would you be doing noinstr validation for lto builds? That doesn't > > > make sense. > > > > This is just to avoid a ton of noinstr warnings when we run objtool on > > vmlinux.o, but I'm also fine with skipping noinstr validation with LTO. > > Right, then we need to make --no-vmlinux work properly when > !DEBUG_ENTRY, which I think might be buggered due to us overriding the > argument when the objname ends with "vmlinux.o". Right. Can we just remove that and pass --vmlinux to objtool in link-vmlinux.sh, or is the override necessary somewhere else? > > > > +ifdef CONFIG_STACK_VALIDATION > > > > +ifneq ($(SKIP_STACK_VALIDATION),1) > > > > +cmd_ld_ko_o += \ > > > > + $(objtree)/tools/objtool/objtool \ > > > > + $(if $(CONFIG_UNWINDER_ORC),orc generate,check) \ > > > > + --module \ > > > > + $(if $(CONFIG_FRAME_POINTER),,--no-fp) \ > > > > + $(if $(CONFIG_GCOV_KERNEL),--no-unreachable,) \ > > > > + $(if $(CONFIG_RETPOLINE),--retpoline,) \ > > > > + $(if $(CONFIG_X86_SMAP),--uaccess,) \ > > > > + $(@:.ko=$(prelink-ext).o); > > > > + > > > > +endif # SKIP_STACK_VALIDATION > > > > +endif # CONFIG_STACK_VALIDATION > > > > > > What about the objtool invocation from link-vmlinux.sh ? > > > > What about it? The existing objtool_link invocation in link-vmlinux.sh > > works fine for our purposes as well. > > Well, I was wondering why you're adding yet another objtool invocation > while we already have one. Because we can't run objtool until we have compiled bitcode to native code, so for modules, we're need another invocation after everything has been compiled. Sami