From: Rusty Russell <rusty@rustcorp.com.au>
To: Kees Cook <keescook@chromium.org>, linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
Joe Perches <joe@perches.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
David Howells <dhowells@redhat.com>,
Dave Hansen <dave.hansen@linux.intel.com>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
keescook@chromium.org
Subject: Re: [PATCH v3 1/2] test: add minimal module for verification testing
Date: Thu, 05 Dec 2013 13:12:17 +1030 [thread overview]
Message-ID: <87li00ow6u.fsf@rustcorp.com.au> (raw)
In-Reply-To: <1386184969-29750-2-git-send-email-keescook@chromium.org>
Kees Cook <keescook@chromium.org> writes:
> When doing module loading verification tests (for example, with module
> singing, or LSM hooks), it is very handy to have a module that can be
"module singing" sounds like a horrible idea! Is the author even
musical? I've only heard it said David Howls.
But if my ack for the patch helps:
Acked-by: Rusty Russell <rusty@rustcorp.com.au>
Cheers,
Rusty.
> built on all systems under test, isn't auto-loaded at boot, and has
> no device or similar dependencies. This creates the "test_module.ko"
> module for that purpose, which only reports its load and unload to printk.
>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
> v3:
> - use KBUILD_MODNAME; Rusty Russell
> v2:
> - use pr_warn, better comment, add headers explicitly, move to lib/; akpm.
> ---
> lib/Kconfig.debug | 14 ++++++++++++++
> lib/Makefile | 1 +
> lib/test_module.c | 33 +++++++++++++++++++++++++++++++++
> 3 files changed, 48 insertions(+)
> create mode 100644 lib/test_module.c
>
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index db25707aa41b..81882335c625 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -1578,6 +1578,20 @@ config DMA_API_DEBUG
> This option causes a performance degredation. Use only if you want
> to debug device drivers. If unsure, say N.
>
> +config TEST_MODULE
> + tristate "Test module loading with 'hello world' module"
> + default n
> + depends on m
> + help
> + This builds the "test_module" module that emits "Hello, world"
> + on printk when loaded. It is designed to be used for basic
> + evaluation of the module loading subsystem (for example when
> + validating module verification). It lacks any extra dependencies,
> + and will not normally be loaded by the system unless explicitly
> + requested by name.
> +
> + If unsure, say N.
> +
> source "samples/Kconfig"
>
> source "lib/Kconfig.kgdb"
> diff --git a/lib/Makefile b/lib/Makefile
> index a459c31e8c6b..b494b9af631c 100644
> --- a/lib/Makefile
> +++ b/lib/Makefile
> @@ -31,6 +31,7 @@ obj-y += string_helpers.o
> obj-$(CONFIG_TEST_STRING_HELPERS) += test-string_helpers.o
> obj-y += kstrtox.o
> obj-$(CONFIG_TEST_KSTRTOX) += test-kstrtox.o
> +obj-$(CONFIG_TEST_MODULE) += test_module.o
>
> ifeq ($(CONFIG_DEBUG_KOBJECT),y)
> CFLAGS_kobject.o += -DDEBUG
> diff --git a/lib/test_module.c b/lib/test_module.c
> new file mode 100644
> index 000000000000..319b66f1ff61
> --- /dev/null
> +++ b/lib/test_module.c
> @@ -0,0 +1,33 @@
> +/*
> + * This module emits "Hello, world" on printk when loaded.
> + *
> + * It is designed to be used for basic evaluation of the module loading
> + * subsystem (for example when validating module signing/verification). It
> + * lacks any extra dependencies, and will not normally be loaded by the
> + * system unless explicitly requested by name.
> + */
> +
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
> +#include <linux/init.h>
> +#include <linux/module.h>
> +#include <linux/printk.h>
> +
> +static int __init test_module_init(void)
> +{
> + pr_warn("Hello, world\n");
> +
> + return 0;
> +}
> +
> +module_init(test_module_init);
> +
> +static void __exit test_module_exit(void)
> +{
> + pr_warn("Goodbye\n");
> +}
> +
> +module_exit(test_module_exit);
> +
> +MODULE_AUTHOR("Kees Cook <keescook@chromium.org>");
> +MODULE_LICENSE("GPL");
> --
> 1.7.9.5
next prev parent reply other threads:[~2013-12-05 2:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-04 19:22 [PATCH v3 0/2] test modules Kees Cook
2013-12-04 19:22 ` [PATCH v3 1/2] test: add minimal module for verification testing Kees Cook
2013-12-05 2:42 ` Rusty Russell [this message]
2013-12-05 2:56 ` Andrew Morton
2013-12-05 3:16 ` Rusty Russell
2013-12-05 18:18 ` Kees Cook
2013-12-04 19:22 ` [PATCH v3 2/2] test: check copy_to/from_user boundary validation Kees Cook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87li00ow6u.fsf@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=akpm@linux-foundation.org \
--cc=dave.hansen@linux.intel.com \
--cc=dhowells@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=joe@perches.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox