Skip to content

Commit 7ad8474

Browse files
sinkapKernel Patches Daemon
authored andcommitted
bpf: Check size of the signature buffer
Accept only a SHA256 sized buffer. Fixes: 3492715 ("bpf: Implement signature verification for BPF programs") Reported-by: Chris Mason <[email protected]> Signed-off-by: KP Singh <[email protected]>
1 parent 8f87988 commit 7ad8474

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

kernel/bpf/syscall.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2826,6 +2826,9 @@ static int bpf_prog_verify_signature(struct bpf_prog *prog, union bpf_attr *attr
28262826
void *sig;
28272827
int err = 0;
28282828

2829+
if (attr->signature_size != SHA256_DIGEST_SIZE)
2830+
return -EINVAL;
2831+
28292832
if (system_keyring_id_check(attr->keyring_id) == 0)
28302833
key = bpf_lookup_system_key(attr->keyring_id);
28312834
else

0 commit comments

Comments
 (0)