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:	Wed, 19 Jun 2013 00:45:05 +0200
From:	"Yann E. MORIN" <yann.morin.1998@...e.fr>
To:	linux-kbuild@...r.kernel.org
Cc:	linux-kernel@...r.kernel.org, Michal Marek <mmarek@...e.cz>,
	"Yann E. MORIN" <yann.morin.1998@...e.fr>,
	Matthieu CASTET <matthieu.castet@...rot.com>,
	Arnaud Lacombe <lacombar@...il.com>,
	Sedat Dilek <sedat.dilek@...il.com>
Subject: [PATCH 09/14] kconfig/conf: fix randconfig setting multiple symbols in a choice

From: "Yann E. MORIN" <yann.morin.1998@...e.fr>

Currently, randconfig may set more than one symbol in a given choice.
Given this config file:
    config A
        bool "A"
    if A
    choice
        bool "B/C/D"
    config B
        bool "B"
    config C
        bool "C"
    config D
        bool "D"
    endchoice
    endif # A

Then randconfig generates such .config files (case where A is not set is not
shown below for brevity), and where only the right-most .config is valid:
  CONFIG_A=y                  CONFIG_A=y                  CONFIG_A=y
  CONFIG_B=y                  CONFIG_B=y                  CONFIG_B=y
  CONFIG_C=y                  # CONFIG_C is not set       # CONFIG_C is not set
  # CONFIG_D is not set       CONFIG_D=y                  # CONFIG_D is not set

That is, in a randomised choice, the first symbol is always selected,
and at most one other symbol may be selected.

This is due to symbol randomised in a choice not being properly flagged
as having a value.

Fix that by flagging those symbols adequately: have a user-defined value,
and be not valid (to force recalculation of the symbol).

Note: if the choice is not conditional, then the randomisation is properly
done.

Reported-by: Matthieu CASTET <matthieu.castet@...rot.com>
Signed-off-by: Matthieu CASTET <matthieu.castet@...rot.com>
[yann.morin.1998@...e.fr: independently re-done the same patch as Matthieu,
                          as pointed out by Sedat]
Cc: Arnaud Lacombe <lacombar@...il.com>
Cc: Sedat Dilek <sedat.dilek@...il.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@...e.fr>
---
 scripts/kconfig/confdata.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 35e0f16..d36bc1f 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -1077,6 +1077,9 @@ static void randomize_choice_values(struct symbol *csym)
 		else {
 			sym->def[S_DEF_USER].tri = no;
 		}
+		sym->flags |= SYMBOL_DEF_USER;
+		/* clear VALID to get value calculated */
+		sym->flags &= ~SYMBOL_VALID;
 	}
 	csym->flags |= SYMBOL_DEF_USER;
 	/* clear VALID to get value calculated */
-- 
1.8.1.2

--
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