Daniel Borkmann
36f9814a49
bpf: fix uapi hole for 32 bit compat applications
In 64 bit, we have a 4 byte hole between ifindex and netns_dev in the
case of struct bpf_map_info but also struct bpf_prog_info. In net-next
commit b85fab0e67 ("bpf: Add gpl_compatible flag to struct bpf_prog_info")
added a bitfield into it to expose some flags related to programs. Thus,
add an unnamed __u32 bitfield for both so that alignment keeps the same
in both 32 and 64 bit cases, and can be naturally extended from there
as in b85fab0e67.
Before:
# file test.o
test.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped
# pahole test.o
struct bpf_map_info {
__u32 type; /* 0 4 */
__u32 id; /* 4 4 */
__u32 key_size; /* 8 4 */
__u32 value_size; /* 12 4 */
__u32 max_entries; /* 16 4 */
__u32 map_flags; /* 20 4 */
char name[16]; /* 24 16 */
__u32 ifindex; /* 40 4 */
__u64 netns_dev; /* 44 8 */
__u64 netns_ino; /* 52 8 */
/* size: 64, cachelines: 1, members: 10 */
/* padding: 4 */
};
After (same as on 64 bit):
# file test.o
test.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped
# pahole test.o
struct bpf_map_info {
__u32 type; /* 0 4 */
__u32 id; /* 4 4 */
__u32 key_size; /* 8 4 */
__u32 value_size; /* 12 4 */
__u32 max_entries; /* 16 4 */
__u32 map_flags; /* 20 4 */
char name[16]; /* 24 16 */
__u32 ifindex; /* 40 4 */
/* XXX 4 bytes hole, try to pack */
__u64 netns_dev; /* 48 8 */
__u64 netns_ino; /* 56 8 */
/* --- cacheline 1 boundary (64 bytes) --- */
/* size: 64, cachelines: 1, members: 10 */
/* sum members: 60, holes: 1, sum holes: 4 */
};
Reported-by: Dmitry V. Levin <ldv@altlinux.org>
Reported-by: Eugene Syromiatnikov <esyr@redhat.com>
Fixes: 52775b33bb ("bpf: offload: report device information about offloaded maps")
Fixes: 675fc275a3 ("bpf: offload: report device information for offloaded programs")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2018-06-01 20:41:35 -07:00
..
2018-02-23 05:28:41 -05:00
2018-04-27 00:39:29 +02:00
2018-03-30 11:03:39 +02:00
2018-02-21 13:15:33 -05:00
2018-03-21 11:46:33 +01:00
2018-02-27 13:02:54 +01:00
2018-03-14 10:15:34 +01:00
2018-03-30 14:16:24 -06:00
2018-03-08 02:22:34 +01:00
2018-06-01 20:41:35 -07:00
2018-02-14 13:23:51 -05:00
2018-02-14 13:23:51 -05:00
2018-04-11 10:28:38 -07:00
2018-04-04 12:12:38 -04:00
2018-02-23 14:29:59 +00:00
2018-02-27 14:19:11 -05:00
2018-03-26 13:46:46 -07:00
2018-02-28 22:44:43 -05:00
2018-03-23 11:31:58 -04:00
2018-04-23 11:10:33 -04:00
2018-03-22 15:00:44 -04:00
2018-02-14 11:16:28 +01:00
2018-02-26 09:49:21 -06:00
2018-02-27 07:42:51 -06:00
2018-02-27 07:42:51 -06:00
2018-03-15 17:27:51 -04:00
2018-04-27 18:37:17 +02:00
2018-02-13 11:23:24 -05:00
2018-04-03 17:16:59 -07:00
2018-02-26 10:14:46 -05:00
2018-03-17 14:45:23 -06:00
2018-04-11 10:28:37 -07:00
2018-03-05 10:43:37 -05:00
2018-05-18 10:01:06 +02:00
2018-03-21 16:23:55 -05:00
2018-04-17 09:47:39 -03:00
2018-03-08 12:16:29 -05:00
2018-05-24 22:55:07 -04:00
2018-05-05 00:51:43 +02:00
2018-02-24 02:24:11 +01:00
2018-02-21 16:56:03 -08:00
2018-03-20 03:17:41 +02:00
2018-04-14 11:59:31 -04:00
2018-04-23 11:10:33 -04:00
2018-04-06 15:39:26 -07:00
2018-05-05 00:51:44 +02:00
2018-04-11 10:28:37 -07:00
2018-03-09 11:01:19 -08:00
2018-04-11 10:28:37 -07:00
2018-03-28 18:47:18 +03:00
2018-04-16 11:26:49 +02:00
2018-03-16 15:07:48 -04:00
2018-04-26 14:53:32 +02:00
2018-03-23 13:12:18 -04:00
2018-03-22 14:43:35 -04:00
2018-03-31 22:19:52 -04:00
2018-04-23 11:10:33 -04:00
2018-03-22 06:32:15 -04:00
2018-02-26 08:15:50 -05:00
2018-03-26 13:22:58 -06:00
2018-03-22 06:26:05 -04:00
2018-04-24 21:44:01 +03:00