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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20060802074308.babd264e.akpm@osdl.org>
Date:	Wed, 2 Aug 2006 07:43:08 -0700
From:	Andrew Morton <akpm@...l.org>
To:	Jan Blunck <jblunck@...e.de>
Cc:	linux-kernel@...r.kernel.org, paulus@...ba.org
Subject: Re: [PATCH] fix vmstat per cpu usage

On Wed, 2 Aug 2006 15:30:06 +0200
Jan Blunck <jblunck@...e.de> wrote:

> Here comes another idea. To find further wrong usage of percpu variables I
> wrote the following patch. It still needs some work for the other archs but
> I'm interested in your feedback about that.
> 
> ...
> 
> Index: linux-2.6/include/asm-generic/percpu.h
> ===================================================================
> --- linux-2.6.orig/include/asm-generic/percpu.h
> +++ linux-2.6/include/asm-generic/percpu.h
> @@ -14,7 +14,9 @@ extern unsigned long __per_cpu_offset[NR
>      __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name
>  
>  /* var is in discarded region: offset to particular copy we want */
> -#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
> +#define per_cpu(var, cpu) (*({				\
> +	int user_error_##var __attribute__ ((unused));	\
> +	RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]); }))

What's it do?  Forces a syntax error if `var' isn't a simple identifier?

Seems sane, although I'd check that the compiler doesn't accidentally
waste a stack slot for that local.  Perhaps it's be safer to make
it a non-existing function:

	extern int user_error#var(void);

-
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