diff options
Diffstat (limited to 'kernel/bpf/syscall.c')
-rw-r--r-- | kernel/bpf/syscall.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index 85cbeec06e50..f9554d9a14e1 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c | |||
@@ -1452,9 +1452,14 @@ static int bpf_prog_load(union bpf_attr *attr, union bpf_attr __user *uattr) | |||
1452 | if (CHECK_ATTR(BPF_PROG_LOAD)) | 1452 | if (CHECK_ATTR(BPF_PROG_LOAD)) |
1453 | return -EINVAL; | 1453 | return -EINVAL; |
1454 | 1454 | ||
1455 | if (attr->prog_flags & ~BPF_F_STRICT_ALIGNMENT) | 1455 | if (attr->prog_flags & ~(BPF_F_STRICT_ALIGNMENT | BPF_F_ANY_ALIGNMENT)) |
1456 | return -EINVAL; | 1456 | return -EINVAL; |
1457 | 1457 | ||
1458 | if (!IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && | ||
1459 | (attr->prog_flags & BPF_F_ANY_ALIGNMENT) && | ||
1460 | !capable(CAP_SYS_ADMIN)) | ||
1461 | return -EPERM; | ||
1462 | |||
1458 | /* copy eBPF program license from user space */ | 1463 | /* copy eBPF program license from user space */ |
1459 | if (strncpy_from_user(license, u64_to_user_ptr(attr->license), | 1464 | if (strncpy_from_user(license, u64_to_user_ptr(attr->license), |
1460 | sizeof(license) - 1) < 0) | 1465 | sizeof(license) - 1) < 0) |