From: Andi Kleen <andi@firstfloor.org>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Andi Kleen <andi@firstfloor.org>,
Alexey Dobriyan <adobriyan@gmail.com>,
akpm@osdl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Remove BKL from sysctl(2)
Date: Thu, 24 Jan 2008 08:56:05 +0100 [thread overview]
Message-ID: <20080124075605.GB6814@one.firstfloor.org> (raw)
In-Reply-To: <20080123113800.1cecbc59@lxorguk.ukuu.org.uk>
> Yes - that's why I am wondering if we want a general 'sysctl' mutex or
> just to fix the specific case. The corename case is nasty as it is timing
> dependant against user activity rather than the less interesting "root
> can be silly" type of problem.
I think for the strings it would be better to just do a kind of copy-on-write.
As in don't use the array directly, but a pointer instead and then sysctl
allocates a new string, switches the pointer around
and then does a RCU delayed free on the old string if it wasn't in .data.
This would also have the advantage that the small upper limits these
strings currently have are gone and actually save a little memory in
the common case of them not being changed.
Only case that wouldn't fix would be someone keeping the string accessed
over a sleep point. And for preemptible kernels it would need rcu_read_lock().
So no free lunch without code auditing. But it would be probably the best
way to go forward longer term.
For multi number arrays the code ideally needs to be robust against temporary
inconsistencies.
BTW while interesting in theory in practice i suspect the actual likelyhood
of a user actually hitting such a race is pretty small because sysctls tend
to be set up a boot only where not much is going on.
-Andi
next prev parent reply other threads:[~2008-01-24 7:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-22 20:27 Alexey Dobriyan
2008-01-22 20:52 ` Ingo Molnar
2008-01-23 10:51 ` Alan Cox
2008-01-23 11:09 ` Andi Kleen
2008-01-23 11:38 ` Alan Cox
2008-01-24 7:56 ` Andi Kleen [this message]
2008-01-27 12:26 ` [PATCH 2/2] Race-free kernel.core_pattern Alexey Dobriyan
2008-01-27 16:49 ` Andi Kleen
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=20080124075605.GB6814@one.firstfloor.org \
--to=andi@firstfloor.org \
--cc=adobriyan@gmail.com \
--cc=akpm@osdl.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®