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: <CACqU3MU2pjcqgYDjn=S2asdLamU0mity+kLizH_mbTtJU5Fh2A@mail.gmail.com>
Date:	Sun, 14 Aug 2011 12:55:41 -0400
From:	Arnaud Lacombe <lacombar@...il.com>
To:	Rabin Vincent <rabin@....in>
Cc:	Michal Marek <mmarek@...e.cz>, linux-kbuild@...r.kernel.org,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: IS_ENABLED() and non-available symbols

Hi,

On Sun, Aug 14, 2011 at 6:56 AM, Rabin Vincent <rabin@....in> wrote:
> I'm trying to use the new IS_ENABLED() stuff, but it appears that it
> only works if the symbol being tested has its dependencies met, and
> results in compiler errors if that is not the case.
>
> For example, I've added code using IS_ENABLED(CONFIG_THUMB2_KERNEL) as
> in the below patch.  My config is arch/arm/configs/omap2plus_defconfig
> which doesn't satisfy the dependencies for CONFIG_THUMB2_KERNEL (defined
> in arch/arm/Kconfig).
>
> Compiling results in the following errors (and indeed the macro hasn't
> been generated in include/generated/autoconfg.h).  If I modify my config
> to satisfy the dependencies for CONFIG_THUMB2_KERNEL so that it is
> selectable, the __enabled_CONFIG_THUMB2_KERNEL macro gets generated.
>
> arch/arm/kernel/setup.c: In function 'c_show':
> arch/arm/kernel/setup.c:1056: error: '__enabled_CONFIG_THUMB2_KERNEL'
> undeclared (first use in this function)
> arch/arm/kernel/setup.c:1056: error: (Each undeclared identifier is
> reported only once
> arch/arm/kernel/setup.c:1056: error: for each function it appears in.)
> arch/arm/kernel/setup.c:1056: error:
> '__enabled_CONFIG_THUMB2_KERNEL_MODULE' undeclared (first use in this
> function)
>
> Kernel is latest linus (v3.1-rc1-272-g73e0881).
>
Ahhh! That is why we have been stuck with #ifdef all these years!

What you point out is quite interesting. I guess that we did not
carefully understood the context in which this was printed. That is,
we will only ends up printing something if the symbol is visible, or
has been selected, or has a default. That said
__enabled_CONFIG_THUMB2_KERNEL will get generated whenever it appears
in the menuconfig (ie. it's dependency are met).

The solution is trivial, but I am not sure we want to go that way: we
need to generated a __enabled_ entry for symbols for _all_ symbols in
the configuration, even internal one, as I am sure someone will at
some point do:

if (IS_ENABLED(CONFIG_WIRELESS_EXT)) {
    ....
}

but this will continue to be broken until we have a global symbol
namespace for all architecture, ie:

if (IS_ENABLED(CONFIG_ARM)) {
    ....
}

will not be expected to work for an ARCH=mips build.

 - Arnaud

> diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
> index 70bca64..59aa480 100644
> --- a/arch/arm/kernel/setup.c
> +++ b/arch/arm/kernel/setup.c
> @@ -1053,6 +1053,9 @@ static int c_show(struct seq_file *m, void *v)
>        seq_printf(m, "Serial\t\t: %08x%08x\n",
>                   system_serial_high, system_serial_low);
>
> +       if (IS_ENABLED(CONFIG_THUMB2_KERNEL))
> +               printk("Thumb-2\n");
> +
>        return 0;
>  }
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
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