From: "Jan Beulich" <jbeulich@suse.com>
To: <gregkh@linuxfoundation.org>, <kay@vrfy.org>
Cc: <yuanhan.liu@linux.intel.com>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] kmsg: properly handle concurrent non-blocking read() from /proc/kmsg
Date: Wed, 04 Jul 2012 07:22:34 +0100 [thread overview]
Message-ID: <4FF3EF3A0200007800087520@nat28.tlf.novell.com> (raw)
In-Reply-To: <1341339437.815.4.camel@mop>
>>> Kay Sievers <kay@vrfy.org> 07/03/12 8:17 PM >>>
>From: Kay Sievers <kay@vrfy.org>
>Subject: kmsg: properly handle concurrent non-blocking read() from /proc/kmsg
>
>The /proc/kmsg read() interface is internally simply wired up to a sequence
>of syslog() syscalls, which might are racy between their checks and actions,
>regarding concurrency.
>
>In the (very uncommon) case of concurrent readers of /dev/kmsg, relying on
>usual O_NONBLOCK behavior, the recently introduced mutex might block an
>O_NONBLOCK reader in read(), when poll() returns for it, but another process
>has already read the data in the meantime. We've seen that while running
>artificial test setups and tools that "fight" about /proc/kmsg data.
>
>This restores the original /proc/kmsg behavior, where in case of concurrent
>read()s, poll() might wake up but the read() syscall will just return 0 to
>the caller, while another process has "stolen" the data.
>
>This is in the general case not the expected behavior, but it is the exact
>same one, that can easily be triggered with a 3.4 kernel, and some tools
>might just rely on it.
>
>The mutex is not needed, the original integrity issue which introduced it,
>is in the meantime covered by:
>"fill buffer with more than a single message for SYSLOG_ACTION_READ"
>116e90b23f74d303e8d607c7a7d54f60f14ab9f2
>
>Cc: Yuanhan Liu <yuanhan.liu@linux.intel.com>
>Cc: Jan Beulich <JBeulich@suse.com>
>Signed-off-by: Kay Sievers <kay@vrfy.org>
This being a revert of all but a single change of
4a77a5a06ec66ed05199b301e7c25f42f979afdc, which I had suggested to
be reverted anyway:
Acked-by: Jan Beulich <jbeulich@suse.com>
prev parent reply other threads:[~2012-07-04 6:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-03 18:17 Kay Sievers
2012-07-04 6:22 ` Jan Beulich [this message]
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=4FF3EF3A0200007800087520@nat28.tlf.novell.com \
--to=jbeulich@suse.com \
--cc=gregkh@linuxfoundation.org \
--cc=kay@vrfy.org \
--cc=linux-kernel@vger.kernel.org \
--cc=yuanhan.liu@linux.intel.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®