public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: mtk.manpages@gmail.com, Kees Cook <keescook@chromium.org>
Cc: linux-kernel@vger.kernel.org, linux-man <linux-man@vger.kernel.org>
Cc: Lucas De Marchi <lucas.demarchi@profusion.mobi>,
	"Jon Masters" <jonathan@jonmasters.org>
Subject: Re: [Request for review] Revised delete_module(2) manual page
Date: Thu, 11 Oct 2012 13:32:59 +1030	[thread overview]
Message-ID: <87txu17lss.fsf@rustcorp.com.au> (raw)
In-Reply-To: <CAKgNAkgp1er3-3nvge9_aVObuuxBatGRur8DtiTzyWK4w+4hrA@mail.gmail.com>

"Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com> writes:

> Hello Kees, Rusty,
>
> The current delete_module(2) page is severely out of date (basically,
> its content corresponds to 2.4 days, and was even pretty thin in
> covering that). So, I took a shot at revising the page to Linux 2.6+
> reality. Would it be possible that you could review it?

OK.  Main suggestion is that I discussed with Lucas removing the
!O_NONBLOCK case.  It's not supported by modprobe -r, and almost
unheard-of for rmmod (it's --wait).

In practice, people want the unload-or-fail semantics, or the
force-unload semantics.

> Otherwise, by default,
> .BR delete_module ()
> marks a module so that no new references are permitted.
> If the module's reference count
> (i.e., the number of processes currently using the module) is nonzero,
> it then places the caller in an uninterruptible sleep
> state until all reference count is zero,
> at which point the call unblocks.
> When the reference count reaches zero, the module is unloaded.

So this should be inverted:

        Otherwise (assuming O_NONBLOCK, see flags below), if the
        module's reference count (i.e., the number of processes
        currently using the module) is nonzero, the call fails.

> The
> .IR flags
> argument can be used to modify the behavior of the system call.

It is usually set to O_NONBLOCK, which may be required in future kernel
versions (see NOTES).

> The following values can be ORed in this argument:
> .TP
> .B O_TRUNC
> .\"  	KMOD_REMOVE_FORCE in kmod library
> Force unloading of the module, even if the following conditions are true:
> .RS
> .IP * 3
> The module has no
> .I exit
> function.
> By default, attempting to unload a module that has no
> .I exit
> function fails.
> .IP *
> The reference count for (i.e., the number of processes currently using)
> this module is nonzero.
...
> .IP
> Using this flag taints the kernel (TAINT_FORCED_RMMOD).
> .IP
> .IR "Using this flag is dangerous!"
> If the kernel was not built with
> .BR CONFIG_MODULE_FORCE_UNLOAD ,
> this flag is silently ignored.

NOTES:

If O_NONBLOCK is not set, then the kernel may enter uninterruptible
sleep until the module reference count reaches zero.  This is not
generally desirable, so this flag may be compulsory in future kernel
configurations.

Cheers,
Rusty.

  reply	other threads:[~2012-10-11  3:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-09 21:35 [Request for review] Revised delete_module(2) manual page Michael Kerrisk (man-pages)
2012-10-11  3:02 ` Rusty Russell [this message]
2012-10-11 13:43   ` Lucas De Marchi
2012-10-11 22:46     ` Rusty Russell
2012-10-12  8:47   ` Michael Kerrisk (man-pages)
2012-10-21  7:36     ` Michael Kerrisk (man-pages)
2012-10-24  0:18       ` Rusty Russell
2012-10-24 12:49         ` Michael Kerrisk (man-pages)
2012-10-24  5:27       ` Lucas De Marchi
2012-10-24 12:47         ` Michael Kerrisk (man-pages)

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=87txu17lss.fsf@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@gmail.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