Message ID | 20230623001140.1111494-4-samitolvanen@google.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp5435379vqr; Thu, 22 Jun 2023 17:34:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ67x4u6dkOSmAQjto2Jo6Swo8qdprw9kc9jizCifti/gyBdhJw+Ep08oLU2g2jL1sAt2CQ4 X-Received: by 2002:a05:6a20:7f99:b0:10e:d4fb:b031 with SMTP id d25-20020a056a207f9900b0010ed4fbb031mr15343573pzj.61.1687480496758; Thu, 22 Jun 2023 17:34:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687480496; cv=none; d=google.com; s=arc-20160816; b=lMixNQIkE+fj0im0XlWwOMklQo1frABXIZxLr03r2aWqe/V60o1UTVl/sKoj3ox3Um F0nEGxPfxJBopo/vA3+eL5oZPiExD3eXJNrf5AAYIND8YO/qdlNyIl8hMhx4xI+pvGOt tdHoignO1SOrTDRmnqQLmyQ5dfnCFESFbd0tnDdZDY3qbhtYH8onv/B+TvvPSYaZUBUl OURevwbRQQf595qokoXa40iNYzGbF9PGkow2K8APg1i+cbmzcv9ZibZCQtxo696Oyr2V ESYvkQkiw/IZaFPhX8yG1bVVuUI2HBLVg4bKst2H40noxewFilGeQO+KJBM6QlxMHTo7 q58w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:mime-version:date :dkim-signature; bh=5oekcbpWaYM+RGe3QAFehRbvyX8WllQ5GlGqpNCW54M=; b=OYqQz0zo+YjimGPUN8zqtN3qeEH5eIwWaKhSIajGG/CssAhGSPElBIPfPz5TDSkzXn DdMDC9kcQisTyKaBycL+eQiR5xHRctK9YYFXf3EEObKdFiyiqWZXgnvXdwhJdkQPSPFp 7iPYSuf/Vdb1iORERDYWmHRwDREmvblfel311Z8mbE1XHS9UZ0D1E3hJYFUI7ooJSkcT 32Hmx/yR0JZllitv7uwezkrIVtJZ2yoX3LrKqQq6mCEaF91HtI9rHyPT7k89/CEZc8Ra cs7EFUeKXN53jRZiqzi3KDDKlxXWmC0hGvbhy/pX8tGuVjzAKjQFwoVJuezEAmUr7+Us rdTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=Rdb6IeNa; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i187-20020a6254c4000000b0066888630a21si7459978pfb.67.2023.06.22.17.34.44; Thu, 22 Jun 2023 17:34:56 -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=Rdb6IeNa; 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 S231789AbjFWALr (ORCPT <rfc822;maxin.john@gmail.com> + 99 others); Thu, 22 Jun 2023 20:11:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230519AbjFWALq (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 22 Jun 2023 20:11:46 -0400 Received: from mail-pg1-x54a.google.com (mail-pg1-x54a.google.com [IPv6:2607:f8b0:4864:20::54a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D302AC6 for <linux-kernel@vger.kernel.org>; Thu, 22 Jun 2023 17:11:44 -0700 (PDT) Received: by mail-pg1-x54a.google.com with SMTP id 41be03b00d2f7-553d076dce5so71411a12.3 for <linux-kernel@vger.kernel.org>; Thu, 22 Jun 2023 17:11:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1687479104; x=1690071104; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=5oekcbpWaYM+RGe3QAFehRbvyX8WllQ5GlGqpNCW54M=; b=Rdb6IeNa+bN582kGK3qp4Ii4rozTCVuUQQpEgBAs6zPE7ZRSP7TQtPZ3NPBWlRL1tM t04koMz43/pvfmmFxz/6CBOzsO9Vs7uk+c7s8NDsE+N0GSQp3PzITuPhz9a7gTu2Mi5N J3weAAdvQPHuoOLsMrmnUfuI3Y426aWWtjCblobFURtiRe9q8ccjcp58x0iIuZr8IG2W lZY9bsnUTX4RfzQ5RagfFmnXCn3hj889q6PoX7fMeBzJSgmpXXSagS0qrBu5GZxo4j4L xnF/sFFXm28NDNZCMab0/wcgJ/P8/CqAiVT9dDqOZ3DagKfQzFIFSag822sHncBtM7Hd KPuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687479104; x=1690071104; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=5oekcbpWaYM+RGe3QAFehRbvyX8WllQ5GlGqpNCW54M=; b=GhkJkwAqGontY6GEXSl74JQaD58q8QeEU9oNeN6AiDI2UIkVod904UX0rWqv2wW3gx CeTzQgiBPOoCX/vfdCDdTKno42b5jgVYNqZyqzwJ+h9pT0nkwpifLYst7Dtzm/CiL9Uu /5nqPw4uYUjMd/5qlTSV8uNIs0X5htaVtAOx79bo8cINBXkHWZx4ygX8Y2tZiC2mYEdw iVRIepd6nja80rUWB/3HUJUdlhGGpf2vimXNmZHHwwWojCOyDUIz2QxA6S3HC6NIgKq9 Q+fD4YMlUAMKCKQJBzVtlo3/fMezmkf8JNj3Xw8rWn+QzVsIGiCOgmgaX9NOb0t8Jagg 3eVA== X-Gm-Message-State: AC+VfDzLajJD02BjFAElztp+SNd5uToSVh9GKJyWE4SQjIs1QePr/wBs EOgZQC4j2ozWMHNUhc/cit1/MViktsRVkx4wV6Y= X-Received: from samitolvanen.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:4f92]) (user=samitolvanen job=sendgmr) by 2002:a63:5b15:0:b0:557:3c4e:5769 with SMTP id p21-20020a635b15000000b005573c4e5769mr787928pgb.3.1687479104229; Thu, 22 Jun 2023 17:11:44 -0700 (PDT) Date: Fri, 23 Jun 2023 00:11:41 +0000 Mime-Version: 1.0 X-Developer-Key: i=samitolvanen@google.com; a=openpgp; fpr=35CCFB63B283D6D3AEB783944CB5F6848BBC56EE X-Developer-Signature: v=1; a=openpgp-sha256; l=693; i=samitolvanen@google.com; h=from:subject; bh=6A3Z0VekOrcAMCMCoSBjX+Qi/VC1cWGyR/zEJyxpVoc=; b=owEB7QES/pANAwAKAUy19oSLvFbuAcsmYgBklOM8IwI7R/Crn8VEyZ1topwBBLxf1CeJ9XSJl p3FBTr7u5OJAbMEAAEKAB0WIQQ1zPtjsoPW0663g5RMtfaEi7xW7gUCZJTjPAAKCRBMtfaEi7xW 7mugC/9MpcW5D0WhaaWUZM8C+JzHLa9JJbPhg9hFYjXWL+Rwxh6hi7X6iGTW5gfIJ2Ar6ogm/yU CuPjeOilA9lpCS7UZBbG95xG49nZ/T69c4bYi7G0hi99r4WW+ToN9ZF82izlKGmIekKCiFrDLgl Ie7NTBQ3yMll03uKWi0Gyq2joN795JLMIwr2A9Oi/NIU72vxhUv+PXRI1J5M4wZRXeobAMojmpk QMPTRn5yh+fLLhBgDQRyRcdtWq5c0DPnomwNttFc1ilPg5KLH1kHpp5S4p4Bksp4NgGMPLIUssg WkN6j6kOkknD8IWznyBNa9tVZsk53Jzg239w4PWwE+R4AcnRxTNxy7U8fTDYtw9maeU7mQxh14q XtqdL7lx4s0aLqIv7ME/NinZ58oXfTbHrEbE0wMhuMK55Zr7nyQ1ix/ciaj1PTZH4XZpFRX0gdH 1BvtUZoas2rrY8vuyqrgYGXm/VXk2gJ/TA/uTdSdfEFtbUTTtI/ov2gNFSkKVyePeWVmY= X-Mailer: git-send-email 2.41.0.162.gfafddb0af9-goog Message-ID: <20230623001140.1111494-4-samitolvanen@google.com> Subject: [PATCH 0/2] Fix CFI failures with GCOV_PROFILE_ALL From: Sami Tolvanen <samitolvanen@google.com> To: Masahiro Yamada <masahiroy@kernel.org>, "Peter Zijlstra (Intel)" <peterz@infradead.org>, Kees Cook <keescook@chromium.org> Cc: Nathan Chancellor <nathan@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, Nicolas Schier <nicolas@fjasle.eu>, Tom Rix <trix@redhat.com>, linux-kbuild@vger.kernel.org, llvm@lists.linux.dev, linux-kernel@vger.kernel.org, Sami Tolvanen <samitolvanen@google.com> Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769451549314873082?= X-GMAIL-MSGID: =?utf-8?q?1769451549314873082?= |
Series |
Fix CFI failures with GCOV_PROFILE_ALL
|
|
Message
Sami Tolvanen
June 23, 2023, 12:11 a.m. UTC
Hi folks, The following two patches fix CFI failures with GCOV_PROFILE_ALL, where the compiler injects indirectly called functions to object files that otherwise contain no executable code, and are not processed by objtool or don't have CFI enabled. This results in missing or incorrect type hashes during boot and when modules are loaded. Sami Tolvanen (2): kbuild: Fix CFI failures with GCOV kbuild: Disable GCOV for *.mod.o init/Makefile | 1 + scripts/Makefile.modfinal | 2 +- scripts/Makefile.vmlinux | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) base-commit: 007034977130b49b618a5206aad54f634d9f169c
Comments
On Fri, Jun 23, 2023 at 12:11:41AM +0000, Sami Tolvanen wrote: > Hi folks, > > The following two patches fix CFI failures with GCOV_PROFILE_ALL, > where the compiler injects indirectly called functions to object > files that otherwise contain no executable code, and are not > processed by objtool or don't have CFI enabled. This results in > missing or incorrect type hashes during boot and when modules are > loaded. > > Sami Tolvanen (2): > kbuild: Fix CFI failures with GCOV > kbuild: Disable GCOV for *.mod.o > > init/Makefile | 1 + > scripts/Makefile.modfinal | 2 +- > scripts/Makefile.vmlinux | 1 + > 3 files changed, 3 insertions(+), 1 deletion(-) > Urgh, tricky stuff this. Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> And yes, objtool essentially assumes vmlinux.o is complete and does LTO like passes. Is there something kbuild can do to ensure noting else gets linked in after this?
On Fri, Jun 23, 2023 at 12:11:41AM +0000, Sami Tolvanen wrote: > Hi folks, > > The following two patches fix CFI failures with GCOV_PROFILE_ALL, > where the compiler injects indirectly called functions to object > files that otherwise contain no executable code, and are not > processed by objtool or don't have CFI enabled. This results in > missing or incorrect type hashes during boot and when modules are > loaded. > > Sami Tolvanen (2): > kbuild: Fix CFI failures with GCOV > kbuild: Disable GCOV for *.mod.o > > init/Makefile | 1 + > scripts/Makefile.modfinal | 2 +- > scripts/Makefile.vmlinux | 1 + > 3 files changed, 3 insertions(+), 1 deletion(-) Nice hunting! Reviewed-by: Kees Cook <keescook@chromium.org> Should these get Cc: stable tags maybe?
On Thu, Jun 22, 2023 at 5:11 PM Sami Tolvanen <samitolvanen@google.com> wrote: > > Hi folks, > > The following two patches fix CFI failures with GCOV_PROFILE_ALL, > where the compiler injects indirectly called functions to object > files that otherwise contain no executable code, and are not > processed by objtool or don't have CFI enabled. This results in > missing or incorrect type hashes during boot and when modules are > loaded. > > Sami Tolvanen (2): > kbuild: Fix CFI failures with GCOV > kbuild: Disable GCOV for *.mod.o > > init/Makefile | 1 + > scripts/Makefile.modfinal | 2 +- > scripts/Makefile.vmlinux | 1 + > 3 files changed, 3 insertions(+), 1 deletion(-) Thanks for the patches! Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> > > > base-commit: 007034977130b49b618a5206aad54f634d9f169c > -- > 2.41.0.162.gfafddb0af9-goog > >
On Fri, Jun 23, 2023 at 9:32 AM Kees Cook <keescook@chromium.org> wrote: > > On Fri, Jun 23, 2023 at 12:11:41AM +0000, Sami Tolvanen wrote: > > Hi folks, > > > > The following two patches fix CFI failures with GCOV_PROFILE_ALL, > > where the compiler injects indirectly called functions to object > > files that otherwise contain no executable code, and are not > > processed by objtool or don't have CFI enabled. This results in > > missing or incorrect type hashes during boot and when modules are > > loaded. > > > > Sami Tolvanen (2): > > kbuild: Fix CFI failures with GCOV > > kbuild: Disable GCOV for *.mod.o > > > > init/Makefile | 1 + > > scripts/Makefile.modfinal | 2 +- > > scripts/Makefile.vmlinux | 1 + > > 3 files changed, 3 insertions(+), 1 deletion(-) > > Nice hunting! > > Reviewed-by: Kees Cook <keescook@chromium.org> > > Should these get Cc: stable tags maybe? I was under the impression that Fixes: tags would be sufficient these days, but agreed, explicit Cc: probably wouldn't hurt. Sami
On Sat, Jun 24, 2023 at 5:39 AM Sami Tolvanen <samitolvanen@google.com> wrote: > > On Fri, Jun 23, 2023 at 9:32 AM Kees Cook <keescook@chromium.org> wrote: > > > > On Fri, Jun 23, 2023 at 12:11:41AM +0000, Sami Tolvanen wrote: > > > Hi folks, > > > > > > The following two patches fix CFI failures with GCOV_PROFILE_ALL, > > > where the compiler injects indirectly called functions to object > > > files that otherwise contain no executable code, and are not > > > processed by objtool or don't have CFI enabled. This results in > > > missing or incorrect type hashes during boot and when modules are > > > loaded. > > > > > > Sami Tolvanen (2): > > > kbuild: Fix CFI failures with GCOV > > > kbuild: Disable GCOV for *.mod.o > > > > > > init/Makefile | 1 + > > > scripts/Makefile.modfinal | 2 +- > > > scripts/Makefile.vmlinux | 1 + > > > 3 files changed, 3 insertions(+), 1 deletion(-) > > > > Nice hunting! > > > > Reviewed-by: Kees Cook <keescook@chromium.org> > > > > Should these get Cc: stable tags maybe? > > I was under the impression that Fixes: tags would be sufficient these > days, but agreed, explicit Cc: probably wouldn't hurt. > > Sami Both applied to linux-kbuild. I also think Fixes: tags would be enough to make them back-ported.