Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3421362rwe; Mon, 29 Aug 2022 11:20:20 -0700 (PDT) X-Google-Smtp-Source: AA6agR62kDpoXR8+gwh2F4UEkjQ+k6lDuqiQnrkF/oNnLiY19ddCp3FqnuncMQ/RPfoDXwsAMZKw X-Received: by 2002:a05:6402:11cd:b0:43d:7862:7c25 with SMTP id j13-20020a05640211cd00b0043d78627c25mr17896537edw.96.1661797220311; Mon, 29 Aug 2022 11:20:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1661797220; cv=pass; d=google.com; s=arc-20160816; b=xX5Gr9tTvZxH8VSP6fN+ZZFbYBQQ1Fx2RX+qJLcQRIKGOTlpaOFfBDO6FL5gRhSSEv JOLMhTasCizyQ32SthRbK8X9IpmvNptmVHpc1Vd+z/MShUG2TC/Xs7lPXmCuSpAx7xcQ 73iBSUzKd+s2v5qlmNKMNzV2VD6ZUSyBT5DLhtOn6lXC4+xV3dqqEMLRGIJHgZFr4itg qSlorYLfu6kxkj8Fw+s8N82pFy9NoV3UcOMW536addhCNvXjlQKcQ2w0NaZkiFqSaYNu 1ZhR1OjDLIYWywW/xhvtdrROjlA3bqqys9PJO4J/JDuAlDx4UDQUfa+DHAdZXHA/mOeY 5h3g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=/pdVDPhY96mMMN97cGa+Y4Pf8LI/M4/5VbwGCG8qeGU=; b=PwlumlqFMS4q1Yu+/Pqp0wA763hrECs+j14KJJan0goNGL+uCYKs6dE185UVjPiepi 4WUYz7LVfXo6vnDBg96BRmru4Z5uy0HvfqvIOBJO8u1ywmOwadzTmI0KYRn8F79/yWaK gRrzSW5cgtW9EFPBAgujuHsw15OV02u3stGAnZzeaet7j+D+3RwBrhtL0gjH/5CaE9oF gDEkrTS/JPtaMJ38f+yHVK1hJc0JxM7F3ihT2CiMBdTnwkhKtRCQCdtK7rpX9uWZjcdK TkvciDokGuzObIkeF5mIm9oLeZlW8BgW2u45a0Z5Q1X42VyGaE2H4sDTQ0WhXooPsQR7 s58g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=gE2GtaHC; arc=pass (i=1 spf=pass spfdomain=fb.com dkim=pass dkdomain=fb.com dmarc=pass fromdomain=fb.com); 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=REJECT sp=REJECT dis=NONE) header.from=fb.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l10-20020a170906794a00b00730870cb4b6si7640131ejo.621.2022.08.29.11.19.54; Mon, 29 Aug 2022 11:20:20 -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=@fb.com header.s=facebook header.b=gE2GtaHC; arc=pass (i=1 spf=pass spfdomain=fb.com dkim=pass dkdomain=fb.com dmarc=pass fromdomain=fb.com); 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=REJECT sp=REJECT dis=NONE) header.from=fb.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230096AbiH2Ryo (ORCPT + 99 others); Mon, 29 Aug 2022 13:54:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229690AbiH2Ryl (ORCPT ); Mon, 29 Aug 2022 13:54:41 -0400 Received: from mx0a-00082601.pphosted.com (mx0a-00082601.pphosted.com [67.231.145.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 965367DF63; Mon, 29 Aug 2022 10:54:40 -0700 (PDT) Received: from pps.filterd (m0044010.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27THg77d025816; Mon, 29 Aug 2022 10:54:21 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=date : from : to : cc : subject : message-id : references : content-type : in-reply-to : mime-version; s=facebook; bh=/pdVDPhY96mMMN97cGa+Y4Pf8LI/M4/5VbwGCG8qeGU=; b=gE2GtaHC+QTCygm3o9GMVtanP7L09xP10g9/iaSDHzp2dWWeyWYgXGuCWvyAqutdE+An vBLmqR1KWvPJ+DjTNVsUGbM/zgQFxBMeA5xiDTHN1ISLe+hzSkOU67E42KXsy98IM+ig qq6LKQCXtUHutZRBGODWq273zoQalUa0p58= Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2169.outbound.protection.outlook.com [104.47.58.169]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 3j7ekn3khk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 29 Aug 2022 10:54:21 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lvDLDxAD6GZwCo5lsjyHoB6CEaLNAR9mucoEVwk+YtHMDJIEjwq06mQZsFQW7gsYEdB92MXYmu2YpL26bMcjju6FuU142jkDNBF0lVLiwthBjmL+upBXXYVJ/KgMUa48OHmWkgyUD/Qb3OS4tdO01tDaPVpnTh0qd/lu/KITJkX8v0F05asXtv+a9+yFIrM6VeG4HXYOq9La1KwLQn3VOD1FDysdDb5xd8UGLE/lkMQMHtqs/SqYIZFM7AWwMpzM6s9fy9ei07OQUwlyg6vsVbGaCfuxNLoD3jdtnij5blIDtDf2GY4gqV4+AEyONqC50aogmlp+bDvkrbt2DeHwvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/pdVDPhY96mMMN97cGa+Y4Pf8LI/M4/5VbwGCG8qeGU=; b=b8qOCJV+0L8h4Un8W1JpJ0i0EiZsTiPpHDB2mpHi5006vw7s135l4YUJav8cehyIqWGyYPsuFCJGiuR6Mcw0BU+lA23zHFH0hzmdHYwqGsZ8uwFYM3foUMNGmpF1IYAP1PwnJmJD7UwK4k5Ll5nS0uOj2cw5Vf+1LF/08Bjqi7WMh1Ydi2r6MPGbo6O3YkUszhaNXue5+PAx2jxD3PXz2LMtTxxnfqx0CTzESGvi6NBfBzcd6HfYajDM4ZAYEr428fs8oBybf0pssHmxjmuvqNUubJ4hHKcV2mPKllsEAOatHvOl9yv60Xx3LmayoG2dFYthre9sb2i6bjOVsxzLRw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=fb.com; dmarc=pass action=none header.from=fb.com; dkim=pass header.d=fb.com; arc=none Received: from MW4PR15MB4475.namprd15.prod.outlook.com (2603:10b6:303:104::16) by DM6PR15MB2730.namprd15.prod.outlook.com (2603:10b6:5:1b1::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.21; Mon, 29 Aug 2022 17:54:17 +0000 Received: from MW4PR15MB4475.namprd15.prod.outlook.com ([fe80::1858:f420:93d2:4b5e]) by MW4PR15MB4475.namprd15.prod.outlook.com ([fe80::1858:f420:93d2:4b5e%4]) with mapi id 15.20.5566.021; Mon, 29 Aug 2022 17:54:17 +0000 Date: Mon, 29 Aug 2022 10:54:13 -0700 From: Martin KaFai Lau To: "Jose E. Marchesi" Cc: James Hilliard , 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 Subject: Re: [PATCH] selftests/bpf: Fix bind{4,6} tcp/socket header type conflict Message-ID: <20220829175413.h2335oivqcg34pw3@kafai-mbp.dhcp.thefacebook.com> 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> <20220826212550.mgugz6fomoqpgdbb@kafai-mbp.dhcp.thefacebook.com> <87k06ubi9m.fsf@oracle.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87k06ubi9m.fsf@oracle.com> X-ClientProxiedBy: SJ0PR03CA0173.namprd03.prod.outlook.com (2603:10b6:a03:338::28) To MW4PR15MB4475.namprd15.prod.outlook.com (2603:10b6:303:104::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a3edeb90-0c8b-400d-e8d7-08da89e77dd8 X-MS-TrafficTypeDiagnostic: DM6PR15MB2730:EE_ X-FB-Source: Internal X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vGk3Qrk1/WpDHgQTc1XB9tuiuiIQHYZXLLsLV2jZPnVmTjxCZVS4Jv9nDj5QNo3Paz52C2i0fbb7mWwWyaJ7flfus3HhhY00Opoqbrhlxk4iBancjT/4sgj9YmGqUGCbqoQKaofNZXeGZM/Lg15cjO+LGNnaiGXggSshUJXjuozHB0sqSz8YqKgQoCwGNQGgGwO02QJZ/bIK+JjikNzRMWvidJcXzTujWIcxzztMF7Qyn8HeopkgVK9w+xnv0B0/ZFRzJCTcufa5gvt7v1JZ+dpssIyOrn5YtmZ12mzqlO0A2+l4QItzelQAgNia5hmxY57PUz98KBmBadk/P/jnyO1nCKEH/iRztDt7fqjl/xeyz/hg7gfqP6IcPH3KMwALoHrhuwWHs1BCcnuYZ+7aJeE2/ZkPl0CRozcb7btZYxkYlHLUwKtEdZNnJeezFqksTZimL36rZ37dOyJ99WNppflwCuZwq+yFWnIcNnWpcqbbLW0qFIQX2vSCl8Xp+fDoV/K3SOnPUmrECD5TOzOsz1uOPf/fbs/zD6/rQpTu0rtaO49ulQJavF5T8mPZrHYHv4oJWEohAcHOVADexHzWFNKCXwlaeblSe9wYUfaBAUdFHqaTHeoB+XpdDEXg3/pPFVUSW6IFV35JHyCyIKlPmHErTICPmLChI9oMmK07BmFOo9qc4rfwDJ/nqNjBQAg59eO0Yt6LGWAfIyDyoBA83A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW4PR15MB4475.namprd15.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(396003)(366004)(136003)(346002)(39860400002)(376002)(54906003)(2906002)(66476007)(6486002)(8676002)(6506007)(52116002)(66556008)(66946007)(1076003)(83380400001)(6916009)(4326008)(186003)(316002)(38100700002)(6512007)(5660300002)(9686003)(86362001)(8936002)(478600001)(41300700001)(7416002)(6666004);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Xp+QCuOoWyw3bZWMRn0ECqqI+s7cOQebx1Zrjl1orWnS8e+zVmQfGVMb2tt2?= =?us-ascii?Q?buxxgZkhff1+Gxg6sIVIuCd8WootHL9tIgmnPWROh9EOormMXPVIBYCagsJP?= =?us-ascii?Q?SIiIeQWY1HHGcjzsECL5M7bETwuaMDqFU0Hhl9cijaiK7sODgH1Y7ReN10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oYpUsnHsAL84+nL2T+Jdx6LKVf9bkd?= =?us-ascii?Q?+YGB28/xmRFYWi2xgQbrPxpwv7NsiTN8ElXVwcD946CE0CrA5JmqqUzzJPfc?= =?us-ascii?Q?DnpoOTTPX8I1u13UUXAXrNQ/wVrlX59+pWeYXTt7ou+hIRysotLqJZ7vPOEB?= =?us-ascii?Q?Wr0lglJ2EvGzvC/xwbr9C1rmX3zfAkou8G278W+2IKpT7bfBlRrkkyKtcO69?= =?us-ascii?Q?LWpId+sD8RrE0ZpPo9rxmSlFCTTo98Y9uU/BI5OIspxX8m5QrncZIFQCnguQ?= =?us-ascii?Q?HLdDrznphGbDCTuRGUMvujiZfNsXSu1esfYR2ea3wZYChHxwvuqEK8IOeXfN?= =?us-ascii?Q?jvA5V4J257ZBxMUZYoSjeDsPbmySWgGCFkmj6s1e3WUBGY3oVhCW0k69d8U1?= =?us-ascii?Q?Ac6xpXUG5+Mp3iZX5h+pZutWM9k15+ElyXZ8hyjy3QpKI3qsMAY2LVeoH87h?= =?us-ascii?Q?ljjc9lPwalznkToVAQlznlC2xlqZhezsACxnsef7hjKQKrOviIU/IFATZVCR?= =?us-ascii?Q?bpLo2YIlQWpuBiyIQjBieh/R3w4UFHbb3Hsgs+5hQKd1bSPr784bZ/UG0pOt?= =?us-ascii?Q?ug=3D=3D?= X-OriginatorOrg: fb.com X-MS-Exchange-CrossTenant-Network-Message-Id: a3edeb90-0c8b-400d-e8d7-08da89e77dd8 X-MS-Exchange-CrossTenant-AuthSource: MW4PR15MB4475.namprd15.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Aug 2022 17:54:17.0365 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: YnuDIdlNjYtUfn/7MG37Tb62Ru0tFMMS5wHbbxe2fBsmAdOV+igvJaM1i4G60SQT X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR15MB2730 X-Proofpoint-ORIG-GUID: f8JOkGPfsmNU8oFMGHoBKTuMKkhX2J8i X-Proofpoint-GUID: f8JOkGPfsmNU8oFMGHoBKTuMKkhX2J8i X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-29_09,2022-08-25_01,2022-06-22_01 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, 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 Sat, Aug 27, 2022 at 03:13:41AM +0200, Jose E. Marchesi wrote: > >> Users can migrate away from libc headers over time, migrating away > > imo, not without a good reason. > > Something that may be a good reason is that there is no BPF port of > glibc (nor of musl, nor of newlib.) And given BPF's restrictions as an > architecture (no more than 5 arguments supported in function calls, etc) > it is very unlikely that there will ever be one. > > Including certain libc headers may work well enough, but in general when > including libc headers you risk dragging in x86, or aarch64, or whatever > architecture-specific headers as well, directly or indirectly. C > libraries (and system libraries in general) are targetted at particular > architectures/ABIs/OSes. > > This means that the same BPF program may be using different data > structures depending on the system where you build it. Note that the data structure difference is not unique to different arch. A more common case can already happen across different kernel versions or different kconfig of the same arch. BPF CO-RE is there to handle this case. > In the worst > case, it may choke on assembler snippets. > > Thats why the GCC port offers certain headers to provide standard C, > like stdint.h. That's the usual way to go for bare-metal targets where > no libc is available. > > Again, we will be happy to change that if that's what you want. In that > case, it will be up to the user to provide the standard definitions, be > it by including glibc headers targetted at some other architecture, or > by some other mean. Not that I would personally recommend that, but it > is up to you. Not sure if the user can always stay with vmlinux.h + a few bpf_tracing_*.h and if that is enough to avoid knowing this difference between GCC and LLVM bpf on libc-vs-gcc stdint...etc. The header changes is hard to swim through to make it compile in GCC BPF. In this case, it is because netinet/tcp.h brought in a different int8_t from gcc than the sys/socket.h. My preference is not to have to dive into this kind of header details. I would like to hear how others think about it. > > > >> shouldn't cause regressions and should improve reliability. > > May be I am missing something. I also don't understand the reliability > > part. > > > > In this sys/socket.h as an example, what is wrong in using > > "'int8_t' {aka 'signed char'}" from libc and the one from > > gcc "'int8_t'; have 'char'" must be used instead. > > > > Why LLVM bpf does not have issue ? > > > >> > >> > 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.