All of lore.kernel.org
 help / color / mirror / Atom feed
* fun with nilfs_cleanerd
@ 2011-05-26  9:10 dexen deVries
       [not found] ` <201105261110.15660.dexen.devries-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: dexen deVries @ 2011-05-26  9:10 UTC (permalink / raw)
  To: linux-nilfs-u79uwXL29TY76Z2rM5mHXA

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! ;-)
-- 
dexen deVries

[[[↓][→]]]

For example, if the first thing in the file is:
   <?kzy irefvba="1.0" rapbqvat="ebg13"?>
an XML parser will recognize that the document is stored in the traditional 
ROT13 encoding.

(( Joe English, http://www.flightlab.com/~joe/sgml/faq-not.txt ))
--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: fun with nilfs_cleanerd
       [not found] ` <201105261110.15660.dexen.devries-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2011-05-26 10:03   ` Ryusuke Konishi
  0 siblings, 0 replies; 2+ messages in thread
From: Ryusuke Konishi @ 2011-05-26 10:03 UTC (permalink / raw)
  To: dexen.devries-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-nilfs-u79uwXL29TY76Z2rM5mHXA

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-05-26 10:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.