[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4A97DBC1.3000508@xyzw.org>
Date: Fri, 28 Aug 2009 06:29:37 -0700
From: Brian Rogers <brian@...w.org>
To: "Eric W. Biederman" <ebiederm@...ssion.com>
CC: Eric Paris <eparis@...hat.com>, linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org, "Rafael J. Wysocki" <rjw@...k.pl>
Subject: Re: [PATCH] inotify: Ensure we alwasy write the terminating NULL.
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@...stanetworks.com>
>
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.
View attachment "0001-inotify-Fix-events-with-no-pathname.patch" of type "text/x-patch" (1321 bytes)
Powered by blists - more mailing lists