2008-11-28 17:37:47

by Vegard Nossum

[permalink] [raw]
Subject: [PATCH] kbuild: fix CONFIG_EMBEDDED submenu

>From 06f65799401f08eff0020ba0300133c89bd02349 Mon Sep 17 00:00:00 2001
From: Vegard Nossum <[email protected]>
Date: Fri, 28 Nov 2008 18:29:47 +0100
Subject: [PATCH] kbuild: fix CONFIG_EMBEDDED submenu

Many of the elements of the EMBEDDED submenu were being expanded
in the current menu instead of inside the submenu. This was caused
by the lack of (explicit) dependencies on EMBEDDED. The simplest
fix is to wrap everything (except COMPAT_BRK, which just toggles a
setting) in "if/endif EMBEDDED".

Signed-off-by: Vegard Nossum <[email protected]>
---
init/Kconfig | 27 +++++++++++++++------------
1 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/init/Kconfig b/init/Kconfig
index f763762..4590d97 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -546,6 +546,7 @@ menuconfig EMBEDDED
environments which can tolerate a "non-standard" kernel.
Only use this if you really know what you are doing.

+if EMBEDDED
config UID16
bool "Enable 16-bit UID system calls" if EMBEDDED
depends on ARM || BLACKFIN || CRIS || FRV || H8300 || X86_32 || M68K || (S390 && !64BIT) || SUPERH || SPARC32 || (SPARC64 && COMPAT) || UML || (X86_64 && IA32_EMULATION)
@@ -643,18 +644,6 @@ config PCSPKR_PLATFORM
This option allows to disable the internal PC-Speaker
support, saving some memory.

-config COMPAT_BRK
- bool "Disable heap randomization"
- default y
- help
- Randomizing heap placement makes heap exploits harder, but it
- also breaks ancient binaries (including anything libc5 based).
- This option changes the bootup default to heap randomization
- disabled, and can be overriden runtime by setting
- /proc/sys/kernel/randomize_va_space to 2.
-
- On non-ancient distros (post-2000 ones) N is usually a safe choice.
-
config BASE_FULL
default y
bool "Enable full-sized data structures for core" if EMBEDDED
@@ -760,6 +749,20 @@ config SLUB_DEBUG
SLUB sysfs support. /sys/slab will not exist and there will be
no support for cache validation etc.

+endif
+
+config COMPAT_BRK
+ bool "Disable heap randomization"
+ default y
+ help
+ Randomizing heap placement makes heap exploits harder, but it
+ also breaks ancient binaries (including anything libc5 based).
+ This option changes the bootup default to heap randomization
+ disabled, and can be overriden runtime by setting
+ /proc/sys/kernel/randomize_va_space to 2.
+
+ On non-ancient distros (post-2000 ones) N is usually a safe choice.
+
choice
prompt "Choose SLAB allocator"
default SLUB
--
1.5.6.5


2008-11-28 22:42:17

by Vegard Nossum

[permalink] [raw]
Subject: Re: [PATCH] kbuild: fix CONFIG_EMBEDDED submenu

On Fri, Nov 28, 2008 at 6:38 PM, Vegard Nossum <[email protected]> wrote:
> From 06f65799401f08eff0020ba0300133c89bd02349 Mon Sep 17 00:00:00 2001
> From: Vegard Nossum <[email protected]>
> Date: Fri, 28 Nov 2008 18:29:47 +0100
> Subject: [PATCH] kbuild: fix CONFIG_EMBEDDED submenu
>
> Many of the elements of the EMBEDDED submenu were being expanded
> in the current menu instead of inside the submenu. This was caused
> by the lack of (explicit) dependencies on EMBEDDED. The simplest
> fix is to wrap everything (except COMPAT_BRK, which just toggles a
> setting) in "if/endif EMBEDDED".

Urgh -- the menu displays correctly, but defconfig now becomes totally
wrong, because the items inside are taken to depend on EMBEDDED
instead of toggling visibility. Better to add "if EMBEDDED" to the end
of all the prompts, then.

That was counter-intuitive :-(


Vegard

--
"The animistic metaphor of the bug that maliciously sneaked in while
the programmer was not looking is intellectually dishonest as it
disguises that the error is the programmer's own creation."
-- E. W. Dijkstra, EWD1036

2008-11-29 11:00:25

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH] kbuild: fix CONFIG_EMBEDDED submenu

On Fri, Nov 28, 2008 at 11:41:59PM +0100, Vegard Nossum wrote:
> On Fri, Nov 28, 2008 at 6:38 PM, Vegard Nossum <[email protected]> wrote:
> > From 06f65799401f08eff0020ba0300133c89bd02349 Mon Sep 17 00:00:00 2001
> > From: Vegard Nossum <[email protected]>
> > Date: Fri, 28 Nov 2008 18:29:47 +0100
> > Subject: [PATCH] kbuild: fix CONFIG_EMBEDDED submenu
> >
> > Many of the elements of the EMBEDDED submenu were being expanded
> > in the current menu instead of inside the submenu. This was caused
> > by the lack of (explicit) dependencies on EMBEDDED. The simplest
> > fix is to wrap everything (except COMPAT_BRK, which just toggles a
> > setting) in "if/endif EMBEDDED".
>
> Urgh -- the menu displays correctly, but defconfig now becomes totally
> wrong, because the items inside are taken to depend on EMBEDDED
> instead of toggling visibility. Better to add "if EMBEDDED" to the end
> of all the prompts, then.
>
> That was counter-intuitive :-(

Thanks for the feedback Vegard!

I had it queued as I wanted to check if the conversion
from
prompt "foo" if EMBEDDED

to
depends on EMBEDDED

caused any signigicant difference. And so it did.

The fist uses EMBEDDED to say if the prompt is visible or not.
The latter say if this symbol can be set or not (overriding default)
as you experienced.

One day we should take a deeper look at the usage of EMBEDDED.
Replacing EMBEDDED with:

OPTIMIZE_FOR_TEXT_SIZE
OPTIMIZE_FOR_DATA_SIZE
KERNEL_EXPERT

would make it much more obvious what you could
achive by the individual options.

Sam