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: <ZLFpM+H2bfkJx65S@fjasle.eu>
Date:   Fri, 14 Jul 2023 17:26:43 +0200
From:   Nicolas Schier <nicolas@...sle.eu>
To:     Michal Suchanek <msuchanek@...e.de>
Cc:     linux-modules@...r.kernel.org, Takashi Iwai <tiwai@...e.com>,
        Lucas De Marchi <lucas.de.marchi@...il.com>,
        Michal Koutný <mkoutny@...e.com>,
        Jiri Slaby <jslaby@...e.com>, Jan Engelhardt <jengelh@...i.de>,
        Masahiro Yamada <masahiroy@...nel.org>,
        Nathan Chancellor <nathan@...nel.org>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH kmod v2 3/4] kmod: Add config command to show compile
 time configuration as JSON

On Wed, Jul 12, 2023 at 04:00:47PM +0200 Michal Suchanek wrote:
> Show prefix (where configuration files are searched/to be installed),
> module compressions, and module signatures supported.
> 
> Signed-off-by: Michal Suchanek <msuchanek@...e.de>
> ---
> v2: mention module signature in commit message
> ---
>  man/kmod.xml |  6 ++++++
>  tools/kmod.c | 39 +++++++++++++++++++++++++++++++++++++++
>  2 files changed, 45 insertions(+)
> 
> diff --git a/man/kmod.xml b/man/kmod.xml
> index 0706ad58c2cc..f992a500f836 100644
> --- a/man/kmod.xml
> +++ b/man/kmod.xml
> @@ -71,6 +71,12 @@
>            <para>Show the help message.</para>
>          </listitem>
>        </varlistentry>
> +      <varlistentry>
> +        <term><command>config</command></term>
> +        <listitem>
> +          <para>Show compile time options in JSON.</para>
> +        </listitem>
> +      </varlistentry>
>        <varlistentry>
>          <term><command>list</command></term>
>          <listitem>
> diff --git a/tools/kmod.c b/tools/kmod.c
> index 55689c075ab1..5a13716955c1 100644
> --- a/tools/kmod.c
> +++ b/tools/kmod.c
> @@ -37,9 +37,11 @@ static const struct option options[] = {
>  };
>  
>  static const struct kmod_cmd kmod_cmd_help;
> +static const struct kmod_cmd kmod_cmd_config;
>  
>  static const struct kmod_cmd *kmod_cmds[] = {
>  	&kmod_cmd_help,
> +	&kmod_cmd_config,
>  	&kmod_cmd_list,
>  	&kmod_cmd_static_nodes,
>  
> @@ -95,6 +97,43 @@ static const struct kmod_cmd kmod_cmd_help = {
>  	.help = "Show help message",
>  };
>  
> +static const char *compressions[] = {
> +#ifdef ENABLE_ZSTD
> +			"zstd",
> +#endif
> +#ifdef ENABLE_XZ
> +			"xz",
> +#endif
> +#ifdef ENABLE_ZLIB
> +			"gz",
> +#endif
> +			NULL
> +};
> +
> +static int kmod_config(int argc, char *argv[])
> +{
> +	unsigned i;
> +	printf("{\"prefix\":\"" PREFIX "\""
> +			",\"module_signature\":["
> +#ifdef ENABLE_OPENSSL
> +			"\"PKCS#7\","
> +#endif
> +			"\"legacy\"]"
> +			",\"module_compression\":[");
> +	for(i = 0; compressions[i]; i++) {
> +		printf("%s\"%s\"", i ? "," : "", compressions[i]);
> +	}
> +	printf("]}\n");
> +
> +	return EXIT_SUCCESS;
> +}
> +
> +static const struct kmod_cmd kmod_cmd_config = {
> +	.name = "config",
> +	.cmd = kmod_config,
> +	.help = "Show compile time options in JSON",
> +};
> +
>  static int handle_kmod_commands(int argc, char *argv[])
>  {
>  	const char *cmd;
> -- 
> 2.41.0

If kmod could show selected configs without some (JSON) syntax
around, it could simplify its proposed use in kbuild. E.g.:

    kmod config prefix 2>/dev/null

instead of

    kmod config &>/dev/null && kmod config | jq -r .prefix
.

-- 
epost|xmpp: nicolas@...sle.eu          irc://oftc.net/nsc
↳ gpg: 18ed 52db e34f 860e e9fb  c82b 7d97 0932 55a0 ce7f
     -- frykten for herren er opphav til kunnskap --

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ