Empty inline files in vfs

Christian Helmuth christian.helmuth at genode-labs.com
Tue Jun 11 09:55:55 CEST 2019

Hello Stefan,

On Wed, May 29, 2019 at 11:18:41 CEST, Stefan Thöni wrote:
> I've noticed that reading an empty inline file crashes the vfs but only
> when this file is created by an <inline name="test"/> but not when it's
> created by an <inline name="test"></inline>. This can be demonstrated
> easily be noux's /bin/cat but seems to be true also with respect to
> other applications reading such files.

Thanks for the report, which points to a deficiency in the inline
VFS pluigin implementation. The following commit fixes the issue by
adding special handling for nodes without content.


> Can anyone explain this behavior?

The former implementation used Xml_node::with_raw_content()
unconditionally to instantiate the requested file handle. The Xml_node
function calls the passed lambda for all nodes with content (even if
it's zero-sized) but not for nodes like <inline/>. In this case, no
handle was instantiated but the open() function still returned OPEN_OK
but nullptr for the handle. This ended up in an endless loop in the
VFS backend of the libc in my test case. (I did not look into the vfs

Best regards

Christian Helmuth
Genode Labs

https://www.genode-labs.com/ · https://genode.org/
https://twitter.com/GenodeLabs · /ˈdʒiː.nəʊd/

Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth

More information about the users mailing list