[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180410213354.ma5wfe3jc23pzmw4@treble>
Date: Tue, 10 Apr 2018 16:33:54 -0500
From: Josh Poimboeuf <jpoimboe@...hat.com>
To: Joe Lawrence <joe.lawrence@...hat.com>
Cc: live-patching@...r.kernel.org, linux-kselftest@...r.kernel.org,
linux-kernel@...r.kernel.org, Jiri Kosina <jikos@...nel.org>,
Petr Mladek <pmladek@...e.com>,
Miroslav Benes <mbenes@...e.cz>,
Libor Pecháček <lpechacek@...e.com>,
Nicolai Stange <nstange@...e.de>,
Artem Savkov <asavkov@...hat.com>
Subject: Re: [PATCH v2] selftests/livepatch: introduce tests
On Tue, Apr 10, 2018 at 04:50:51PM -0400, Joe Lawrence wrote:
> On 04/10/2018 04:00 PM, Josh Poimboeuf wrote:
> > On Tue, Apr 10, 2018 at 11:15:54AM -0400, Joe Lawrence wrote:
> >> +static void test_klp_shadow_vars_exit(void)
> >> +{
> >> +}
> >> +
> >> +module_init(test_klp_shadow_vars_init);
> >> +module_init(test_klp_shadow_vars_exit);
> >
> > For this last line, s/module_init/module_exit/, though I think the exit
> > function can just be removed altogether?
>
> D'oh workspace / git user error, I posted an older version :(
>
> But the exit function seems to be required if an init function is
> provided. Here I omitted the exit function:
>
> % modprobe test_klp_shadow_vars
> % lsmod | grep test_klp_shadow_vars
> test_klp_shadow_vars 16384 0
> % rmmod test_klp_shadow_vars
> rmmod: ERROR: could not remove 'test_klp_shadow_vars': Device or
> resource busy
> rmmod: ERROR: could not remove module test_klp_shadow_vars: Device or
> resource busy
>
> and from kernel/module.c
>
> SYSCALL_DEFINE2(delete_module, const char __user *, name_user,
> unsigned int, flags)
> ...
> /* If it has an init func, it must have an exit func to unload*/
> if (mod->init && !mod->exit) {
> forced = try_force_unload(flags);
> if (!forced) {
> /* This module can't be removed */
> ret = -EBUSY;
> goto out;
> }
> }
> ...
Hm, ok, though that seems like a weird limitation...
> I missed Petr's commit msg note "that the constructor is called under
> klp_shadow_lock." I'll convert the test to use GFP_ATOMIC for this
> allocation.
>
> I'll also add CONFIG_PM_SLEEP_DEBUG=y to my test VM kernel .config. Any
> other debug option suggestions?
I think CONFIG_LOCKDEP is always a good idea. Otherwise, I dunno...
Here's my .config:
https://paste.fedoraproject.org/paste/cnM-J18uVWJrxz2DAdSchg
--
Josh
Powered by blists - more mailing lists