From: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
To: The development of GNU GRUB <grub-devel@gnu.org>
Subject: Re: [PATCH] Ignore symlink traversal failures in grub-mount readdir
Date: Sun, 10 Mar 2013 14:01:53 +0100 [thread overview]
Message-ID: <513C8441.60106@gmail.com> (raw)
In-Reply-To: <20130309204726.5e70c448@opensuse.site>
[-- Attachment #1: Type: text/plain, Size: 2249 bytes --]
On 09.03.2013 17:47, Andrey Borzenkov wrote:
> В Fri, 12 Oct 2012 17:09:54 +0100
> Colin Watson <cjwatson@ubuntu.com> пишет:
>
>> This is very much a temporary hack, so I'm sending it here for
>> discussion rather than just committing it even though it's quite simple.
>>
>> r3036.1.15 introduced support for filling in the attributes of files in
>> fuse_readdir. However, symlinks to directories are passed to call_fill
>> with info.dir unset; call_fill will then try to open them with
>> grub_file_open, and get GRUB_ERR_BAD_FILE_TYPE because it's ultimately a
>> directory not a regular file. It then causes the whole readdir call to
>> fail. The net effect is that if you, for example, have a symlink
>> anywhere in the top level of a filesystem, then the entire filesystem
>> appears empty in grub-mount. This is the root cause of
>> https://bugs.launchpad.net/bugs/1051306.
>>
>> I think that the proper solution is to pass the full
>> grub_fshelp_filetype to dirhook functions, which would permit
>> implementing true symlink support in grub-mount. That would be a fairly
>> large change that I don't have time for at the moment. As a stopgap, I
>> suggest that we ignore errors from individual grub_file_open calls
>> during fuse_readdir. How does this patch look?
>>
>
> The only reason to call grub_file_open() is to fetch file size, and file
> size is already available when hooks are called. So what about patch
> below? It fixes problem for me, and it trivial enough. This allows
> directory listing to work again. I can extend it with info.is_link to
> return proper filetype to FUSE, but implementing full support needs
> adding readlink that is a separate topic.
>
> I tested it with ext4 and cpio and it works. Testing on more systems
> (in particular, NTFS, which is the only one with non-trivial change) is
> appreciated.
>
Some time ago I made a similar patch but for another motivation: current
code is way too inefficient for large directories as you have to rescan
directory for every file. The problem with this patch is 10 bytes
increase of core.img. This may be acceptable given this problem (it
happens in ls on runtime as well) and inefficency of scanning.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]
next prev parent reply other threads:[~2013-03-10 13:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-12 16:09 [PATCH] Ignore symlink traversal failures in grub-mount readdir Colin Watson
2012-10-15 15:08 ` Dave Vasilevsky
2013-03-09 16:47 ` Andrey Borzenkov
2013-03-10 13:01 ` Vladimir 'φ-coder/phcoder' Serbinenko [this message]
2013-03-10 13:02 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-11-28 13:30 ` Andrey Borzenkov
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=513C8441.60106@gmail.com \
--to=phcoder@gmail.com \
--cc=grub-devel@gnu.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;
as well as URLs for NNTP newsgroup(s).