linux-stable/include/uapi
Anton Protopopov 90098f0a16 bpf: Pack struct bpf_fib_lookup
[ Upstream commit f917170072 ]

The struct bpf_fib_lookup is supposed to be of size 64. A recent commit
59b418c706 ("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;
    };

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.

  [1] https://lore.kernel.org/all/CA+G9fYtsoP51f-oP_Sp5MOq-Ffv8La2RztNpwvE6+R1VtFiLrw@mail.gmail.com/#t

Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Fixes: e1850ea9bd ("bpf: bpf_fib_lookup return MTU value as output when looked up")
Signed-off-by: Anton Protopopov <aspsk@isovalent.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20240403123303.1452184-1-aspsk@isovalent.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-06-12 11:03:08 +02:00
..
asm-generic open: return EINVAL for O_DIRECTORY | O_CREAT 2023-05-24 17:32:34 +01:00
drm drm/virtio: exbuf->fence_fd unmodified on interrupted wait 2023-02-14 19:11:45 +01:00
linux bpf: Pack struct bpf_fib_lookup 2024-06-12 11:03:08 +02:00
misc This update includes the following changes: 2022-10-10 13:04:25 -07:00
mtd This pull request contains updates for UBI and UBIFS 2022-10-14 18:23:23 -07:00
rdma RDMA/irdma: Allow accurate reporting on QP max send/recv WR 2024-03-26 18:20:53 -04:00
scsi scsi: mpi3mr: Avoid memcpy field-spanning write WARNING 2024-05-17 11:56:04 +02:00
sound ASoC: Intel: Skylake: Fix declaration of enum skl_ch_cfg 2023-05-30 14:03:32 +01:00
video
xen
Kbuild