From: Ryusuke Konishi <konishi.ryusuke-Zyj7fXuS5i5L9jVzuh4AOg@public.gmane.org>
To: dexen.devries-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Cc: linux-nilfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: fun with nilfs_cleanerd
Date: Thu, 26 May 2011 19:03:45 +0900 (JST) [thread overview]
Message-ID: <20110526.190345.217458031.ryusuke@osrg.net> (raw)
In-Reply-To: <201105261110.15660.dexen.devries-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Hi,
On Thu, 26 May 2011 11:10:07 +0200, dexen deVries wrote:
> Hi list,
>
> in /etc/rc.d/rc.local I have a command starting cleanerd for root filesystem:
> # /sbin/nilfs_cleanerd -c /etc/nilfs_cleanerd-root.conf /dev/sda3
>
> At first I wanted a separate config for root filesystem, but now same was to be
> used for both / and /home. So I've removed the metion of the config file, and
> the command became:
>
> # /sbin/nilfs_cleanerd -c /dev/sda3
>
> (note the -c !)
> ...ended up with nilfs_cleanerd spewing countless errors into /var/log/syslog,
> like:
>
> May 26 11:05:08 coil nilfs_cleanerd[18902]: ��: unknown keyword
> May 26 11:05:08 coil nilfs_cleanerd[18902]: cˮ���: unknown keyword
> May 26 11:05:08 coil nilfs_cleanerd[18902]: A�;^C�S-�g^W�^Fɂ: unknown keyword
> May 26 11:05:08 coil nilfs_cleanerd[18902]: too long line
>
>
> nilfs_cleanerd using whole partition as the config file == fun! ;-)
Okay, so non-regular files should be rejected for the config option ;)
The following patch will resolve this.
Thanks,
Ryusuke Konishi
---
From: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
nilfs_cleanerd: reject configuration file other than regular file
The current config file option accepts any types of node other than
regular files. Thus,
# /sbin/nilfs_cleanerd -c /dev/sda3
will let cleaner daemon read the device as a configuration file. This
patch prevents the unwanted result.
Reported-by: dexen deVries <dexen.devries@gmail.com>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
---
sbin/cleanerd/cldconfig.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/sbin/cleanerd/cldconfig.c b/sbin/cleanerd/cldconfig.c
index 46a15ac..1e0d066 100644
--- a/sbin/cleanerd/cldconfig.c
+++ b/sbin/cleanerd/cldconfig.c
@@ -684,6 +684,14 @@ static int nilfs_cldconfig_do_read(struct nilfs_cldconfig *config,
int nilfs_cldconfig_read(struct nilfs_cldconfig *config, const char *path,
struct nilfs *nilfs)
{
+ struct stat stbuf;
+
+ if (stat(path, &stbuf) < 0 || !S_ISREG(stbuf.st_mode)) {
+ syslog(LOG_ERR, "%s: bad configuration file", path);
+ errno = EINVAL;
+ return -1;
+ }
+
nilfs_cldconfig_set_default(config, nilfs);
if (nilfs_cldconfig_do_read(config, path, nilfs) < 0)
syslog(LOG_WARNING, "%s: cannot read", path);
--
1.7.3.5
prev parent reply other threads:[~2011-05-26 10:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-26 9:10 fun with nilfs_cleanerd dexen deVries
[not found] ` <201105261110.15660.dexen.devries-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-05-26 10:03 ` Ryusuke Konishi [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=20110526.190345.217458031.ryusuke@osrg.net \
--to=konishi.ryusuke-zyj7fxus5i5l9jvzuh4aog@public.gmane.org \
--cc=dexen.devries-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-nilfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.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