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=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 CA17EC433DF for ; Tue, 2 Jun 2020 23:21:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A97C32067B for ; Tue, 2 Jun 2020 23:21:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=mforney-org.20150623.gappssmtp.com header.i=@mforney-org.20150623.gappssmtp.com header.b="sc4v2U5d" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728285AbgFBXVD (ORCPT ); Tue, 2 Jun 2020 19:21:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727011AbgFBXVC (ORCPT ); Tue, 2 Jun 2020 19:21:02 -0400 Received: from mail-il1-x143.google.com (mail-il1-x143.google.com [IPv6:2607:f8b0:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FCACC08C5C2 for ; Tue, 2 Jun 2020 16:21:02 -0700 (PDT) Received: by mail-il1-x143.google.com with SMTP id d1so590846ila.8 for ; Tue, 02 Jun 2020 16:21:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mforney-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=rKLwbDj0Nm8UB8U3LBRjaFhNE/ibgWumyiHSHHsuajI=; b=sc4v2U5d8vQlexafU7mTJ1c0h9lF0UrIOSIcY8kJcHY7zHVzolCwLZHC9VrLISRD9q ZzWDc8BjLytNhe+KpuKsZ5lYSfSsp3QhxKC58ad/B5fkfhUXWgA9r+KLPmpuA4wWzQ2j WM9fDoGz3tTSHNWMFgDtZeFmq7Q4C4ffMAwI4P7FYbCJTT8/B45GwlfD5ET8/FWJ17tV 4Htg4wO90KnCmdjrl9M42ilWDCjOul5YITEsTC5dkQwTI0U7kLTOrAuuLGghF5hDNbYQ nDn+HKPbtEkgo0nqhpcCFJY6IpzPOKX7M/P2aiKyNiaAbozllRbxOCmA6X8Z7mNZ11PE iXvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=rKLwbDj0Nm8UB8U3LBRjaFhNE/ibgWumyiHSHHsuajI=; b=T3tVwiunfWHLTTOlvnPwIT1J/bwaPhmgYyWI9r2rdBvZkJcRAZxxeT62vbWGxiZqHd ckj7sW673Z6s6tSpBzkxbHT+B3vsRS0fM5cIOPHdBCE/TfMXQK2xtjUZnJsDDBOk+GCc /GNoY+Ar2Ah855yAD83lLaDOjXTHvQPzu4DN1a8ZKq4PpdbjS/zEwINJ9tOpq0vqd29v IUEC7ewXevY1zf1VThZ8Jf+iwjyGDglT+NPMQbc197gNEeUYABl0vFGAbpjrxhC+608p F6y5kBsDhsqJTuLeF5yCdSYi4vBMeAUqS9t7jZREgEipeMJ5cQWZYdgM2TT/Ecy+6jqT ozaA== X-Gm-Message-State: AOAM530xK/2MVofRsP256xM3FxXQ9XMsTRO6huITQLazjO+Oc2IVEhyD idgGfjcsneFXV1Bqpctd1fUSu+2NxiU59jm+T8aHAQ== X-Google-Smtp-Source: ABdhPJyU5GjMh5Pz9ddkKuUVlM4AEBS535l20xZroynV46Yl/4egt2hFWdCTfTTuEu9XbC3QBw28pDIYY9+vHKwnAEw= X-Received: by 2002:a92:2a06:: with SMTP id r6mr1457141ile.121.1591140061496; Tue, 02 Jun 2020 16:21:01 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a05:6638:150:0:0:0:0 with HTTP; Tue, 2 Jun 2020 16:21:00 -0700 (PDT) X-Originating-IP: [73.70.188.119] In-Reply-To: <20200602230720.hf2ysnlssg67cpmw@ast-mbp.dhcp.thefacebook.com> References: <20200303003233.3496043-1-andriin@fb.com> <20200303003233.3496043-2-andriin@fb.com> <87blpc4g14.fsf@toke.dk> <945cf1c4-78bb-8d3c-10e3-273d100ce41c@iogearbox.net> <20200602191703.xbhgy75l7cb537xe@ast-mbp.dhcp.thefacebook.com> <20200602230720.hf2ysnlssg67cpmw@ast-mbp.dhcp.thefacebook.com> From: Michael Forney Date: Tue, 2 Jun 2020 16:21:00 -0700 Message-ID: Subject: Re: [PATCH v3 bpf-next 1/3] bpf: switch BPF UAPI #define constants used from BPF program side to enums To: Alexei Starovoitov Cc: Daniel Borkmann , =?UTF-8?B?VG9rZSBIw7hpbGFuZC1Kw7hyZ2Vuc2Vu?= , Andrii Nakryiko , Andrii Nakryiko , bpf , Networking , Alexei Starovoitov , Kernel Team , Yonghong Song Content-Type: text/plain; charset="UTF-8" Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On 2020-06-02, Alexei Starovoitov wrote: > the enum definition of BPF_F_CTXLEN_MASK is certainly within standard. > I don't think kernel should adjust its headers because some compiler > is failing to understand C standard. This is not true. See C11 6.7.2.2p2: "The expression that defines the value of an enumeration constant shall be an integer constant expression that has a value representable as an int." You can also see this with gcc if you turn on -Wpedantic and include it in a way such that warnings are not silenced: $ gcc -Wpedantic -x c -c -o /dev/null /usr/include/linux/bpf.h /usr/include/linux/bpf.h:76:7: warning: ISO C forbids zero-size array 'data' [-Wpedantic] 76 | __u8 data[0]; /* Arbitrary size */ | ^~~~ /usr/include/linux/bpf.h:3220:22: warning: ISO C restricts enumerator values to range of 'int' [-Wpedantic] 3220 | BPF_F_INDEX_MASK = 0xffffffffULL, | ^~~~~~~~~~~~~ /usr/include/linux/bpf.h:3221:23: warning: ISO C restricts enumerator values to range of 'int' [-Wpedantic] 3221 | BPF_F_CURRENT_CPU = BPF_F_INDEX_MASK, | ^~~~~~~~~~~~~~~~ /usr/include/linux/bpf.h:3223:23: warning: ISO C restricts enumerator values to range of 'int' [-Wpedantic] 3223 | BPF_F_CTXLEN_MASK = (0xfffffULL << 32), | ^ /usr/include/linux/bpf.h:3797:8: warning: ISO C forbids zero-size array 'args' [-Wpedantic] 3797 | __u64 args[0]; | ^~~~ $ -Michael