mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Joe Lawrence <joe.lawrence@redhat.com>
Cc: live-patching@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org, "Jiri Kosina" <jikos@kernel.org>,
	"Petr Mladek" <pmladek@suse.com>,
	"Miroslav Benes" <mbenes@suse.cz>,
	"Libor Pecháček" <lpechacek@suse.com>,
	"Nicolai Stange" <nstange@suse.de>,
	"Artem Savkov" <asavkov@redhat.com>
Subject: Re: [PATCH v2] selftests/livepatch: introduce tests
Date: Tue, 10 Apr 2018 16:33:54 -0500	[thread overview]
Message-ID: <20180410213354.ma5wfe3jc23pzmw4@treble> (raw)
In-Reply-To: <daac17e1-6e32-fce9-51b0-24ec25bda69f@redhat.com>

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

  reply	other threads:[~2018-04-10 21:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-10 15:15 [PATCH v2] Add livepatch kselftests Joe Lawrence
2018-04-10 15:15 ` [PATCH v2] selftests/livepatch: introduce tests Joe Lawrence
2018-04-10 20:00   ` Josh Poimboeuf
2018-04-10 20:50     ` Joe Lawrence
2018-04-10 21:33       ` Josh Poimboeuf [this message]
2018-04-10 21:38         ` Jiri Kosina
2018-04-11  3:44   ` kbuild test robot
2018-04-10 20:04 ` [PATCH v2] Add livepatch kselftests Josh Poimboeuf
2018-04-12 13:28 ` Miroslav Benes

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=20180410213354.ma5wfe3jc23pzmw4@treble \
    --to=jpoimboe@redhat.com \
    --cc=asavkov@redhat.com \
    --cc=jikos@kernel.org \
    --cc=joe.lawrence@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=lpechacek@suse.com \
    --cc=mbenes@suse.cz \
    --cc=nstange@suse.de \
    --cc=pmladek@suse.com \
    /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

all inboxes | Powered by JetHome®