lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 16 Dec 2008 23:49:27 -0800
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Al Viro <viro@....linux.org.uk>
Cc:	linux-audit@...hat.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/15] don't reallocate buffer in every audit_sockaddr()

On Wed, 17 Dec 2008 05:11:10 +0000 Al Viro <viro@....linux.org.uk> wrote:

>  int audit_sockaddr(int len, void *a)
>  {
> -	struct audit_aux_data_sockaddr *ax;
>  	struct audit_context *context = current->audit_context;
>  
>  	if (likely(!context || context->dummy))
>  		return 0;
>  
> -	ax = kmalloc(sizeof(*ax) + len, GFP_KERNEL);
> -	if (!ax)
> -		return -ENOMEM;
> -
> -	ax->len = len;
> -	memcpy(ax->a, a, len);
> +	if (!context->sockaddr) {
> +		void *p = kmalloc(sizeof(struct sockaddr_storage), GFP_KERNEL);

argh, I really hate having to run all around the code verifying that
the type passed to sizeof matches the type that we'll be storing there :(


> +		if (!p)
> +			return -ENOMEM;
> +		context->sockaddr = p;
> +	}
>  
> -	ax->d.type = AUDIT_SOCKADDR;
> -	ax->d.next = context->aux;
> -	context->aux = (void *)ax;
> +	context->sockaddr_len = len;
> +	memcpy(context->sockaddr, a, len);
>  	return 0;
>  }

stoopid question: can an audit_contect be shared between
threads/processes?  If so, is locking needed around the read/test/write
of context->sockaddr and friends?  
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ