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: <alpine.DEB.2.00.0902210008580.30069@gandalf.stny.rr.com>
Date:	Sat, 21 Feb 2009 00:24:05 -0500 (EST)
From:	Steven Rostedt <rostedt@...dmis.org>
To:	LKML <linux-kernel@...r.kernel.org>, linux-kbuild@...r.kernel.org
cc:	Randy Dunlap <randy.dunlap@...cle.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Ingo Molnar <mingo@...e.hu>, zippel@...ux-m68k.org,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: [PATCH][RFC] check for select dependency errors on config load


There's been a few problems with SELECT and dependencies lately.
I've been burnt by it a few times myself. So I look at the kconfig
code and added this patch. It can use a bit more work but it does what
I want.

When the config is loaded, it checks all the symbols that are
selected by an active config and makes sure the visible dependencies are 
also activated. This should probably be moved to the writing of the 
config instead, but since I just wanted to see if my current config was 
OK, I did it on load. This is an RFC patch anyway, so fixes/comments are 
definitely welcome.

Here's what I get with the attached config running on 2.6.29-rc5.

$ make menuconfig
scripts/kconfig/mconf arch/x86/Kconfig
.config:2561:warning: MICROCODE selects FW_LOADER which fails its dependencies!
.config:2561:warning: MICROCODE_INTEL selects FW_LOADER which fails its dependencies!
.config:2561:warning: PCMCIA_LOAD_CIS selects FW_LOADER which fails its dependencies!
.config:2561:warning: SCSI_SAS_LIBSAS selects SCSI_SAS_ATTRS which fails its dependencies!
.config:2561:warning: SCSI_AIC94XX selects FW_LOADER which fails its dependencies!
.config:2561:warning: KEYBOARD_ATKBD selects SERIO which fails its dependencies!
.config:2561:warning: KEYBOARD_ATKBD selects SERIO_LIBPS2 which fails its dependencies!
.config:2561:warning: KEYBOARD_ATKBD selects SERIO_I8042 which fails its dependencies!
.config:2561:warning: MOUSE_PS2 selects SERIO which fails its dependencies!
.config:2561:warning: MOUSE_PS2 selects SERIO_LIBPS2 which fails its dependencies!
.config:2561:warning: MOUSE_PS2 selects SERIO_I8042 which fails its dependencies!
.config:2561:warning: VT selects INPUT which fails its dependencies!
.config:2561:warning: DRM selects I2C_ALGOBIT which fails its dependencies!
.config:2561:warning: SND_EMU10K1 selects FW_LOADER which fails its dependencies!

<exit out>

*** End of Linux kernel configuration.
*** Execute 'make' to build the kernel or try 'make help'.

This also flags the MARKERS error with KVM_TRACE in linux-tip.

Signed-off-by: Steven Rostedt <srostedt@...hat.com>


diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 830d9ea..abe31e1 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -310,6 +310,109 @@ load:
 	return 0;
 }
 
+static int test_deps(struct symbol *sym)
+{
+	struct property *prop;
+	struct expr *expr;
+
+	if (sym->rev_dep.tri == no)
+		return 1;
+
+	for (prop = sym->prop; prop; prop = prop->next) {
+		if (prop->type != P_PROMPT)
+			continue;
+
+		expr = prop->visible.expr;
+		if (!expr)
+			continue;
+
+		if (expr_calc_value(expr) == no)
+			return 0;
+	}
+
+	return 1;
+}
+
+void test_select(struct symbol *sym)
+{
+	struct property *prop;
+	struct expr *expr;
+
+	for (prop = sym->prop; prop; prop = prop->next) {
+		if (prop->type != P_SELECT)
+			continue;
+
+		expr = prop->expr;
+
+		if (!expr || expr->type != E_SYMBOL ||
+		    !expr->left.sym)
+			continue;
+			
+		if (test_deps(expr->left.sym))
+			continue;
+
+		conf_warning("%s selects %s which fails its dependencies!",
+			     sym->name, expr->left.sym->name);
+	}
+}
+
+void test_conf(void)
+{
+	struct symbol *sym;
+	struct menu *menu;
+	int type;
+
+	menu = rootmenu.list;
+	while (menu) {
+		sym = menu->sym;
+		if (!sym)
+			goto next;
+
+		if (!(sym->flags & SYMBOL_CHOICE)) {
+			sym_calc_value(sym);
+			if (!(sym->flags & SYMBOL_WRITE))
+				goto next;
+			type = sym->type;
+			if (type == S_TRISTATE) {
+				sym_calc_value(modules_sym);
+				if (modules_sym->curr.tri == no)
+					type = S_BOOLEAN;
+			}
+			switch (type) {
+			case S_BOOLEAN:
+			case S_TRISTATE:
+				switch (sym_get_tristate_value(sym)) {
+				case no:
+					break;
+				case mod:
+				case yes:
+					test_select(sym);
+					break;
+				}
+				break;
+			case S_STRING:
+			case S_HEX:
+			case S_INT:
+				break;
+			}
+		}
+
+	next:
+		if (menu->list) {
+			menu = menu->list;
+			continue;
+		}
+		if (menu->next)
+			menu = menu->next;
+		else while ((menu = menu->parent)) {
+			if (menu->next) {
+				menu = menu->next;
+				break;
+			}
+		}
+	}
+}
+
 int conf_read(const char *name)
 {
 	struct symbol *sym, *choice_sym;
@@ -386,6 +489,7 @@ int conf_read(const char *name)
 
 	sym_add_change_count(conf_warnings || conf_unsaved);
 
+	test_conf();
 	return 0;
 }
 


View attachment "test-config" of type "TEXT/PLAIN" (69093 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ