From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2FAA6C433E0 for ; Thu, 28 Jan 2021 21:36:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E733964DE8 for ; Thu, 28 Jan 2021 21:36:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231461AbhA1Vfq (ORCPT ); Thu, 28 Jan 2021 16:35:46 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:44631 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231301AbhA1Vfn (ORCPT ); Thu, 28 Jan 2021 16:35:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611869657; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=57t5IEFW55dtVez1wzr0cQ3lFQ9NLibehfOHwQswbsw=; b=UVJr7MEI/h/sIFOsTeerkeOf+7/hFMVHrWEQk8EHErBKFbU5OtEs8EnpleEglMKxEwzYCs tlJU3OTpbk+WbX2qPZy1kNMYbLgwmXeyVaccAvMLI6wPYQHhnmkknytZZAadmOLahW2xco S7QeOUN6ubNpYfof9v9XN2YK2VmQMDE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-349-2XkRJHRdONmXO1wBy5yXBg-1; Thu, 28 Jan 2021 16:34:16 -0500 X-MC-Unique: 2XkRJHRdONmXO1wBy5yXBg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7741A8030A2; Thu, 28 Jan 2021 21:34:13 +0000 (UTC) Received: from treble (ovpn-120-118.rdu2.redhat.com [10.10.120.118]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 757636F98B; Thu, 28 Jan 2021 21:34:11 +0000 (UTC) Date: Thu, 28 Jan 2021 15:34:09 -0600 From: Josh Poimboeuf To: Linus Torvalds Cc: Masahiro Yamada , Michal Marek , Linux Kernel Mailing List , Kees Cook , linux-hardening@vger.kernel.org, Linux Kbuild mailing list , Peter Zijlstra , Justin Forbes , Ondrej Mosnacek , Greg Kroah-Hartman , Christoph Hellwig , Miroslav Benes , David Laight , Jessica Yu Subject: Re: [PATCH RFC] kbuild: Prevent compiler mismatch with external modules Message-ID: <20210128213409.qxnclchjyq6v23up@treble> References: <20210128205207.awdbh4bmx56pxxjl@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 28, 2021 at 01:23:11PM -0800, Linus Torvalds wrote: > On Thu, Jan 28, 2021 at 1:03 PM Linus Torvalds > wrote: > > > > I really think the whole compiler version check is purely voodoo programming. > > .. but there are obviously potentially things we - in the kernel - do > that may make certain compiler versions incompatible. We long long ago > used to have things like "you can't have an empty struct because gcc > version x.y.z doesn't support it", so even a UP spinlock would be > > typedef struct { int gcc_is_buggy; } raw_spinlock_t; > > but only if you compiled it with a version of gcc older than 3.0. So > compiling one file with one compiler, and another with a newer one, > would result in the data structures simply not having the same layout. > > That's not because of compiler versions per se, it's because of our > version checks. Right, this is what I'm trying to say. We have features based on compiler version checks. Peterz pointed out asm goto as a previous example. > THAT workaround is long gone, but I didn't check what other ones we > might have now. But the gcc version checks we _do_ have are not > necessarily about major versions at all (ie I trivially found checks > for 4.9, 4.9.2, 5.1, 7.2 and 9.1). Then maybe the check should be same major.minor? And convert it to a strongly worded warning/disclaimer? -- Josh