Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4389330pxb; Tue, 26 Jan 2021 22:00:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJy4Xsf6ThNuQBlJ86gvXTQk7m0z7KKKPEjfUH3LvDaeI8IlZznTKsnFojUaguFVw/ETuwux X-Received: by 2002:a05:6402:1422:: with SMTP id c2mr7369888edx.280.1611727237363; Tue, 26 Jan 2021 22:00:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611727237; cv=none; d=google.com; s=arc-20160816; b=qPb7Ciux3N15usozxYpA6OcYYjYM1u+xzy2VNL19UTx4Oe6qZzLYlG2hw3qKnP4VYG nJAsT3JEkbifmQmDO6Bx7HN202HCzTBOQbUrSXtxdhVKGF2vWUMIbuOFAnvRzUmt2HlW YwgWuujp/PwvANs2wBWQJLVON+Nnk6ydoYX0CMn6dtvTybITeB60icSFH6YvPlpjbkYZ At4XgJjCP9HRLghZx8QYt0gS56AjLRsunRRUU7+5dpJbyIXPHKWmrDmiMFVev3o+fpsv aW/TpEIVH2yM4IK5qkkAbvjv+3SpYzb6h1Wjry1cl2g7HfAEuVQPIVhunzbfIYHMjUjP NJ/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=S03ga7t/ATWhue9pixfPKWhzKofL2FPG/n1rgOOkaNE=; b=MfXxWPuX86MvpPdIQvFX4mV2OdtJajII9EKFkMZWd5iMA1A6nPv3/W82wUAs6Cz/Jh +N/8+ZTRrnuMPCoNZztd7ACKR+dwhcFeUPnIS+K6rBOd97D1hO64aj6KZgUQajBxN9Sl qLh121V38/O39QNKSFbeKbK1+Zx4ywlYIZG2Fg3VndObTdhQOrCks3Jgx1gqKCt1eaA7 D3hWxU23kefwWzEqWh0h4hSeB6BA/4BmSfB5uvlanCRab5CAS600ZYMrP9TOcsX5L6Z+ ldFC8My65LMYsYW/B0R8udhlOwLE0/4sGE2ohDg9AHhuuyrD3ZD3W3HlK2fg5o8EF0ne vwOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NQ1PUXcH; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dn1si480591edb.226.2021.01.26.22.00.13; Tue, 26 Jan 2021 22:00:37 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=NQ1PUXcH; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393208AbhAZRqB (ORCPT + 99 others); Tue, 26 Jan 2021 12:46:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:46054 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389720AbhAZIN7 (ORCPT ); Tue, 26 Jan 2021 03:13:59 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0DE99206FB; Tue, 26 Jan 2021 08:13:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1611648782; bh=HQ0RvmxJxs52CqdTiUiI0CR2mcbWiihq3JryBJZLrgA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=NQ1PUXcHuAWiJhA0GR+IcS5bWeIN22E/hpxGEqZ1t8QIXTk9jX9dbLsau/njWNbma 9fkSRxah2ekblIdZmUmbVWJhaKHX7cZOM8eBgPvXSv5jS7il/LiuLmhzyMQn7xjJNv J4qlnwA2rfWlSjHbmM3YAIpwOrvx3RE/UvNFFsd8= Date: Tue, 26 Jan 2021 09:12:59 +0100 From: Greg KH To: Josh Poimboeuf Cc: Masahiro Yamada , Kees Cook , Linux Kernel Mailing List , Michal Marek , linux-hardening@vger.kernel.org, Linux Kbuild mailing list , Peter Zijlstra , Justin Forbes , Ondrej Mosnacek Subject: Re: [PATCH RFC] gcc-plugins: Handle GCC version mismatch for OOT modules Message-ID: References: <20210125212755.jfwlqogpcarmxdgt@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210125212755.jfwlqogpcarmxdgt@treble> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 25, 2021 at 03:27:55PM -0600, Josh Poimboeuf wrote: > On Tue, Jan 26, 2021 at 06:16:01AM +0900, Masahiro Yamada wrote: > > On Tue, Jan 26, 2021 at 5:42 AM Josh Poimboeuf wrote: > > > > > > When building out-of-tree kernel modules, the build system doesn't > > > require the GCC version to match the version used to build the original > > > kernel. That's probably [1] fine. > > > > > > In fact, for many distros, the version of GCC used to build the latest > > > kernel doesn't necessarily match the latest released GCC, so a GCC > > > mismatch turns out to be pretty common. And with CONFIG_MODVERSIONS > > > it's probably more common. > > > > > > So a lot of users have come to rely on being able to use a different > > > version of GCC when building OOT modules. > > > > > > But with GCC plugins enabled, that's no longer allowed: > > > > > > cc1: error: incompatible gcc/plugin versions > > > cc1: error: failed to initialize plugin ./scripts/gcc-plugins/structleak_plugin.so > > > > > > That error comes from the plugin's call to > > > plugin_default_version_check(), which strictly enforces the GCC version. > > > The strict check makes sense, because there's nothing to prevent the GCC > > > plugin ABI from changing -- and it often does. > > > > > > But failing the build isn't necessary. For most plugins, OOT modules > > > will otherwise work just fine without the plugin instrumentation. > > > > > > When a GCC version mismatch is detected, print a warning and disable the > > > plugin. The only exception is the RANDSTRUCT plugin which needs all > > > code to see the same struct layouts. In that case print an error. > > > > > > [1] Ignoring, for the moment, that the kernel now has > > > toolchain-dependent kconfig options, which can silently disable > > > features and cause havoc when compiler versions differ, or even when > > > certain libraries are missing. This is a separate problem which > > > also needs to be addressed. > > > > > > Reported-by: Ondrej Mosnacek > > > Signed-off-by: Josh Poimboeuf > > > --- > > > > > > We are based on the assumption that we use the same > > compiler for in-tree and out-of-tree. > > Sorry, but that assumption isn't based in reality. And it's not > enforced. It's "enforced" in that if something breaks because of this, no one will support it :) We have always said, "all kernel code must be built with the exact same compiler and with the same build options". Anyone who does anything different, is on their own. So please, let's not change things to make it as of this might work to hide real problems that are known to show up when people mix/match compilers with modules. thanks, greg k-h