[Bug 1710] New: symlink in IMFS fails to cross mount point

bugzilla-daemon at rtems.org bugzilla-daemon at rtems.org
Wed Oct 6 17:14:16 UTC 2010


https://www.rtems.org/bugzilla/show_bug.cgi?id=1710

           Summary: symlink in IMFS fails to cross mount point
           Product: RTEMS
           Version: 4.9
          Platform: All
        OS/Version: RTEMS
            Status: NEW
          Severity: major
          Priority: P3
         Component: filesystem
        AssignedTo: chrisj at rtems.org
        ReportedBy: strauman at slac.stanford.edu


My root FS is IMFS.

I create a directory 

mkdir("/mnt",0777)

and a symlink

symlink("mnt","/lnk")

which works fine (e.g., chdir("/lnk") or opendir("/lnk")
do not produce errors).

If I mount a NFS volume on "/mnt" then e.g.,

chdir("/lnk")

fails. (chdir("/mnt") works fine)

I believe this is related to the code in IMFS_evaluate_sym_link()

...

> result = IMFS_eval_path(
>    &jnode->info.sym_link.name[i],
>    strlen( &jnode->info.sym_link.name[i] ),
>    flags,
>    node
>  );

>  IMFS_Set_handlers( node );

>  /*
>   * Verify we have the correct permissions for this node.
>   */

>  if ( !IMFS_evaluate_permission( node, flags ) )
>    rtems_set_errno_and_return_minus_one( EACCES );
>
>  return result;
> }    

where after evaluating the target of the symlink
IMFS_Set_handlers(node) and IMFS_evaluate_permission(node,flags)
are executed on the 'node' ignoring the possibility that
the node returned by the IMFS_eval_path() routine could
actually reside on another file system after crossing
a moint point!

Observation:
A look at IMFS_eval_path() reveals that any non-error return
path from IMFS_eval_path() which does *not* cross mount points
already executes IMFS_Set_handlers and IMFS_evaluate_permission.
Hence I believe that simply removing these operations from
IMFS_evaluate_sym_link() would fix the problem.

I just tested removing these two calls and it did indeed
fix the problem but I'm not familiar enough with the
FS code to be sure that it wouldn't break other things
even though it is quite unlikely given that my observation
is easy to verify.

-- 
Configure bugmail: https://www.rtems.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the bugs mailing list