All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Anton Protopopov" <aspsk@isovalent.com>,
	"Alexei Starovoitov" <ast@kernel.org>,
	"Andrii Nakryiko" <andrii@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"Jiri Olsa" <jolsa@kernel.org>,
	"Martin KaFai Lau" <martin.lau@linux.dev>,
	"Stanislav Fomichev" <sdf@google.com>,
	bpf@vger.kernel.org
Cc: "Alexander Lobakin" <aleksander.lobakin@intel.com>,
	"Naresh Kamboju" <naresh.kamboju@linaro.org>
Subject: Re: [PATCH bpf-next] bpf: pack struct bpf_fib_lookup
Date: Wed, 03 Apr 2024 22:09:21 +0200	[thread overview]
Message-ID: <18d8417d-835c-4279-9f84-abdc56fa19fb@app.fastmail.com> (raw)
In-Reply-To: <20240403123303.1452184-1-aspsk@isovalent.com>

On Wed, Apr 3, 2024, at 14:33, Anton Protopopov wrote:
> The struct bpf_fib_lookup is supposed to be of size 64. A recent commit
> 59b418c7063d ("bpf: Add a check for struct bpf_fib_lookup size") added
> a static assertion to check this property so that future changes to the
> structure will not accidentally break this assumption.
>
> As it immediately turned out, on some 32-bit arm systems, when AEABI=n,
> the total size of the structure was equal to 68, see [1]. This happened
> because the bpf_fib_lookup structure contains a union of two 16-bit
> fields:
>
>     union {
>             __u16 tot_len;
>             __u16 mtu_result;
>     };

This union was introduced three years ago, so fixing it now means
another incompatible ABI change. While you clearly change it back
to what it should have been the entire time, it's not obvious that
this is the correct thing to do after three years.

I do wonder to what degree we still want to care about OABI
at all. As I mentioned, I stopped testing it myself because it
is no longer relevant to most people, and there are probably
a number of other ABI issues.

> which was supposed to compile to a 16-bit-aligned 16-bit field. On the
> aforementioned setups it was instead both aligned and padded to 32-bits.
>
> Declare this inner union as __attribute__((packed, aligned(2))) such
> that it always is of size 2 and is aligned to 16 bits.

I think you probably want 32-bit alignment for the structure,
to keep the ABI unchanged on all other architectures.

     Arnd

  parent reply	other threads:[~2024-04-03 20:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-03 12:33 [PATCH bpf-next] bpf: pack struct bpf_fib_lookup Anton Protopopov
2024-04-03 12:37 ` Alexander Lobakin
2024-04-03 13:14 ` Daniel Borkmann
2024-04-03 17:52   ` Andrii Nakryiko
2024-04-03 20:09 ` Arnd Bergmann [this message]
2024-04-03 21:00   ` Daniel Borkmann
2024-04-03 22:31     ` Arnd Bergmann
2024-04-04  7:56       ` Anton Protopopov
2024-04-04  9:04         ` Alexander Lobakin
2024-04-04  9:39         ` Arnd Bergmann
2024-04-04 23:00 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=18d8417d-835c-4279-9f84-abdc56fa19fb@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=aleksander.lobakin@intel.com \
    --cc=andrii@kernel.org \
    --cc=aspsk@isovalent.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=jolsa@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=naresh.kamboju@linaro.org \
    --cc=sdf@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.