Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5827781ybl; Tue, 27 Aug 2019 10:10:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqyx9X9QyzzEHvYfu6UWLQQjDZ2GeptCLpgmHzydTbBqLuQ7g2RZjb/1+Y+2M0S9BeyZJwsM X-Received: by 2002:a63:61cf:: with SMTP id v198mr22013500pgb.217.1566925856384; Tue, 27 Aug 2019 10:10:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566925856; cv=none; d=google.com; s=arc-20160816; b=1E9IQkqYr0dpGqpq1lbEg4iukCCL37CeaM7X8dtB4k6O9i6HCO38ezl80E0ppj682e wjSsLU6Y6dC3H7XQftPGKQbYDCCDqp0Bsqc+CCeGcST75nlt4OWFhQuQTO/J1lgDiRjR W6CMBCNbWh5N/fNEyqsdiZOusuTzkEToqr+zdq6PWketmS1jq5U4pizzIbSNwrWKFN+e 6pnajxogCGkhisabyPtVPRhxs9cqFcSJjLnZCNmeqxdVLtgF0RKvTm0RXWLEwd9J8HP3 1B8lhSCr2ONxvAzWhC2TqaMPxdRHHMSPjCiTdZ9jbBBtlatxGchASDIuoVZi8W4dXWFO VLcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=BPbDC9IrB6cmNqHgbPDPNpXUtWb1H0E7Fm6G9hdQQF8=; b=J5G3hZX4cp1IDXmpqJnV6UDElGiIWX3v58dMEDejzyV6X7tREaseUYZQVkCxNyhAvb Uh5OeCr9y4cRx7PaLEEEG/8AQj4azHKqtzuHE4gk5wDD0HB9n2/BeR/EI/FZN7wb+E8E u+2K9MoWZBQhll33lECojChuzapb8rQxSiijPGdncWuVS/djWP0AiYweEquTIhWBg8O/ /Cx1/3i7tWcxE/9kz+Y1F6lo13f4oMPuY7Y3VXVPzGZn2/0TZ9P60bCs2xyIogStOKU0 lQzpgK2hl3AwUsx23XapRSXBGBLjM2HNKc1skY/hAeJPiy58ujmi0n24o3R+LpGB+Svr CwnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DRDBGeBE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q7si12570390pgk.456.2019.08.27.10.10.39; Tue, 27 Aug 2019 10:10:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DRDBGeBE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729058AbfH0RJf (ORCPT + 99 others); Tue, 27 Aug 2019 13:09:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:50362 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726871AbfH0RJf (ORCPT ); Tue, 27 Aug 2019 13:09:35 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 360FE214DA; Tue, 27 Aug 2019 17:09:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566925773; bh=Nrwl1ADYbWkW2k7rd5YL6tq23uKcWAARjfK77AYdRFM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DRDBGeBEiAx9zbtasYS9m8iabi3FKP9tDLbgpPS0vHu7HiCyzdjDot8jxo3g9Nnbi gzhYcrztPyFL7EX/PLN5/Ox8L1Q+P7aHKFE2TVEnVCKCLz2qrqrxBZpiIZ3uLUl39c 69EouWhg0dBDh9ZMx22/BrKySA+OSDQ+k5icff5U= Date: Tue, 27 Aug 2019 19:09:31 +0200 From: Greg KH To: Ben Hutchings Cc: Nicholas Piggin , Masahiro Yamada , Ard Biesheuvel , Arnd Bergmann , LKML , Michal Marek , Nick Desaulniers , Linus Torvalds , Will Deacon , Debian kernel maintainers Subject: Re: a bug in genksysms/CONFIG_MODVERSIONS w/ __attribute__((foo))? Message-ID: <20190827170931.GA26908@kroah.com> References: <1566899033.o5acyopsar.astroid@bobo.none> <1566908344.dio7j9zb2h.astroid@bobo.none> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 27, 2019 at 04:34:15PM +0100, Ben Hutchings wrote: > On Tue, 2019-08-27 at 22:42 +1000, Nicholas Piggin wrote: > > Masahiro Yamada's on August 27, 2019 8:49 pm: > > > Hi. > > > > > > On Tue, Aug 27, 2019 at 6:59 PM Nicholas Piggin wrote: > > > > Nick Desaulniers's on August 27, 2019 8:57 am: > > > > > On Mon, Aug 26, 2019 at 2:22 PM Nick Desaulniers > > > > > wrote: > > > > > > I'm looking into a linkage failure for one of our device kernels, and > > > > > > it seems that genksyms isn't producing a hash value correctly for > > > > > > aggregate definitions that contain __attribute__s like > > > > > > __attribute__((packed)). > > > > > > > > > > > > Example: > > > > > > $ echo 'struct foo { int bar; };' | ./scripts/genksyms/genksyms -d > > > > > > Defn for struct foo == > > > > > > Hash table occupancy 1/4096 = 0.000244141 > > > > > > $ echo 'struct __attribute__((packed)) foo { int bar; };' | > > > > > > ./scripts/genksyms/genksyms -d > > > > > > Hash table occupancy 0/4096 = 0 > > > > > > > > > > > > I assume the __attribute__ part isn't being parsed correctly (looks > > > > > > like genksyms is a lex/yacc based C parser). > > > > > > > > > > > > The issue we have in our out of tree driver (*sadface*) is basically a > > > > > > EXPORT_SYMBOL'd function whose signature contains a packed struct. > > > > > > > > > > > > Theoretically, there should be nothing wrong with exporting a function > > > > > > that requires packed structs, and this is just a bug in the lex/yacc > > > > > > based parser, right? I assume that not having CONFIG_MODVERSIONS > > > > > > coverage of packed structs in particular could lead to potentially > > > > > > not-fun bugs? Or is using packed structs in exported function symbols > > > > > > with CONFIG_MODVERSIONS forbidden in some documentation somewhere I > > > > > > missed? > > > > > > > > > > Ah, looks like I'm late to the party: > > > > > https://lwn.net/Articles/707520/ > > > > > > > > Yeah, would be nice to do something about this. > > > > > > modversions is ugly, so it would be great if we could dump it. > > > > > > > IIRC (without re-reading it all), in theory distros would be okay > > > > without modversions if they could just provide their own explicit > > > > versioning. They take care about ABIs, so they can version things > > > > carefully if they had to change. > > Debian doesn't currently have any other way of detecting ABI changes > (other than eyeballing diffs). > > I know there have been proposals of using libabigail for this instead, > but I'm not sure how far those progressed. Google has started using libabigail to track api changes in AOSP, here's a patch that updates the ABI file after changing it: https://android-review.googlesource.com/c/kernel/common/+/1108662 Note, there are issues with it, and some rough edges, but I think it can work. But, it means nothing at module load time, this is only at build-check time. At least modversions would prevent module loading in some cases. thanks, greg k-h