Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB9FBC64EC4 for ; Thu, 9 Feb 2023 20:51:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230124AbjBIUvN (ORCPT ); Thu, 9 Feb 2023 15:51:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229993AbjBIUun (ORCPT ); Thu, 9 Feb 2023 15:50:43 -0500 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9760068AEC; Thu, 9 Feb 2023 12:50:41 -0800 (PST) Received: by mail-ej1-x62f.google.com with SMTP id p26so10161010ejx.13; Thu, 09 Feb 2023 12:50:41 -0800 (PST) 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:subject:date:message-id:reply-to; bh=16FEumpbkgL1MCG/IVXi8cJSa5wU9goiP6cIWmoP7F4=; b=Gh9a8uG0WIdgAQFXBDEUSdZ7S1K86OT6H1iU4sahvmhqa55CnTVXKVd8wMt2BTOnj2 NvcrAzKOhYK9HCHFw97nMkR8AVPfCav6p2EmZ7Mh6fF8AAfqAPp1IcZdWGQ7nrl8Z2qy 0wHWrIW8WPjK2MqRNi0qeuD+TgJtbm331iwRkx3iIT7sBOijAR3V4nqd7L3WcLMJOlkW 9gliPZDQpG242NjQRZdu6uWTwh3oS8UxJWi+wyQ1JY8jABZFJYTHNVUXShEqPAfNwS7X FeOgnifYuUOKFr6LBcAvKRVCHlhM+GtOc2zr9BzBVfNcJ0+3fp13bKZkYjnHposTO+mN R55w== 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:subject:date:message-id :reply-to; bh=16FEumpbkgL1MCG/IVXi8cJSa5wU9goiP6cIWmoP7F4=; b=Zn5h07SihWGpKcGKRCoIP5ogkfQhmmfyp3oxPVUrKtERAp/gLM7mXgOJz7zdm0vtH2 Y7QuxfUMByqg6zQq46EWzVszGC8tiWPluJkaJbpjBFcygwFhASoALQ9IL1ZZjtRQQNas PZEjQMmHcb5fAk3RZq8Y8OklufKz47j99SrL9wejTR85os5cLMKrsqRwNEVKWW7TO61g JuFv+RccUT4gh+XkomfPzZIo0vuig+Nqv/EjdPGz99l6OpJz0BMojSwpuOdTu68/TeFn FBr+03MenoNgcA/e/jPNCsEcf5E8sXw2vLzeg2XVTrFpV2eRghwk6+DPFbrSUNbDDb3u rJeA== X-Gm-Message-State: AO0yUKWunjmWleKewH57vEdCIGdC4Inc7P6A532msu9jo8T7ddGwXagq nBoqxyHDNSYdOARHMStOB2v3wZ0ynnm++l8Iw8A= X-Google-Smtp-Source: AK7set+p5mLQGphNYZB7dnhNqdO21SQcEKpkwXk0xEbzZMF4iA+oCC60QJo2PoyrdEwk2ZZkmnVRGCMKWTd9t4QQN1k= X-Received: by 2002:a17:906:eb8f:b0:878:786e:8c39 with SMTP id mh15-20020a170906eb8f00b00878786e8c39mr2906402ejb.105.1675975840025; Thu, 09 Feb 2023 12:50:40 -0800 (PST) MIME-Version: 1.0 References: <20230209192337.never.690-kees@kernel.org> <63e5521a.170a0220.297d7.3a80@mx.google.com> In-Reply-To: <63e5521a.170a0220.297d7.3a80@mx.google.com> From: Alexei Starovoitov Date: Thu, 9 Feb 2023 12:50:28 -0800 Message-ID: Subject: Re: [PATCH] bpf: Deprecate "data" member of bpf_lpm_trie_key To: Kees Cook Cc: Andrii Nakryiko , Alexei Starovoitov , Stanislav Fomichev , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Hao Luo , Jiri Olsa , Mykola Lysenko , Shuah Khan , Haowen Bai , bpf , "open list:KERNEL SELFTEST FRAMEWORK" , "David S. Miller" , Jakub Kicinski , Jesper Dangaard Brouer , Nathan Chancellor , Nick Desaulniers , Tom Rix , LKML , Network Development , clang-built-linux , linux-hardening@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 9, 2023 at 12:05 PM Kees Cook wrote: > > On Thu, Feb 09, 2023 at 11:52:10AM -0800, Andrii Nakryiko wrote: > > Do we need to add a new type to UAPI at all here? We can make this new > > struct internal to kernel code (e.g. struct bpf_lpm_trie_key_kern) and > > point out that it should match the layout of struct bpf_lpm_trie_key. > > User-space can decide whether to use bpf_lpm_trie_key as-is, or if > > just to ensure their custom struct has the same layout (I see some > > internal users at Meta do just this, just make sure that they have > > __u32 prefixlen as first member). > > The uses outside the kernel seemed numerous enough to justify a new UAPI > struct (samples, selftests, etc). It also paves a single way forward > when the userspace projects start using modern compiler options (e.g. > systemd is usually pretty quick to adopt new features). I don't understand how the new uapi struct bpf_lpm_trie_key_u8 helps. cilium progs and progs/map_ptr_kern.c cannot do s/bpf_lpm_trie_key/bpf_lpm_trie_key_u8/. They will fail to build, so they're stuck with bpf_lpm_trie_key. Can we do just struct bpf_lpm_trie_key_kern { __u32 prefixlen; __u8 data[]; }; and use it in the kernel? What is the disadvantage?