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:	Wed, 19 Jan 2011 14:50:24 -0800
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Joe Perches <joe@...ches.com>
Cc:	Dan Rosenberg <drosenberg@...curity.com>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] vsprintf: Neaten %pK kptr_restrict, save a bit of code
 space

On Thu, 13 Jan 2011 12:21:12 -0800
Joe Perches <joe@...ches.com> wrote:

> If kptr restrictions are on, just set the passed pointer to NULL.
> 
> $ size lib/vsprintf.o.*
>    text	   data	    bss	    dec	    hex	filename
>    8247	      4	      2	   8253	   203d	lib/vsprintf.o.new
>    8282	      4	      2	   8288	   2060	lib/vsprintf.o.old
> 
> Signed-off-by: Joe Perches <joe@...ches.com>
> 
> ---
> 
>  lib/vsprintf.c |   14 +++++---------
>  1 files changed, 5 insertions(+), 9 deletions(-)
> 
> diff --git a/lib/vsprintf.c b/lib/vsprintf.c
> index d3023df..070d134 100644
> --- a/lib/vsprintf.c
> +++ b/lib/vsprintf.c
> @@ -1047,16 +1047,12 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
>  			if (spec.field_width == -1)
>  				spec.field_width = 2 * sizeof(void *);
>  			return string(buf, end, "pK-error", spec);
> -		} else if ((kptr_restrict == 0) ||
> -			 (kptr_restrict == 1 &&
> -			  has_capability_noaudit(current, CAP_SYSLOG)))
> -			break;
> -
> -		if (spec.field_width == -1) {
> -			spec.field_width = 2 * sizeof(void *);
> -			spec.flags |= ZEROPAD;
>  		}
> -		return number(buf, end, 0, spec);
> +		if (!((kptr_restrict == 0) ||
> +		      (kptr_restrict == 1 &&
> +		       has_capability_noaudit(current, CAP_SYSLOG))))
> +			ptr = NULL;
> +		break;
>  	}
>  	spec.flags |= SMALL;
>  	if (spec.field_width == -1) {

This hurts my brain.   Does it work?
--
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