message: Prevent parent directory from being opened without being preopened wasi
diff: @@ -1463,10 +1463,28 @@ pub fn path_open(
  "Looking for file {} in directory {:#?}",
  file_name, cumulative_path
  );
  +
  cumulative_path.push(file_name);
  let file_path = cumulative_path;
  - let out_fd = if let Kind::Dir { entries, .. } = &mut state.fs.inodes[cur_dir_inode].kind {
  + let out_fd = if let Kind::Dir {
  + entries, parent, ..
  + } = &mut state.fs.inodes[cur_dir_inode].kind
  + {
  + // short circuit logic if attempting to get parent
  + if file_name == ".." {
  + if let Some(p) = parent {
  + let parent_inode = *p;
  + wasi_try!(state.fs.create_fd(
  + fs_rights_base,
  + fs_rights_inheriting,
  + fs_flags,
  + parent_inode
  + ))
  + } else {
  + return __WASI_EACCES;
  + }
  + } else {
  if let Some(child) = entries.get(file_name).cloned() {
  let child_inode_val = &state.fs.inodes[child];
  // early return based on flags
  @@ -1488,6 +1506,7 @@ pub fn path_open(
  .create_fd(fs_rights_base, fs_rights_inheriting, fs_flags, child))
  } else {
  debug!("Attempting to load file from host system");
  +
  let file_metadata = file_path.metadata();
  // if entry does not exist in parent directory, try to lazily
  // load it; possibly creating or truncating it if flags set
  @@ -1555,6 +1574,7 @@ pub fn path_open(
  new_fd
  }
  + }
  } else {
  // working_dir did not match on Kind::Dir
  return __WASI_ENOTDIR;
  