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=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable 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 D69C1C4332D for ; Tue, 16 Mar 2021 21:02:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BC24B64F97 for ; Tue, 16 Mar 2021 21:02:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232280AbhCPVBx (ORCPT ); Tue, 16 Mar 2021 17:01:53 -0400 Received: from www62.your-server.de ([213.133.104.62]:59966 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232211AbhCPVBp (ORCPT ); Tue, 16 Mar 2021 17:01:45 -0400 Received: from sslproxy03.your-server.de ([88.198.220.132]) by www62.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1lMGov-000DD5-8i; Tue, 16 Mar 2021 22:01:41 +0100 Received: from [85.7.101.30] (helo=pc-9.home) by sslproxy03.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lMGou-000NvJ-VU; Tue, 16 Mar 2021 22:01:40 +0100 Subject: Re: [PATCH] libbpf: avoid inline hint definition from 'linux/stddef.h' To: Pedro Tammela Cc: Alexei Starovoitov , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Nathan Chancellor , Nick Desaulniers , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com References: <20210314173839.457768-1-pctammela@gmail.com> From: Daniel Borkmann Message-ID: <5083f82b-39fc-9d46-bcd0-3a6be2fc7f98@iogearbox.net> Date: Tue, 16 Mar 2021 22:01:40 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20210314173839.457768-1-pctammela@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.102.4/26110/Tue Mar 16 12:05:23 2021) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/14/21 6:38 PM, Pedro Tammela wrote: > Linux headers might pull 'linux/stddef.h' which defines > '__always_inline' as the following: > > #ifndef __always_inline > #define __always_inline __inline__ > #endif > > This becomes an issue if the program picks up the 'linux/stddef.h' > definition as the macro now just hints inline to clang. How did the program end up including linux/stddef.h ? Would be good to also have some more details on how we got here for the commit desc. > This change now enforces the proper definition for BPF programs > regardless of the include order. > > Signed-off-by: Pedro Tammela > --- > tools/lib/bpf/bpf_helpers.h | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/tools/lib/bpf/bpf_helpers.h b/tools/lib/bpf/bpf_helpers.h > index ae6c975e0b87..5fa483c0b508 100644 > --- a/tools/lib/bpf/bpf_helpers.h > +++ b/tools/lib/bpf/bpf_helpers.h > @@ -29,9 +29,12 @@ > */ > #define SEC(NAME) __attribute__((section(NAME), used)) > > -#ifndef __always_inline > +/* > + * Avoid 'linux/stddef.h' definition of '__always_inline'. > + */ I think the comment should have more details on 'why' we undef it as in few months looking at it again, the next question to dig into would be what was wrong with linux/stddef.h. Providing a better rationale would be nice for readers here. > +#undef __always_inline > #define __always_inline inline __attribute__((always_inline)) > -#endif > + > #ifndef __noinline > #define __noinline __attribute__((noinline)) > #endif >