noux: remove contexts from Vfs_io_channel

Channels, and therefore contexts, may be shared between children
causing corruption when a child is destroyed while another child still
uses the old context within the channel.

related to #2601
This commit is contained in:
Sebastian Sumpf 2017-12-01 16:24:07 +01:00 committed by Christian Helmuth
parent dcce3d5a40
commit 568865bde0
3 changed files with 8 additions and 14 deletions

View File

@ -144,8 +144,7 @@ connect_stdio(Genode::Env &env,
return *new (alloc) return *new (alloc)
Vfs_io_channel(path.string(), root.leaf_path(path.string()), &root, Vfs_io_channel(path.string(), root.leaf_path(path.string()), &root,
vfs_handle, vfs_handle_context, vfs_handle, vfs_io_waiter_registry, env.ep());
vfs_io_waiter_registry, env.ep());
} }

View File

@ -240,7 +240,7 @@ bool Noux::Child::syscall(Noux::Session::Syscall sc)
Shared_pointer<Io_channel> Shared_pointer<Io_channel>
channel(new (_heap) Vfs_io_channel(_sysio.open_in.path, channel(new (_heap) Vfs_io_channel(_sysio.open_in.path,
leaf_path, &_root_dir, leaf_path, &_root_dir,
vfs_handle, _vfs_handle_context, vfs_handle,
_vfs_io_waiter_registry, _vfs_io_waiter_registry,
_env.ep()), _env.ep()),
_heap); _heap);

View File

@ -62,8 +62,6 @@ struct Noux::Vfs_io_channel : Io_channel
Vfs::Vfs_handle *_fh; Vfs::Vfs_handle *_fh;
Vfs_handle_context &_context;
Vfs_io_waiter_registry &_vfs_io_waiter_registry; Vfs_io_waiter_registry &_vfs_io_waiter_registry;
Absolute_path _path; Absolute_path _path;
@ -71,16 +69,13 @@ struct Noux::Vfs_io_channel : Io_channel
Vfs_io_channel(char const *path, char const *leaf_path, Vfs_io_channel(char const *path, char const *leaf_path,
Vfs::Dir_file_system *root_dir, Vfs::Vfs_handle *vfs_handle, Vfs::Dir_file_system *root_dir, Vfs::Vfs_handle *vfs_handle,
Vfs_handle_context &vfs_handle_context,
Vfs_io_waiter_registry &vfs_io_waiter_registry, Vfs_io_waiter_registry &vfs_io_waiter_registry,
Entrypoint &ep) Entrypoint &ep)
: :
_read_avail_handler(ep, *this, &Vfs_io_channel::_handle_read_avail), _read_avail_handler(ep, *this, &Vfs_io_channel::_handle_read_avail),
_fh(vfs_handle), _context(vfs_handle_context), _fh(vfs_handle), _vfs_io_waiter_registry(vfs_io_waiter_registry),
_vfs_io_waiter_registry(vfs_io_waiter_registry),
_path(path), _leaf_path(leaf_path) _path(path), _leaf_path(leaf_path)
{ {
_fh->context = &_context;
_fh->fs().register_read_ready_sigh(_fh, _read_avail_handler); _fh->fs().register_read_ready_sigh(_fh, _read_avail_handler);
} }
@ -93,7 +88,7 @@ struct Noux::Vfs_io_channel : Io_channel
vfs_io_waiter.wait_for_io(); vfs_io_waiter.wait_for_io();
while (_fh->fs().complete_sync(_fh) == Vfs::File_io_service::SYNC_QUEUED) while (_fh->fs().complete_sync(_fh) == Vfs::File_io_service::SYNC_QUEUED)
_context.vfs_io_waiter.wait_for_io(); vfs_io_waiter.wait_for_io();
_fh->ds().close(_fh); _fh->ds().close(_fh);
} }
@ -146,7 +141,7 @@ struct Noux::Vfs_io_channel : Io_channel
if (sysio.error.read != Vfs::File_io_service::READ_QUEUED) if (sysio.error.read != Vfs::File_io_service::READ_QUEUED)
break; break;
_context.vfs_io_waiter.wait_for_io(); vfs_io_waiter.wait_for_io();
} }
if (sysio.error.read != Vfs::File_io_service::READ_OK) if (sysio.error.read != Vfs::File_io_service::READ_OK)
@ -173,7 +168,7 @@ struct Noux::Vfs_io_channel : Io_channel
vfs_io_waiter.wait_for_io(); vfs_io_waiter.wait_for_io();
while (_fh->fs().complete_sync(_fh) == Vfs::File_io_service::SYNC_QUEUED) while (_fh->fs().complete_sync(_fh) == Vfs::File_io_service::SYNC_QUEUED)
_context.vfs_io_waiter.wait_for_io(); vfs_io_waiter.wait_for_io();
Vfs::Directory_service::Stat stat; Vfs::Directory_service::Stat stat;
sysio.error.stat = _fh->ds().stat(_leaf_path.base(), stat); sysio.error.stat = _fh->ds().stat(_leaf_path.base(), stat);
@ -262,7 +257,7 @@ struct Noux::Vfs_io_channel : Io_channel
if (read_result != Vfs::File_io_service::READ_QUEUED) if (read_result != Vfs::File_io_service::READ_QUEUED)
break; break;
_context.vfs_io_waiter.wait_for_io(); vfs_io_waiter.wait_for_io();
} }
if ((read_result != Vfs::File_io_service::READ_OK) || if ((read_result != Vfs::File_io_service::READ_OK) ||