Re: [PATCH] inotify: Ensure we alwasy write the terminating NULL.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2009-08-28 at 06:29 -0700, Brian Rogers wrote:
> Eric W. Biederman wrote:
> > Before the rewrite copy_event_to_user always wrote a terqminating '\0'
> > byte to user space after the filename.  Since the rewrite that
> > terminating byte was skipped if your filename is exactly a multiple of
> > event_size.  Ouch!
> >
> > So add one byte to name_size before we round up and use clear_user to
> > set userspace to zero like /dev/zero does instead of copying the
> > strange nul_inotify_event.  I can't quite convince myself len_to_zero
> > will never exceed 16 and even if it doesn't clear_user should be more
> > efficient and a more accurate reflection of what the code is trying to
> > do.
> >
> > Signed-off-by: Eric W. Biederman <ebiederm@xxxxxxxxxxxxxxxxxx>
> >   
> 
> I found that this change prevents my Ubuntu Karmic system from booting. 
> It just idles forever very early in the process. Probably a boot script 
> is waiting for an event that it doesn't receive properly.
> 
> > -	name_len = roundup(event->name_len, event_size);
> > +	name_len = roundup(event->name_len + 1, event_size);
> >   
> 
> This means the test later on will now always evaluate to true:
> > if (name_len) {
> 
> And in cases where that test previously would have failed, the code now 
> outputs a block full of zeros. Assuming that's bad and the test was 
> important, I coded the attached naive fix, which is working for me.

Thanks, I ask Linus to pull a (slightly modified) version.  Don't know
if he'll get it before he runs out on vacation.  Here's hoping.

-Eric

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux