linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RE: [2/4] crypto: af_alg - Allow arbitrarily long algorithm names" email-alg_bind.txt
       [not found] <E1cw2aP-00085S-Q4@gondobar>
@ 2017-11-08 16:51 ` Lukasz Odzioba
  2017-11-27  5:54   ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Lukasz Odzioba @ 2017-11-08 16:51 UTC (permalink / raw)
  To: herbert, linux-kernel; +Cc: lukasz.odzioba

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [2/4] crypto: af_alg - Allow arbitrarily long algorithm names" email-alg_bind.txt
  2017-11-08 16:51 ` [2/4] crypto: af_alg - Allow arbitrarily long algorithm names" email-alg_bind.txt Lukasz Odzioba
@ 2017-11-27  5:54   ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2017-11-27  5:54 UTC (permalink / raw)
  To: Lukasz Odzioba; +Cc: linux-kernel

On Wed, Nov 08, 2017 at 05:51:36PM +0100, Lukasz Odzioba wrote:
> 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.

Thanks for noticing this.  It's obviously still limited by the
underlying system call interface.

However, this isn't actually a problem because the crypto API
is currently limited to 128 bytes.  If and ever we need to inrease
that again then it would become a problem.  The solution would
probably be to switch to a different interface for specifying
such long names.

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-27  5:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <E1cw2aP-00085S-Q4@gondobar>
2017-11-08 16:51 ` [2/4] crypto: af_alg - Allow arbitrarily long algorithm names" email-alg_bind.txt Lukasz Odzioba
2017-11-27  5:54   ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).