Messages in this thread | | | From | Lukasz Odzioba <> | Subject | RE: [2/4] crypto: af_alg - Allow arbitrarily long algorithm names" email-alg_bind.txt | Date | Wed, 8 Nov 2017 17:51:36 +0100 |
| |
Hi, I found this patch by accident and it got my attention. I think we can't make this name arbitrarily long because bind syscall checks addrlen before feeding protocol with it. Current limit on my machine is 128 bytes and I can't even reach alg_bind() function if I specify more than that. We may want to revert that.
net/socket.c: SYSCALL_DEFINE3(bind, int, fd, struct sockaddr __user *, umyaddr, int, addrlen) { struct socket *sock; struct sockaddr_storage address; int err, fput_needed;
sock = sockfd_lookup_light(fd, &err, &fput_needed); if (sock) { err = move_addr_to_kernel(umyaddr, addrlen, (struct sockaddr *)&address); (...snip...)
int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr_storage *kaddr) { if (ulen < 0 || ulen > sizeof(struct sockaddr_storage)) return -EINVAL; Thanks, Lukas
| |