Repository navigation
Commit 1fbc2e0
bpf: make sure to clear unused fields in tunnel/xfrm state fetch
Since the remaining bits are not filled in struct bpf_tunnel_key
resp. struct bpf_xfrm_state and originate from uninitialized stack
space, we should make sure to clear them before handing control
back to the program.
Also add a padding element to struct bpf_xfrm_state for future use
similar as we have in struct bpf_tunnel_key and clear it as well.
struct bpf_xfrm_state {
__u32 reqid; /* 0 4 */
__u32 spi; /* 4 4 */
__u16 family; /* 8 2 */
/* XXX 2 bytes hole, try to pack */
union {
__u32 remote_ipv4; /* 4 */
__u32 remote_ipv6[4]; /* 16 */
}; /* 12 16 */
/* size: 28, cachelines: 1, members: 4 */
/* sum members: 26, holes: 1, sum holes: 2 */
/* last cacheline: 28 bytes */
};
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>1 parent cb20b08 commit 1fbc2e0
2 files changed
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2268 | 2268 | | |
2269 | 2269 | | |
2270 | 2270 | | |
2271 | | - | |
| 2271 | + | |
2272 | 2272 | | |
2273 | 2273 | | |
2274 | 2274 | | |
| |||
2279 | 2279 | | |
2280 | 2280 | | |
2281 | 2281 | | |
| 2282 | + | |
2282 | 2283 | | |
2283 | 2284 | | |
2284 | 2285 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3445 | 3445 | | |
3446 | 3446 | | |
3447 | 3447 | | |
| 3448 | + | |
3448 | 3449 | | |
3449 | 3450 | | |
3450 | 3451 | | |
3451 | 3452 | | |
3452 | 3453 | | |
3453 | 3454 | | |
3454 | 3455 | | |
| 3456 | + | |
| 3457 | + | |
3455 | 3458 | | |
3456 | 3459 | | |
3457 | 3460 | | |
| |||
4047 | 4050 | | |
4048 | 4051 | | |
4049 | 4052 | | |
| 4053 | + | |
| 4054 | + | |
4050 | 4055 | | |
4051 | 4056 | | |
4052 | 4057 | | |
4053 | 4058 | | |
4054 | 4059 | | |
| 4060 | + | |
4055 | 4061 | | |
4056 | 4062 | | |
4057 | 4063 | | |
| |||
0 commit comments