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=-24.8 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1,USER_IN_DEF_DKIM_WL autolearn=ham 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 477F4C4167B for ; Thu, 10 Dec 2020 16:15:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0D49623118 for ; Thu, 10 Dec 2020 16:15:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387477AbgLJQOv (ORCPT ); Thu, 10 Dec 2020 11:14:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390057AbgLJQNJ (ORCPT ); Thu, 10 Dec 2020 11:13:09 -0500 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53CA2C0613CF for ; Thu, 10 Dec 2020 08:12:29 -0800 (PST) Received: by mail-wm1-x344.google.com with SMTP id x22so5111584wmc.5 for ; Thu, 10 Dec 2020 08:12:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=OoPa7i+VjjxLCqnKVlKszdfnGOBJMF8Ur1yfeI8lT8g=; b=kYt9uVy8zkVSh4REB40VTCqQ+WMZGsCr7gx+E/nqPzh/Z4red+B7R8zcpBdH83/QJG rHJV7WzlgVE5ZYgdnbYDqn8cgJ9hmwDJ8jXAbzH9pTqPL2yC1NkJC4OyEapVOgsuqo0+ vcwBVADEy0pY6wO4oftjVoSh6FCNbRRkFrTytgRw8++OBWi8w97OpLoVp3dRt7ffZ7kG d7GXP9M89b75fI+9oYJbcylWUmnaHI0MuY1fYwM5RYqFCIhOj7gcfL1AyHiMq4Eg8eZn D/WVLUqB0UFja6YaJ2XQaDPVPzTr17G6daP1S/z1YW+juaO1Z8bfnasIqYXmOLd2OwTv dWyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=OoPa7i+VjjxLCqnKVlKszdfnGOBJMF8Ur1yfeI8lT8g=; b=Ajy2SYD8Jnxyy44ojWT22YIQ63J5qh3JE+i5/WssbRsWBwy2JRjsSOrQTjtnM3mrUf /oYZYhCB7fCGkH5Mtff4tIwhUCjyE0V9ZoWn5XAKSr4nYHy5GDLh1ZTqSr+hE53lcMjo vpBVlIw+Ex2FjTCCSACrtXpTC5msaADA2gvR9ySpJG0R0eyGXDzt8r1dhpzG7lfjtluq ReeZtr59tqqko4OZTev7/VESLY22LmrIqDhwThNSEEVZ+1CLVoudMT9azOXjTn7MxrYy YhecF2VFb7WmKPDK3VeD9+G7b7tA5XDV9As8VFU8mqTeJYiBakj0BTXx9hHQzcVFqc+W QQIw== X-Gm-Message-State: AOAM530IQofXiH7b6fanN7N8dskVAnLc8o4LJYIDqZsuZ5ZKpB4HlFm3 olvv7/nutx5nhlJq6R0HGWnhTw== X-Google-Smtp-Source: ABdhPJxjHiQwdE7P5CURTVD9+TCxtJVPiDrFIqxpI+tJ42OLjjvgGjh5If+sqe5dHeGURf1lY944kg== X-Received: by 2002:a7b:c184:: with SMTP id y4mr478178wmi.92.1607616747948; Thu, 10 Dec 2020 08:12:27 -0800 (PST) Received: from elver.google.com ([2a00:79e0:15:13:f693:9fff:fef4:2449]) by smtp.gmail.com with ESMTPSA id d17sm9307735wro.62.2020.12.10.08.12.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Dec 2020 08:12:27 -0800 (PST) Date: Thu, 10 Dec 2020 17:12:20 +0100 From: Marco Elver To: Arnd Bergmann Cc: Andrew Morton , linux-kbuild@vger.kernel.org, Masahiro Yamada , Michal Marek , Arnd Bergmann , stable@vger.kernel.org, Ard Biesheuvel , Kees Cook , Masahiro Yamada , Rikard Falkeborn , linux-kernel@vger.kernel.org Subject: Re: [PATCH] kbuild: avoid static_assert for genksyms Message-ID: References: <20201203230955.1482058-1-arnd@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201203230955.1482058-1-arnd@kernel.org> User-Agent: Mutt/2.0.2 (2020-11-20) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 04, 2020 at 12:09AM +0100, Arnd Bergmann wrote: > From: Arnd Bergmann > > genksyms does not know or care about the _Static_assert() built-in, > and sometimes falls back to ignoring the later symbols, which causes > undefined behavior such as > > WARNING: modpost: EXPORT symbol "ethtool_set_ethtool_phy_ops" [vmlinux] version generation failed, symbol will not be versioned. > ld: net/ethtool/common.o: relocation R_AARCH64_ABS32 against `__crc_ethtool_set_ethtool_phy_ops' can not be used when making a shared object > net/ethtool/common.o:(_ftrace_annotated_branch+0x0): dangerous relocation: unsupported relocation > > Redefine static_assert for genksyms to avoid that. > > Cc: stable@vger.kernel.org > Suggested-by: Ard Biesheuvel > Signed-off-by: Arnd Bergmann > --- > include/linux/build_bug.h | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/include/linux/build_bug.h b/include/linux/build_bug.h > index e3a0be2c90ad..7bb66e15b481 100644 > --- a/include/linux/build_bug.h > +++ b/include/linux/build_bug.h > @@ -77,4 +77,9 @@ > #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr) > #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) > > +#ifdef __GENKSYMS__ > +/* genksyms gets confused by _Static_assert */ > +#define _Static_assert(expr, ...) > +#endif > + I had sent https://lkml.kernel.org/r/20201201152017.3576951-1-elver@google.com 3 days before your patch. :-) I guess what you propose is simpler, but might still have corner cases where we still get warnings. In particular, if some file (for whatever reason) does not include build_bug.h and uses a raw _Static_assert(), then we still get warnings. E.g. I see 1 user of raw _Static_assert() (drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h ). In the end I don't mind either way, as long as those warnings are fixed in 5.11. :-) Thanks, -- Marco