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]
Date:	Fri, 08 Mar 2013 11:03:13 +1100
From:	Rusty Russell <rusty@...tcorp.com.au>
To:	James Hogan <james.hogan@...tec.com>,
	Al Viro <viro@...iv.linux.org.uk>
Cc:	Michal Marek <mmarek@...e.cz>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Guenter Roeck <linux@...ck-us.net>,
	Jean Delvare <khali@...ux-fr.org>,
	linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org,
	Mike Frysinger <vapier@...too.org>,
	uclinux-dist-devel@...ckfin.uclinux.org,
	linux-next@...r.kernel.org, James Hogan <james.hogan@...tec.com>
Subject: Re: [RFC -next] linux/linkage.h: fix symbol prefix handling

James Hogan <james.hogan@...tec.com> writes:
> The commit "consolidate cond_syscall and SYSCALL_ALIAS declarations"
> broke the build on blackfin and metag due to the following code:
>
>   #ifndef SYMBOL_NAME
>   #ifdef CONFIG_SYMBOL_PREFIX
>   #define SYMBOL_NAME(x) CONFIG_SYMBOL_PREFIX ## x
>   #else
>   #define SYMBOL_NAME(x) x
>   #endif
>   #endif
>   #define __SYMBOL_NAME(x) __stringify(SYMBOL_NAME(x))
>
> __stringify literally stringifies CONFIG_SYMBOL_PREFIX ##x, so you get
> lines like this in the assembly output:
>
>   .weak CONFIG_SYMBOL_PREFIXsys_quotactl
>   .set
>   CONFIG_SYMBOL_PREFIXsys_quotactl,CONFIG_SYMBOL_PREFIXsys_ni_syscall
>
> This is fixed by defining SYMBOL_PREFIX from the command line for c
> files in addition to assembly for architectures that set
> CONFIG_SYMBOL_PREFIX (scripts/Makefile.lib), and defining __SYMBOL_NAME
> as:
>
>   #define __SYMBOL_NAME(x) __stringify(SYMBOL_PREFIX) #x
>
> We first have to ensure SYMBOL_PREFIX is defined (which avoids polluting
> the command lines for architectures that don't use symbol prefixes).
> Also the definition of SYMBOL_PREFIX in <linux/kernel.h> is removed as
> it conflicts, isn't used anywhere, and is defined as a string so differs
> from the assembly definition.

So now, if CONFIG_SYMBOL_PREFIX, SYMBOL_PREFIX is defined on the cmdline
as a string.  Otherwise it's empty (not the empty string?):

> +/* This helps us to avoid #ifdef SYMBOL_PREFIX */
> +#ifndef SYMBOL_PREFIX
> +#define SYMBOL_PREFIX
>  #endif
> -#define __SYMBOL_NAME(x) __stringify(SYMBOL_NAME(x))
> +
> +#define __SYMBOL_NAME(x) __stringify(SYMBOL_PREFIX) #x

And why are you __stringify()ing a string?

>  #ifndef cond_syscall
>  #define cond_syscall(x) asm(".weak\t" __SYMBOL_NAME(x) \
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index 07125e6..f1cce6a 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -123,6 +123,7 @@ ifdef CONFIG_SYMBOL_PREFIX
>  _sym_flags = -DSYMBOL_PREFIX=$(patsubst "%",%,$(CONFIG_SYMBOL_PREFIX))
>  _cpp_flags += $(_sym_flags)
>  _a_flags += $(_sym_flags)
> +_c_flags += $(_sym_flags)
>  endif

Confused,
Rusty.
--
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