Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1583846pxb; Thu, 4 Mar 2021 15:28:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJz/DY2j32ish/WKK4MOBKCjNNtG3xvvsaTE3hKZvuLjdXdznMm56l82X7Snp+YNr1yRXAxf X-Received: by 2002:a17:906:86c6:: with SMTP id j6mr6416012ejy.197.1614900537606; Thu, 04 Mar 2021 15:28:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614900537; cv=none; d=google.com; s=arc-20160816; b=dKT1FAa133PpJ8Kqq8VVSOowRZAA/bTd1/wY21U8Awi+ncjBzpJREanjQwXCU/0is6 sGrvyvbtZam7oYI7C398q0/cwnqixmjf1mOBpp4tVpqCdAw5KBKXDKv3bECrUuUAomuu J3xtvaksxpbnUS3nsYzRPsjPfrxcgnC2Oas5fHhEsbpmRJ5gfycKqqRT/XAFX81lQ8sd Yt1AR18jLMtn5ifZ3El/DKHhteY2lLR9v4Wl8B9vtK1RpMzGCtoNAcCmHq0yNNY359/E aDqFi9hQp8gMK72J22DwGhbTJpAXk49Olsr21a6O2vLKD2qjoMS1j7T7rOEO4xKHD4ka G2tQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature:dkim-filter; bh=fvTDpDKpHB2RoYVt26aVSfRN8H+EkrwI+Rs0xBOTnaY=; b=SgitX32MxP3tzMmjaPqNk4jMFKxhwE4Sr6Lhfkt4oTQS09ZYe5w96gePJhKaMhy5zY +pN56hym8l+JlhyntYcpVRPJrN3uNUe9Fk86THt/tGa733hkaexW1hp3Bovd1P5Gicj+ DDP6+YSYW74VhKMmliqOgD/lzB2OKXGam1s1LhOVDgzoZJo51BXz0rvAqn4KAOubB5lL +oJfFFNHWD5EaP/6VzdJ22efObnYRUSmZTJO6/WS9cMO+V7+1EDjrk0R8/G1yCAHeKhv 9QY0VQST+y/c7o5cBJN+gYYL4zvXElGptfLqSTpA5SOQzKs29n1mGQnlmT/uDby29rE+ IfVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=x056maJ4; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i2si370637ejc.37.2021.03.04.15.28.35; Thu, 04 Mar 2021 15:28:57 -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=@nifty.com header.s=dec2015msa header.b=x056maJ4; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244858AbhCCTV2 (ORCPT + 99 others); Wed, 3 Mar 2021 14:21:28 -0500 Received: from condef-06.nifty.com ([202.248.20.71]:52345 "EHLO condef-06.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1838283AbhCCTAD (ORCPT ); Wed, 3 Mar 2021 14:00:03 -0500 Received: from conssluserg-05.nifty.com ([10.126.8.84])by condef-06.nifty.com with ESMTP id 123IuAkm015717 for ; Thu, 4 Mar 2021 03:56:10 +0900 Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) (authenticated) by conssluserg-05.nifty.com with ESMTP id 123IoDLr006152; Thu, 4 Mar 2021 03:50:13 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-05.nifty.com 123IoDLr006152 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1614797413; bh=fvTDpDKpHB2RoYVt26aVSfRN8H+EkrwI+Rs0xBOTnaY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=x056maJ4bLhrtmh+om8k4pFwPKY7SUSf9fSjaV61pzOCe+r54ANja43k/dNlMyfKT viwScA1dES2h6rSh+y8sxfXG50bhOUTFL50oo+aGXOopPxi1KGwpoxuXoGfiT/0XJn K/HDajcgWeaxF79vOsyd1HbV/PXQxNf6tCJwPRSKb4kqI0g+2H04+Jiz4pjEUoaZ1G VdnQuEAn3+bb3l8+b7TbVnr4hU8tij4eL24zMCrYmtb+BPNI8ZuquwvA0EJufn+93R UZouzZ2hY5rr/81r8aLXZRR8oM17llg0B0UCDpp/2+T0ludvTD2Uf9yEdhS62DmQvP Xo8EMzomXHMnQ== X-Nifty-SrcIP: [209.85.215.182] Received: by mail-pg1-f182.google.com with SMTP id t25so17053281pga.2; Wed, 03 Mar 2021 10:50:13 -0800 (PST) X-Gm-Message-State: AOAM533Iy1qEQBUJU3+Iu8yHslbsYEvkWk3TspHToky1aKaonaVNDN0g t0UC61vAQHBjah6nmQVr1FaHw/vt9p7/nOtq5u8= X-Received: by 2002:a65:428b:: with SMTP id j11mr292481pgp.47.1614797412617; Wed, 03 Mar 2021 10:50:12 -0800 (PST) MIME-Version: 1.0 References: <20210302232649.y2tutffhxsblwqlb@treble> In-Reply-To: <20210302232649.y2tutffhxsblwqlb@treble> From: Masahiro Yamada Date: Thu, 4 Mar 2021 03:49:35 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH RFC] gcc-plugins: Handle GCC version mismatch for OOT modules To: Josh Poimboeuf Cc: Linux Kernel Mailing List , Michal Marek , linux-hardening@vger.kernel.org, Linux Kbuild mailing list , Peter Zijlstra , Justin Forbes , Ondrej Mosnacek , Frank Eigler , Kees Cook Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 3, 2021 at 8:27 AM Josh Poimboeuf wrote: > > On Mon, Jan 25, 2021 at 02:42:10PM -0600, 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. > > Hi Masahiro, > > This problem is becoming more prevalent. We will need to fix it one way > or another, if we want to support distro adoption of these GCC > plugin-based features. > > Frank suggested a possibly better idea: always rebuild the plugins when > the GCC version changes. That is just another form of the previous patch, which was already rejected. - That is a hack just for external modules - Our consensus is, use the same version for the kernel and external modules I use Ubuntu, and I do not see such a problem. (I have never seen it on Debian either, except sid.) I see Fedora providing GCC whose version is different from the one used for building the kernel. That is a problem on the distribution side. In my ubuntu. $ grep CC_VERSION_TEXT /lib/modules/$(uname -r)/build/.config CONFIG_CC_VERSION_TEXT="gcc (Ubuntu 10.2.0-13ubuntu1) 10.2.0" $ gcc --version | head -n1 gcc (Ubuntu 10.2.0-13ubuntu1) 10.2.0 > What do you think? NACK. > Any suggestions on how to > implement that? Otherwise I can try to hack something together. > > -- > Josh > -- Best Regards Masahiro Yamada