Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp643142rwe; Fri, 26 Aug 2022 11:23:35 -0700 (PDT) X-Google-Smtp-Source: AA6agR6ys1K+LUSGlETC6WL+g0bRfGNKviRXXt/x4bkWcWta6ygKo/DTh96Fza1NLs5taW2HIo+S X-Received: by 2002:a17:906:9b09:b0:73d:7c69:4d83 with SMTP id eo9-20020a1709069b0900b0073d7c694d83mr6388481ejc.441.1661538215267; Fri, 26 Aug 2022 11:23:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661538215; cv=none; d=google.com; s=arc-20160816; b=DcNtsWa7iYJUZlAiUR0UCcZz5byfXjLEtU2xbHtuOsNcPzMrcpflnLX2FeMZk2sHha aVOhP2RA8CzDsx/3q6xtPcNc9I7NS2bOXWJ6JUW038zZ7cw0/Auw4C5yWLi2hlveSOn5 IAfEwAHljE13NZXOWtaeSfmOtiN2l5hviGgZtio+EpvVAW+Cuwms10xrs4HoWyS1X5dV QaRECLnPQSxsQylMZ7MrbIsgDIf03PoBb5cvNfDsW6UzJhjRy8xHld4VEXObKFsYut63 xGDLLeLM9gFNLnG8ERCdbw7MWexs70F7U7UudTq2JesuwtxYBuAbB5mY7zA2vTk4sVtv PocA== 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; bh=SVEAc9oaWwhvsLjCRpgqc3gUfUn0N+3jiLz9lf/QEE0=; b=Wfei6dpo922+HizslVxWgKgCfqle1Mr7FU5sIo/Bt9wZpSmshmfe/Zj5cCTvw00UHB PM9DoqS/uLcEkHwF1k76s63yv6rQaepm7Ir9qmTaS5ldvk1BGXYaeaONzTtlcVS4dWWm vJCrnMbJYAd7CgctYS0JbN4UYPl22myqM0LVXef4bWfGSifmR1xReyAyAWcXEnT0M65q RKigh0KTr6/RyTaQ/EjeyD7tb1RAihjj5ylqH9SMgt85x4iR/KgKtaT83iBHms3LOr8Y cszUt7wfwLN5jhhCncXKd1BH139l/PtnCuEJbQynPHaUZcWe73FC9gJog1QrOUP1u4U0 aqlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=jrbTNnCO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t11-20020a056402524b00b0043d4a5ee1a8si1925088edd.577.2022.08.26.11.23.09; Fri, 26 Aug 2022 11:23:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=jrbTNnCO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237347AbiHZRml (ORCPT + 99 others); Fri, 26 Aug 2022 13:42:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344924AbiHZRmZ (ORCPT ); Fri, 26 Aug 2022 13:42:25 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBB9FE2C64; Fri, 26 Aug 2022 10:42:23 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id s31-20020a17090a2f2200b001faaf9d92easo8730809pjd.3; Fri, 26 Aug 2022 10:42:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=SVEAc9oaWwhvsLjCRpgqc3gUfUn0N+3jiLz9lf/QEE0=; b=jrbTNnCOFn/3IiMbZtS5oHbXx/Z/L+v8WALSOxCOUFCaVYnGdV9w8k1AI0vjJxSdFj m68cRNUVk7cXGOoGaIP5uKsvRlx/V+oTn4LYwkbbC2Vsam1+/SsFT2ctnqHANIgH4xBe ixnCvpdXJBCfGSB6ZDZxPRe7d2Jm3RPuuxHJxO6VG8nkOLZJAnx/maXDun1H0eqaMxsp ZmGCB6eFljZBXIJKnnHyZzPNycSW58BlELK4CyymZULNmfLr9F7zBO4Vejf32Hhl4huN y61UnFf3o3uNOSXrrbMJqKHxLPzFFn6b308Q92LnMKRrInwqk3EytJ09j2ETLL2/DjcQ D9Og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=SVEAc9oaWwhvsLjCRpgqc3gUfUn0N+3jiLz9lf/QEE0=; b=tI8rHVHu9Y0CK/04frz3LzWyn7/JGSExrpUzH+pBJA1bbeCBb3/mjZXo1xM6+m7v2g EZEgP9lCxWu8yJFKRQffXOdBLsMe7aSHIEH9OH0V8xm2TDHtAj3AHJd28kEtkiMbB4ZZ PURn7L26F6yRFnmdthmFRKY6UraNQoC238jFsTLmPrtNrgDJ0W32O7PCcN2nE2i0BB5M KBHuxhnZ1JEU8Zsy7aekCuOoqvh9omIM5PgUnvsdLw9TAntJAcfVI5e6cWqScdvkN7go 9la15YyFgGTJ7LbCi9sJNeFomJSyeve4Z+J0QXZvhcO0NwnzTC8v5HfPsw1tYeGOwdTq 7v0Q== X-Gm-Message-State: ACgBeo2w+4pvown2/OId2EDDcLRHEGowDa4y1/60pgdmLxYFS1U+9GMA 83XMaNcacyYACSrt4Mo1UOrq50KvruixuNSkd/A= X-Received: by 2002:a17:902:6b82:b0:16d:d268:3842 with SMTP id p2-20020a1709026b8200b0016dd2683842mr4673930plk.16.1661535742946; Fri, 26 Aug 2022 10:42:22 -0700 (PDT) MIME-Version: 1.0 References: <20220825221751.258958-1-james.hilliard1@gmail.com> <20220826051630.glhrbdhiybtqwc4p@kafai-mbp.dhcp.thefacebook.com> <20220826054944.5bcx7unsyx4ts6ok@kafai-mbp.dhcp.thefacebook.com> <20220826171741.pdiqa4n4mls56bw3@kafai-mbp.dhcp.thefacebook.com> In-Reply-To: <20220826171741.pdiqa4n4mls56bw3@kafai-mbp.dhcp.thefacebook.com> From: James Hilliard Date: Fri, 26 Aug 2022 11:42:10 -0600 Message-ID: Subject: Re: [PATCH] selftests/bpf: Fix bind{4,6} tcp/socket header type conflict To: Martin KaFai Lau Cc: bpf@vger.kernel.org, Andrii Nakryiko , Mykola Lysenko , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Shuah Khan , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 26, 2022 at 11:17 AM Martin KaFai Lau wrote: > > On Fri, Aug 26, 2022 at 12:13:54AM -0600, James Hilliard wrote: > > On Thu, Aug 25, 2022 at 11:49 PM Martin KaFai Lau wrote: > > > > > > On Thu, Aug 25, 2022 at 11:31:15PM -0600, James Hilliard wrote: > > > > On Thu, Aug 25, 2022 at 11:16 PM Martin KaFai Lau wrote: > > > > > > > > > > On Thu, Aug 25, 2022 at 04:17:49PM -0600, James Hilliard wrote: > > > > > > There is a potential for us to hit a type conflict when including > > > > > > netinet/tcp.h with sys/socket.h, we can replace both of these includes > > > > > > with linux/tcp.h to avoid this conflict. > > > > > > > > > > > > Fixes errors like: > > > > > > In file included from /usr/include/netinet/tcp.h:91, > > > > > > from progs/bind4_prog.c:10: > > > > > > /home/buildroot/opt/cross/lib/gcc/bpf/13.0.0/include/stdint.h:34:23: error: conflicting types for 'int8_t'; have 'char' > > > > > > 34 | typedef __INT8_TYPE__ int8_t; > > > > > > | ^~~~~~ > > > > > > In file included from /usr/include/x86_64-linux-gnu/sys/types.h:155, > > > > > > from /usr/include/x86_64-linux-gnu/bits/socket.h:29, > > > > > > from /usr/include/x86_64-linux-gnu/sys/socket.h:33, > > > > > > from progs/bind4_prog.c:9: > > > > > > /usr/include/x86_64-linux-gnu/bits/stdint-intn.h:24:18: note: previous declaration of 'int8_t' with type 'int8_t' {aka 'signed char'} > > > > > > 24 | typedef __int8_t int8_t; > > > > > > | ^~~~~~ > > > > > > /home/buildroot/opt/cross/lib/gcc/bpf/13.0.0/include/stdint.h:43:24: error: conflicting types for 'int64_t'; have 'long int' > > > > > > 43 | typedef __INT64_TYPE__ int64_t; > > > > > > | ^~~~~~~ > > > > > > /usr/include/x86_64-linux-gnu/bits/stdint-intn.h:27:19: note: previous declaration of 'int64_t' with type 'int64_t' {aka 'long long int'} > > > > > > 27 | typedef __int64_t int64_t; > > > > > > | ^~~~~~~ > > > > > > make: *** [Makefile:537: /home/buildroot/bpf-next/tools/testing/selftests/bpf/bpf_gcc/bind4_prog.o] Error 1 > > > > > > > > > > > > Signed-off-by: James Hilliard > > > > > > --- > > > > > > tools/testing/selftests/bpf/progs/bind4_prog.c | 3 +-- > > > > > > tools/testing/selftests/bpf/progs/bind6_prog.c | 3 +-- > > > > > > 2 files changed, 2 insertions(+), 4 deletions(-) > > > > > > > > > > > > diff --git a/tools/testing/selftests/bpf/progs/bind4_prog.c b/tools/testing/selftests/bpf/progs/bind4_prog.c > > > > > > index 474c6a62078a..6bd20042fd53 100644 > > > > > > --- a/tools/testing/selftests/bpf/progs/bind4_prog.c > > > > > > +++ b/tools/testing/selftests/bpf/progs/bind4_prog.c > > > > > > @@ -6,8 +6,7 @@ > > > > > > #include > > > > > > #include > > > > > > #include > > > > > > -#include > > > > > > -#include > > > > > These includes look normal to me. What environment is hitting this. > > > > > > > > I was hitting this error with GCC 13(GCC master branch). > > > These two includes ( and ) are normal, > > > so does it mean all existing programs need to change to use gcc 13 ? > > > > Well I think it's mostly just an issue getting hit with GCC-BPF as it > > looks to me like a cross compilation host/target header conflict. > The users have been using these headers in the bpf progs. Users can migrate away from libc headers over time, migrating away shouldn't cause regressions and should improve reliability. > The solution should be on the GCC-BPF side instead of changing > all bpf progs. I mean, GCC doesn't really control which libc is available, it seems to be a bad idea to use libc headers in general as they are developed separately from GCC and the kernel/libbpf. I'm not really sure how one would fix this on the GCC-BPF side without introducing more potential header conflicts.