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] [day] [month] [year] [list]
Date:	Sun, 31 May 2015 21:22:07 +0200
From:	Ulf Magnusson <ulfalizer.lkml@...il.com>
To:	Alexis Berlemont <alexis.berlemont@...il.com>
Cc:	linux-kernel@...r.kernel.org, jolsa@...hat.com, dsahern@...il.com,
	mingo@...hat.com, a.p.zijlstra@...llo.nl, paulus@...ba.org,
	acme@...nel.org, namhyung@...nel.org, mmarek@...e.cz
Subject: Re: [PATCH v3 14/14] perf kbuild: add generated Kconfig build-test cases

Hello, I'm the author of Kconfiglib.

I happened to notice this message just now. Might be a bit late, but I'll add
some comments anyway. :)

First of all, Kconfiglib now lives at https://github.com/ulfalizer/Kconfiglib,
just so that no one uses the old patch I sent to LKML a few years back.

Here's some comments on the script:

> +# Get all the symbols
> +symbols = dict([(s.get_name(), s) for s in ref_config.get_symbols()])
>
> +# Remove odd symbols
> +symbols.pop('y', None)
> +symbols.pop('m', None)
> +symbols.pop('n', None)

To avoid special symbols being included, you could use
get_symbols(all_symbols = False). That will also leave out symbols that are
referenced but never defined (e.g., 'depends on FOO' when there's no 'config
FOO' in the Kconfig files). That's safe here, as setting a user value on such
symbols won't have any effect anyway.

The shorthand 'for sym in ref_config:' for iterating over all symbols skips
special and undefined symbols too. get_symbols() was meant to be the
exceptional case where you really need to see all the symbols.

> +# Remove choice-related symbols
> +choices = ref_config.get_choices()
> +items = [c.get_items() for c in choices]
> +names = [i.get_name() for i in itertools.chain.from_iterable(items)]
> +for name in names:
> +    symbols.pop(name, None)

You could use Symbol.is_choice_symbol() to filter out choice symbols. If you
want to be safe against the Kconfig oddity (bug?) that you can have symbols
inside choices that aren't considered choice symbols (see
_determine_actual_symbols()), then I think checking if Symbol.get_parent()
is_choice() instead would work.

Only drivers/usb/gadget/Kconfig seems to use that "feature" of Kconfig by the
way.

> +for name in symbols:
> +    symbol = symbols[name]
> +    if not symbol.is_modifiable():
> +        continue
> +    if symbol.get_value() != 'y':
> +        continue
> +    symbol.set_user_value('n')
> +    filename = 'NO_' + name + '_config'
> +    ref_config.write_config(filename)
> +    symbol.set_user_value('y')

symbol.unset_user_value() instead of symbol.set_user_value('y') is another
option. Both ought to work here though.

I'm guessing it's okay, but this code also 'continue's if 'symbol' is 'm'.
Maybe modules aren't even used here.

Cheers,
Ulf
--
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