Re: fun with nilfs_cleanerd
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@xxxxxxxxxxxxx>
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@xxxxxxxxx>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@xxxxxxxxxxxxx>
---
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
ÿô.nÇ·®+%˱é¥wÿº{.nÇ·¥{±þx¥~ÏØnr¡öë¨è&£ûz¹Þúzf£¢·h§~Ûÿÿïÿê_èæ+v¨þ)ßø
[Linux Filesystem; Devel]
[Linux CIFS]
[Linux USB Devel]
[Video for Linux]
[Linux Audio Users]
[Photo]
[Yosemite News]
[Yosemite Photos]
[Free Online Dating]
[Linux Kernel]
[Linux SCSI]
[XFree86]