Hi Genodians,
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.
You can test it with the runscript in the following commit: https://github.com/throwException/genode/commit/1a9fb7a3eb07096158b07252309e...
Can anyone explain this behavior?
Kind regards Stefan
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.
https://github.com/genodelabs/genode/commit/60eb542915dc709aae3a2c62e393c6a1...
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 server).
Best regards Christian